Set up special prices for products in Magento

I am adding a simple Product to magento in which I want to install the following, as well as others: -

  • Special price
  • Special Price From Date
  • Special Price Today

The problem seems to be # 2 and # 3. I managed to establish No. 1, but I need help in solving problems with the last 2 points.

I tried using the following two methods for point # 2: -

  • SetData ()
  • setSpecialFromDate ()

But none of the above methods worked.
The same case is suitable for point number 3.

Please, if anyone can help, this is really appreciated.

+3
source share
2 answers

, , , , , . , : -

<?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);
?>

. , .

+3

, , "" " ". , script. , , :)

0

Source: https://habr.com/ru/post/1752247/


All Articles