1

I am working on product collection. Here is my query:

$_product = Mage::getModel('catalog/product')->addWebsiteFilter($allWebsiteIds)->load($productid);

But this is not working.

As reference check this link. I want to load detail in this line

$product = Mage::getModel('catalog/product')->load(YOUR_PRODUCT_ID);

but with "addWebsiteFilter" also.Any one know how i can achieve this.

4

There is no method addWebsiteFilter for the product model.
The method is available for the product collection.

If you want to use load you have to do the check for website later.

$product = Mage::getModel('catalog/product')->load($productId);
$productWebsites = $product->getWebsiteIds();

Then you have to check if your websites are in the $productWebsites. do an array_intersect or something you need.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.