Reputation: 7995
I am adding a simple Product in magento, in which I want to set the following, along with others:-
The problem seems to be the #2 & #3 points. I have been successful in setting the #1 point, but I need help in solving the issues with the last 2 points.
I have tried using the following two methods for #2 point:-
But neither of the above 2 methods had worked.
Same case goes for the #3 point.
Please if anybody can help, it is really appreciated.
Upvotes: 3
Views: 5309
Reputation: 13733
Non-programmatically, you should be able to achieve this using the Prices tab under the Product Information. I assume, though, that you needed to do this as part of a script. Either way, thanks for sharing that, I need to know more objects :)
Upvotes: 0
Reputation: 7995
At last after a day's wastage, I finally made it. Use the code below to make it work:-
<?php
// Both the Start & End Dates must be in MySQL DB Format
$startDate = '2010-06-30';
$endDate = '2010-09-30';
// Creates the Product object, whose Special Dates are going to be changed
$product = new Mage_Catalog_Model_Product();
$product->load(YOUR_REQUIRED_PRODUCT_ID);
// Sets the Start Date
$product->setSpecialFromDate($startDate);
$product->setSpecialFromDateIsFormated(true);
// Sets the End Date
$product->setSpecialToDate($endDate);
$product->setSpecialToDateIsFormated(true);
?>
This code just worked like a charm. Hope this helps.
Upvotes: 4