Magento Entwicklung: Unterschied zwischen den Versionen
Aus Vosp.info
F (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „= Entwicklung = * [https://inchoo.net/ecommerce/magento/how-to-create-a-new-product-type-in-magento/ how-to-create-a-new-product-type-in-magento] * [http://www.ma…“) |
F (Diskussion | Beiträge) |
||
Zeile 70: | Zeile 70: | ||
---- | ---- | ||
+ | == Frontend Beispiele == | ||
+ | === Unterkategorien einer Kategorie inklusive Bilder und Beschreibung anzeigen === | ||
+ | |||
+ | app/design/frontend/<<OWNDESIGN>>/default/template/catalog/navigation/subcategory_listing_full.phtml | ||
+ | <source lang="php"> | ||
+ | <div id="categories" class="listing"> | ||
+ | <?php $_maincategorylisting=$this->getCurrentCategory()?> | ||
+ | <?php $_categories=$this->getCurrentChildCategories()?> | ||
+ | <?php $_helper = $this->helper('catalog/output'); ?> | ||
+ | <?php if(count($_categories)):?> | ||
+ | <?php foreach ($_categories as $_category):?> | ||
+ | <?php if($_category->getIsActive()): ?> | ||
+ | <?php | ||
+ | $cur_category=Mage::getModel('catalog/category')->load($_category->getId()); | ||
+ | $layer = Mage::getSingleton('catalog/layer'); | ||
+ | $layer->setCurrentCategory($cur_category); | ||
+ | $catName = $this->getCurrentCategory()->getName(); | ||
+ | ?> | ||
+ | <?php if($_imageUrl=$this->getCurrentCategory()->getImageUrl()):?> | ||
+ | <div class="category-image"><a href="<?php echo $this->getCategoryUrl($_category)?>"><img src="<?php echo $_imageUrl?>" height="188"></a></div> | ||
+ | <div class="category-name"><a href="<?php echo $this->getCategoryUrl($_category)?>"> <?php echo $_category->getName()?></a></div> | ||
+ | <?php endif;?> | ||
+ | <?php if($_description=$this->getCurrentCategory()->getDescription()): ?> | ||
+ | <div class="category-description"><?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?></div> | ||
+ | <?php endif; ?> | ||
+ | <?php endif; ?> | ||
+ | <?php endforeach?> | ||
+ | <?php $layer->setCurrentCategory($_maincategorylisting); ?> | ||
+ | <?php endif;?> | ||
+ | </div> | ||
+ | |||
+ | </source> | ||
== Blog-Hints aktivieren == | == Blog-Hints aktivieren == | ||
Version vom 5. März 2014, 01:14 Uhr
Inhaltsverzeichnis
Entwicklung
- how-to-create-a-new-product-type-in-magento
- How To Create a Featured Product
- Jquery in Magento einbinden
globale Funktionsaufrufe
dieses sind allgemeine Funktionsaufrufe, die nahe zu überall (oder Kontex bezogen) aufgerufen werden können
/**
* hole _POST und _GET Variablen
*/
$post_get_array = Mage::app()->getRequest();
/**
* hole aktuelle Session
*/
$session = Mage::getSingleton('checkout/session');
Model
/**
* product laden
*/
$product = Mage::getModel("catalog/product");
$product = $product->load($param_id)->getData();
// zeige max() eines query
$quote = Mage::getSingleton('checkout/session')->getQuote();
$collection = Mage::getModel('sales/quote_item')->getCollection();
$string_sql = $collection->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns('max(item_id) as last_item_id')
->where("quote_id = ".$quote->getId());
$lastItemId = $collection->getData();
D::s($collection->getData(), '$maxItemId: '.$lastItemId[0]['last_item_id']);
Frontend: Warenkorb
/**
* hole aktuellen Quote (Angebot)
*/
$quote = Mage::getSingleton('checkout/session')->getQuote();
/**
* wenn mensch ein Posten im Warenkorb bearbeitet, kann sich über die Url=/checkout/cart/configure/id/751/ (_GET) die aktuelle Item ID geholt werden
*/
$getParamId = Mage::app()->getRequest()->getParam('id')
Block .... schnipsel
{{block type=”catalog/product_list” category_id=”[Ihre Kategorie ID]” template=”catalog/product/list.phtml”}}
Frontend Beispiele
Unterkategorien einer Kategorie inklusive Bilder und Beschreibung anzeigen
app/design/frontend/<<OWNDESIGN>>/default/template/catalog/navigation/subcategory_listing_full.phtml
<div id="categories" class="listing">
<?php $_maincategorylisting=$this->getCurrentCategory()?>
<?php $_categories=$this->getCurrentChildCategories()?>
<?php $_helper = $this->helper('catalog/output'); ?>
<?php if(count($_categories)):?>
<?php foreach ($_categories as $_category):?>
<?php if($_category->getIsActive()): ?>
<?php
$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
$catName = $this->getCurrentCategory()->getName();
?>
<?php if($_imageUrl=$this->getCurrentCategory()->getImageUrl()):?>
<div class="category-image"><a href="<?php echo $this->getCategoryUrl($_category)?>"><img src="<?php echo $_imageUrl?>" height="188"></a></div>
<div class="category-name"><a href="<?php echo $this->getCategoryUrl($_category)?>"> <?php echo $_category->getName()?></a></div>
<?php endif;?>
<?php if($_description=$this->getCurrentCategory()->getDescription()): ?>
<div class="category-description"><?php echo $_helper->categoryAttribute($_category, $_description, 'description') ?></div>
<?php endif; ?>
<?php endif; ?>
<?php endforeach?>
<?php $layer->setCurrentCategory($_maincategorylisting); ?>
<?php endif;?>
</div>
Blog-Hints aktivieren
Admin > System > Konfiguration > Entwickleroptionen > obenlinks "Aktueller Konfig.-Bereich" > Main Website
- Debug
- Vorlagen Pfadhinweise: Ja
- Blocknamen zu Hinweisen hinzufügen: Ja
Magento-Themes einfacher erstellen und modifizieren
cd Magento18/
cp -r app/design/frontend/base/default app/design/frontend/default/my_theme
cd app/design/frontend/default/my_theme
find -type f -exec rename -n 's/$/-disabled/' '{}' ';' # simulation
find -type f -exec rename 's/$/-disabled/' '{}' ';'
cd ../../../../../../Magento18/
cp -r skin/frontend/base/default/ skin/frontend/default/my_theme/
cd skin/frontend/default/my_theme/
find -type f -exec rename -n 's/$/-disabled/' '{}' ';' # simulation
find -type f -exec rename 's/$/-disabled/' '{}' ';'
cp app/design/frontend/default/my_theme/template/catalog/product/view.phtml-disabled app/design/frontend/default/my_theme/template/catalog/product/view.phtml