0

I want To set auto pricing configurable(Parent) Products At backend Parent Price should be come lowest price from simple(child)Products. except $0 price product.
Thanks

1 Answer 1

1

Use this to show the lowest price simple price on the front end:

https://github.com/organicinternet/magento-configurable-simple

You can then run a script to update configurable prices from lowest price simple with this:

<?php
require '/fullpath/httpdocs/app/Mage.php';
Mage::app();
$collectionConfigurable = Mage::getResourceModel('catalog/product_collection')->addAttributeToFilter('type_id', array('eq' => 'configurable'));
foreach ($collectionConfigurable as $_configurableproduct) {    
$product = Mage::getModel('catalog/product')->load($_configurableproduct->getId());
$original_price = $product->getData('price');
$new_price = $product->getPrice();
if ($original_price != $new_price){
$product->setPrice($new_price);
$product->save();
echo "\n\n" . $product->getName() . ' updated price from: ' . $original_price . ' to: ' . $new_price;
}
}
?>

Done.

9
  • @Mike Tim Turner Thanks for reply How can I run This script I am new in magento Thanks Mar 7, 2017 at 14:46
  • Create a Cron to run this script. this will be done on your server outside of Magento. Or you can put the file path in your browser to run if you have the correct permissions Mar 7, 2017 at 14:50
  • Yes i have permission I am running via Browser But I am Gtting Error This Fatal error: Call to a member function getResourceModelInstance() on a non-object in C:\xampp\htdocs\magento-1.9.2.4\app\Mage.php on line 491 Mar 7, 2017 at 14:55
  • First I create file At Root Folder OF FTP by name price_update And And Include include_once 'app/Mage.php'; And Past Your Script Mar 7, 2017 at 14:57
  • I've updated it. Try now Mar 7, 2017 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.