Frage

Ich versuche, Cross-Selling-Produkte zu sehen.phtml.Ist es möglich?

Ich habe hinzugefügt

<?php echo $this->getChildHtml('crosssell') ?> 

in Blick.phtml und

<block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>

in Katalog.XML aber ich sehe kein Ergebnis auf der Produktseite.

Cross-Selling-Produkte werden nur auf der Warenkorbseite korrekt angezeigt.

BEARBEITEN:Wenn ich ein Produkt mit Cross-Selling-Produkt in den Warenkorb lege, sehe ich es auf ALLEN Produktseiten.

War es hilfreich?

Lösung

Probieren Sie dieses Modul aus:

Datei : app\etc\modules\Rkt_CrossSell.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Rkt_CrossSell>
            <active>true</active>
            <codePool>community</codePool>
            <depends>
                <Mage_Catalog />
            </depends>
        </Rkt_CrossSell>
    </modules>
</config>

Datei : app\code\community\Rkt\CrossSell\etc\config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Rkt_CrossSell>
          <version>1.0.0</version>
        </Rkt_CrossSell>
    </modules>
    <global>
        <helpers>
            <rkt_crossell>
                <class>Rkt_CrossSell_Helper</class>
            </rkt_crossell>
        </helpers>
        <blocks>
            <rkt_crossell>
                <class>Rkt_CrossSell_Block</class>
            </rkt_crossell>
        </blocks>
    </global>
    <frontend>
        <layout>
            <updates>
                <rkt_crossell>
                    <file>rkt_crossell.xml</file>
                </rkt_crossell>
            </updates>
        </layout>
    </frontend>
</config>

Datei : app\code\community\Rkt\CrossSell\Block\Catalog\Product\View\Crosssell.php

<?php
class Rkt_CrossSell_Block_Catalog_Product_View_Crosssell extends Mage_Checkout_Block_Cart_Crosssell
{

    /**
     * Get crosssell items
     *
     * @return array
     */
    public function getItems()
    {
        $items = $this->getData('items');
        if (is_null($items)) {
            $items = $this->getProduct()->getCrossSellProducts();
            $this->setData('items', $items);
        }
        return $items;
    }
}

Datei : app\code\community\Rkt\CrossSell\Helper\Data.php

<?php
class Rkt_CrossSell_Helper_Data extends Mage_Core_Helper_Abstract
{

}

Datei : app\design\frontend\base\default\layout\rkt_crossell.xml

<?xml version="1.0"?>
<layout>
    <catalog_product_view>
        <reference name="product.info">
            <block type="rkt_crossell/catalog_product_view_crosssell" name="product.view.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml" />
        </reference>
    </catalog_product_view>
</layout>

Jetzt in deinem view.phtml fügen Sie diesen Code an der entsprechenden Stelle hinzu

<?php echo $this->getChildHtml('crosssell') ?> 

Leeren Sie jetzt Ihren Cache.Überprüfen Sie, ob alle Dateinamen und Dateipfade korrekt sind.Dann sind Sie gut zu gehen.

Andere Tipps

Versuchen Sie es.

Sie möchten keine Kreuzverkaufsblock in der Layoutdatei anrufen.Setzen Sie stattdessen den untenstehenden Code in View.phtml-Datei.

generasacodicetagpre.

Referenz: http:// www.magentoworks.net / Magento-Display-Cross-Selling-Produkte-on-product-detail-seite /

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top