zoukankan      html  css  js  c++  java
  • Get Realted, Upsell, Cross sell Product collection in magento

     
     
    Get Related Product Collection



    $related_product_collection = $_product->getRelatedProductCollection();
    $related_product_collection->AddStoreFilter();
    foreach($related_product_collection as $pdt)
    {
        $pdt_id=$pdt->getId();
        $model_rel = Mage::getModel('catalog/product'); //getting product model
        $_product_rel = $model_rel->load($pdt_id); //getting product object for particular product id
        $rel_name= $_product_rel->getName();
        $rel_price= number_format($_product_rel->getPrice(),2);
        $rel_img_url = $this->helper('catalog/image')->init($_product_rel, 'image')->keepFrame(false)->resize(156,107);   //Image resize code
    ?>



    Get Upsell Product Collection



    <?php
    $upsell_product_collection = $_product->getUpSellProductCollection();
    $upsell_product_collection->AddStoreFilter();
    foreach($upsell_product_collection as $pdt)
    {
        $pdt_id=$pdt->getId();
        $model_upsell = Mage::getModel('catalog/product');
        $_product_upsell = $model_upsell->load($pdt_id);
        $upsell_name= $_product_upsell->getName();
        $upsell_price= number_format($_product_upsell->getPrice(),2);
        $upsell_img_url = $this->helper('catalog/image')->init($_product_upsell, 'image')->keepFrame(false)->resize(100,100);
    ?>



    Get Cross Sell Product Collection



    <?php
    $crossselll_product_collection = $_product->getCrossSellProducts(); $crossselll_product_collection>AddStoreFilter();
    foreach($crossselll_product_collection as $pdt)
    {
        $pdt_id=$pdt->getId();
        $model_crosssell = Mage::getModel('catalog/product');
        $_product_crosssell = $model_crosssell>load($pdt_id);
        $crosssell_name= $_product_crosssell->getName();
        $crosssell_price= number_format($_product_crosssell->getPrice(),2);
        $crosssell_img_url = $this->helper('catalog/image')->init($_product_crosssell, 'image')->keepFrame(false)->resize(100,100);

    ?>

  • 相关阅读:
    【ThreadX】Azure RTOS ThreadX概述
    -- spi flash 擦除接口调用HAL库不同函数的区别
    STM32 芯片锁死解决方法
    【KEIL】User's Guide
    【KEIL】Software Packs
    【KEIL 】Options for File
    使用CubeMX创建TouchGFX工程时LCD死活不显示
    【转】获取本地图片的URL
    printf 函数格式控制
    【集成】touchgfx 之 《Using C code with TouchGFX》
  • 原文地址:https://www.cnblogs.com/dongtong/p/6182562.html
Copyright © 2011-2022 走看看