setProduct($product) Calling the Super Product Attributes
I am using the Simple Configurable Products extension by OrganicInternet.
I have a number of Tabs in every product with related information.
I am editing OrganicInternet/SimpleConfigurableProducts/Catalog/Block/Product/View/Type/Configurable.php
The logic is as follows -- (this builds the JSON with the simple products data):
class OrganicInternet_SimpleConfigurableProducts_Catalog_Block_Product_View_Type_Configurable
extends Mage_Catalog_Block_Product_View_Type_Configurable
{
public function getJsonConfig()
{
$config = Zend_Json::decode(parent::getJsonConfig());
$childProducts = array();
....
foreach ($this->getAllowProducts() as $product) {
.....
if (Mage::getStoreConfig('SCP_options/product_page/change_attributes')) {
$childBlock = $this->getLayout()->createBlock('catalog/product_view_colors');
$childProducts[$productId]["colors"] = $childBlock->setTemplate('catalog/product/view/colors.phtml')->setProduct($product)->toHtml();
开发者_运维问答 }
......
}
The block is rendering properly, but for some reason it is not using the correct Product. I suspect the setProduct($product)
method is not working. (It is using the "super" product), but when I do a print_r(get_class_methods($product)), it shows the correct simple product.
Any ideas?
精彩评论