public function getProduct()
 {
     if (Mage::registry('grouped-product-child-product')) {
         return Mage::registry('grouped-product-child-product');
     }
     return parent::getProduct();
 }
예제 #2
0
 public function _construct()
 {
     $this->addRenderer('select', 'bundle/catalog_product_view_type_bundle_option_select');
     $this->addRenderer('multi', 'bundle/catalog_product_view_type_bundle_option_multi');
     $this->addRenderer('radio', 'bundle/catalog_product_view_type_bundle_option_radio');
     $this->addRenderer('checkbox', 'bundle/catalog_product_view_type_bundle_option_checkbox');
     return parent::_construct();
 }
예제 #3
0
파일: Bundle.php 프로젝트: booklein/bookle
 protected function _construct()
 {
     parent::_construct();
     if (isset($attributes['template']) && $attributes['template']) {
         $this->setTemplate($attributes['template']);
     } elseif ($this->hasData("template")) {
         $this->setTemplate($this->getData('template'));
     } else {
         $template = 'venustheme/tempcp/cartedit/checkout/cart/item/edit/bundle.phtml';
         $this->setTemplate($template);
     }
     $this->addRenderer('select', 'bundle/catalog_product_view_type_bundle_option_select');
     $this->addRenderer('multi', 'bundle/catalog_product_view_type_bundle_option_multi');
     $this->addRenderer('radio', 'bundle/catalog_product_view_type_bundle_option_radio');
     $this->addRenderer('checkbox', 'bundle/catalog_product_view_type_bundle_option_checkbox');
 }
예제 #4
0
 protected function _afterToHtml($html)
 {
     $html = parent::_afterToHtml($html);
     $html = $this->helper('amstockstatus')->processViewStockStatus($this->getProduct(), $html);
     return $html;
 }
예제 #5
0
 /**
  * Retrieve all products associated with a bundled product
  *
  * @return array
  */
 public function getChildrenFromBundleProduct()
 {
     // result
     $result = array();
     // get loaded product
     $product = $this->getProduct();
     $optionIds = array();
     if ($product->getId()) {
         // retrieve associated products
         if (version_compare(Mage::getVersion(), '1.3.0.0', '>=')) {
             $optionIds = Mage::getModel('bundle/product_type')->getOptionsIds($product);
         } else {
             // load a new bundle block
             $bundleBlock = new Mage_Bundle_Block_Catalog_Product_View_Type_Bundle();
             // load product into bundle block
             $bundleBlock->setProduct($product);
             // retrieve all bundle children
             $optionGroups = Mage::helper('core')->decorateArray($bundleBlock->getOptions());
             $optionIds = array();
             foreach ($optionGroups as $optionGroup) {
                 $optionIds[] = $optionGroup->getId();
             }
             // save memory
             unset($bundleBlock);
         }
     }
     // get all bundle options (ie. simple products)
     $options = Mage::getModel('bundle/selection')->getCollection()->setOptionIdsFilter($optionIds)->setPositionOrder();
     // process each simple product and add to result array
     foreach ($options as $option) {
         if (!isset($result[$option->getOptionId()])) {
             $result[$option->getOptionId()] = array();
         }
         $result[$option->getOptionId()][] = array('product_id' => $option->getProductId(), 'selection_id' => $option->getSelectionId());
     }
     return $result;
 }