0

I have custom price attribute called wholesale_price.

The wholesale_price is only needed for one of the store view. So i choose specific store view, then update the wholesale_price.

The problem is:
    I can get the wholesale_price variable through $_product->getWholesalePrice() in product view page but not in product listing page.
In product listing page, the $_product->getWholesalePrice() is empty.

Eventually, after i tried to save it from default store view. The wholesale_price is available in the product listing page.

So everytime i need to update the price, i need to go by saving from default store, and it is annoying.

Could you please tell me what is the code difference between saving from default store view and the others store view?

Thank you!

  • what is scope of your attribute ? and it should be Used in Product Listing selected as "Yes" – Minesh Patel Mar 2 '16 at 3:59
  • I cannot set price scope, and i have set the Product Listing to 'Yes' – AlbertSamuel Mar 2 '16 at 4:29
  • i am asking for your custom attribute scope read here and here – Minesh Patel Mar 2 '16 at 4:39
  • My bad for not writing it clearly. When you set the attribute type to Price then the scope attributes is hidden. I am running magento 1.9 – AlbertSamuel Mar 2 '16 at 5:52
  • have you tried indexing ? – Minesh Patel Mar 2 '16 at 6:14
0

The solution I get is using the saveAfter event and explicitly set default store WholesalePrice to be updated.

Mage::getSingleton('catalog/product_action')->updateAttributes(array($product->getId()), $attributes , 0);

Thank you guys for your help.

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.