great stuff re: special price. however, it does not seem to work when there is a store-wide category price rule, and presume it does not work with caregory rules at all.
turbo1: have you considered submitting your script to be included as part of magento core?
streamlined and integrated into core, all credits to yours truly?
ditto with your other contributions..
much respect again for getting this commissioned. i’m finding i’m on the bleeding edge of required functionality in the sense that functionality in magento is being developed just as i require it!
I haven’t thought much about submitting it I didn’t author the script, so all credit should really go to Anda.
And yes, it probably does not work with special price rules or grouped products. It was written specifically for my (very basic) store. I have only simple products and no special pricing anywhere. But everyone is free to modify the script to be more robust!
I am not sure why, but I just realized that after I made that change, my prices became a mess, very strange.
It looks like special prices are fine.
the code now looks like this (I believe I made correct changes):
...
$product_data = array();
$product_data[’sku’]=$product->getSku();
$product_data[’title’]=$product->getName();
$product_data[’description’]=$product->getDescription();
$product_data[’link’]=$product->getProductUrl(); $product_data[’image_link’]=Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA).’catalog/product’.$product->getImage();
if($product->getSpecialPrice())
$product_data[’price’]=$product->getSpecialPrice();
else
$product_data[’price’]=$product->getPrice();
$product_data[’brand’]=$product->getResource()->getAttribute(’manufacturer’)->getFrontend()->getValue($product);
$product_data[’product_type’]=’’;
$product_data[’expiration_date’]=$expiration_date;
Thanks for any help.
P.S. I changed code back as it was before, and now prices are correct, but sure I miss a special prices.
I don’t know why function getSpecialPrice() doesn’t give correct result or something wrong with the code…
Yes, it looks pretty much same as mine, except I added couple more fields, but they are fine and not related to prices anyhow.
Now I added pull out special price as separate column in a file and got two columns: price and special. The thing is that function special gave me “special” even it is was not used. It gave me values which looks like prices, something like 6.99 or 19.99 for example. Looks like from not cleared memory or something, I do not know.
I do not know how function works, but you check that function as a Boolean, which is probably not right. :(
P.S. Some update:
I noticed that function getSpecial return the last special price for the product when it called like that. So, if all products have special prices, it will give you correct result. Otherwise it will return the last result which is more than zero.
I checked the file I got and what I noticed: (I added second column, special, just to check what function returns):
all product specials were zero until first product in a list which has special price. Then, function returned same special price as for first product for all next products until next product which has other special price. And so on. So, all products in between, got special prices of previous product… I do not know how function can be “reset ted” after every call.
I am trying to figure out how to draw out the catalog price rules prices from products. I am currently running a 10% store sale on and the lowered prices are not reflected in the Google Base module.
What is the method that will return the catalog price rules price?
That’s a tricky one. I don’t use any catalog price rules, but I will make some on my test store and see if I can figure it out. I have one theory but no guarantees if it’s going to work.
exists or not. If it does, that means it has a special price, and it uses the special. if it doesn’t, it uses the regular price. Isn’t this the functionality you want?…
Sure, this is functionality I want.
The thing is: your code is good, function getSpecialPrice() itself is not really. But I guess in the next version of Magento it will be corrected.
I posted about it here:
getSpecialPrice() Issue
The Magento team member in the issue tracker did address the issue properly. As soon as you move that line inside the loop, it works using my original code modification.
John,
sorry, I’m not following.
What I was saying is that function itself was not given correct value, it has nothing to do with your code. Your code was and is correct, as I know (I’m not a php programmer, though).
I can not see a difference between code you just posted and code before.
Thanks.