Last active
August 29, 2015 14:08
-
-
Save dakira/135f0ca7c86e38a5cf18 to your computer and use it in GitHub Desktop.
Magento: Activate products in the future
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Follow these steps to create this functionality: | |
1. Create a custom date attribute, lets call it ‘activation_date’ | |
2. Create a cron job that should implement the following: | |
2.1 Retrieve all product ids that were not activated (E.G. status disabled) and their activation date | |
is lower than current date | |
2.2 Activate all these products by the product attribute mass-action model: | |
*/ | |
Mage::getSingleton('catalog/product_action') | |
->updateAttributes( | |
$retrievedProductIdsArray, | |
array('status' => Mage_Catalog_Model_Product_Status::STATUS_ENABLED), | |
Mage_Core_Model_App::ADMIN_STORE_ID | |
); | |
/* | |
3. Schedule the cron job in your module configuration file (config.xml) 4. Enjoy It! | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment