-
Magento Kategorie Layout update
Statischen Block in eine Kategorie einfügen via Layout update. <reference name=“left“> <block type=“cms/block“ name=“left.permanent.callout“> <action method=“setBlockId“><block_id>->BLOCKID<-</block_id></action> </block> </reference>
-
Magento add & delete by id
hinzufügen mit checkout/cart/add/?product=ID&qty=MENGE <a href=“<?php echo $current_url ?>checkout/cart/add?product=<?php echo $_relatedIds[0];?>&qty=1″><span><span>Muster bestellen (<?php echo Mage::helper(‚core‘)->currency($relProduct->getFinalPrice()) ?> ‚)</span></span></a> entfernen mit <a href=“<?php echo $this->getUrl(‚checkout/cart/delete‘, array(‚id‘ => $_item->getId())); ?>“ title=“<?php echo $this->__(‚Remove item‘) ?>“><?php echo $this->__(‚Remove item‘) ?></a> laut Doku: add: Mage::getUrl( ‚checkout/cart/add‘, array( ‚id‘ => $item->getId() ) ); edit: Mage::getUrl( ‚checkout/cart/configure‘, array( ‚id‘ =>…
-
Magento Kategorie layout (list.phtml) überschreiben
Custom Layout Update <reference name=“product_list“> <action method=“setTemplate“> <template>catalog/product/ANDERES_TEMPLATE.phtml</template> </action> </reference>
-
Magento Baseprice für den Checkout
<?php $_product = Mage::getSingleton(‚catalog/product‘)->load($_item->getProductId()); $_productPrice = $this->helper(‚checkout‘)->getPriceInclTax($_item); $_productAmount = $_product->getResource()->getAttribute(‚base_price_amount‘)->getFrontend()->getValue($_product); $_productBaseAmount = $_product->getResource()->getAttribute(‚base_price_base_amount‘)->getFrontend()->getValue($_product); $_productBaseUnit = $_product->getResource()->getAttribute(‚base_price_base_unit‘)->getFrontend()->getValue($_product); $_productBaseprice = ($_productPrice/$_productAmount)*$_productBaseAmount; ?> <?php if ($_productBaseprice && $_productBaseprice > 0): ?> <span>Entspricht <?php echo number_format($_productBaseprice,2, ‚,‘, ‚.‘) ?> € pro <?php echo $_productBaseAmount; ?> <?php echo $this->__($_productBaseUnit); ?></span> <?php endif; ?>
-
Magento Ausgabe von Multiselect-Attribute mit Grafiken
im Aktuellen Projekt benötigte ich auf der Produkt Detailseite Icon mit Label von Produkt Eigenschaften in einen Mehrsprachigen Shop. Die übliche Herangehensweise id abfragen und Formatieren Kamm leider nicht in frage.
-
Magento: Fehler beim Index-Aufbau nach Import
nach einen Produkt Import mit cart2cart bekam ich folgende Meldung beim der Indexierung via SSH SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`catalog_category_product_index`, CONSTRAINT `FK_CATALOG_CATEGORY_PROD_IDX_CATEGORY_ENTITY` FOREIGN KEY (`category_id`) REFERENCES `catalog_category_entity` (`entity_id`)
-
Magento Nummerformate für Attribute
Ausgabe in der phtml number_format($_product->getData(‚uvp‘), 2)
-
Magento CMS Block in phtml Einbindung
Einbinden in Templatedateien: echo $this->getLayout()->createBlock(‚cms/block‘)->setBlockId(‚block_id‘)->toHTML(); oder ein Block in der entsprechenden Layout-datei <block type=“core/template“ name=“block_name“ template=“pfad_zum/template.phtml“ /> und der Aufruf in der phtml echo $this->getChildHtml(‚block_name‘);
-
Magento reviews in der view.phtml
catalog.xml <block type=“review/product_view_list“ name=“product.info.product_additional_data“ as=“reviews“ template=“review/product/view/list.phtml“> <block type=“review/form“ name=“product.review.form“ as=“review_form“/> // <- mit Review Form </block> .phtml <?php echo $this->getChildHtml(‚reviews‘) ?>
-
Magento multiple-select im Frontend ausgeben
id Ausgabe des multiple-select $_product->getData(‚color‘); // i.e. 456,499 instanz des Mage_Catalog_Model_Resource_Eav_Attribute: $_product->getResource()->getAttribute(‚color‘); // zeigt rot, grün ausgabe als array : $_product->getAttributeText(‚color‘) // Array([0]=>’rot‘, [1]=>’grün‘) Dies gibt den Text aus: if ($attr = $_product->getResource()->getAttribute(‚color‘)): echo $attr->getFrontend()->getValue($_product); // will display: red, green endif; Label und Id aller Optionen $attributeId = Mage::getResourceModel(‚eav/entity_attribute‘)->getIdByCode(‚catalog_product‘,’trainingsziel‘); $attribute = Mage::getModel(‚catalog/resource_eav_attribute‘)->load($attributeId); $attributeOptions = $attribute->getSource()->getAllOptions(); foreach($attributeOptions as $each){ echo $each[„label“].“ „.$each[„value“].“<br>“; }