public function getProduct() { if (Mage::registry('grouped-product-child-product')) { return Mage::registry('grouped-product-child-product'); } return parent::getProduct(); }
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(); }
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'); }
protected function _afterToHtml($html) { $html = parent::_afterToHtml($html); $html = $this->helper('amstockstatus')->processViewStockStatus($this->getProduct(), $html); return $html; }
/** * 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; }