mercredi 29 octobre 2014

magento add to cart configurable with mage in lightbox


Vote count:

0




I have a button that opens a lightbox iframe, where i would like to show the configurable product and related product with "add to cart" choice.


I have problem showing the configurable options. In my theme the options are showing with this code:



<?php
$_product = $this->getProduct();
$_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes());
?>
<?php if ($_product->isSaleable() && count($_attributes)):?>
<dl>
<?php foreach($_attributes as $_attribute): ?>
<dt><label class="required"><em>*</em><?php echo $_attribute->getLabel() ?></label></dt>
<dd<?php if ($_attribute->decoratedIsLast){?> class="last"<?php }?>>
<div class="input-box">
<select name="super_attribute[<?php echo $_attribute->getAttributeId() ?>]" id="attribute<?php echo $_attribute->getAttributeId() ?>" class="required-entry super-attribute-select">
<option><?php echo $this->__('Choose an Option...') ?></option>
</select>
</div>
</dd>
<?php endforeach; ?>
</dl>
<script type="text/javascript">
var spConfig = new Product.Config(<?php echo $this->getJsonConfig() ?>);
</script>
<?php endif;?>


i call mage file on this:



$mageFilename = 'app/Mage.php';
require_once $mageFilename;
Mage::setIsDeveloperMode(true);
umask(0);
Mage::app();
Mage::app()->setCurrentStore(Mage::getModel('core/store')->load(Mage_Core_Model_App::ADMIN_STORE_ID));


How i should change the options script to work with mage?


count($_product->getAllowAttributes()); (above the script not the product name) returns zero attributes, why?


How i should change $this to?



asked 32 secs ago







magento add to cart configurable with mage in lightbox

Aucun commentaire:

Enregistrer un commentaire