My script currently works for all stores except the store it's pulling from. I want to pull all reviews from my default store / main store and only push the reviews to my new store with a websiteId = 13 and storeId = 13

Here's my code below:

require_once 'abstract.php';
class Mage_Shell_Review extends Mage_Shell_Abstract

    public function run()
        $ids    = Mage::getModel('review/review')->getCollection()->getAllIds();
        $stores = Mage::getModel('core/store')

        $adapter = Mage::getSingleton('core/resource')->getConnection('core_write');

        $table = 'review_store';
        try {
            foreach ($ids as $id) {
                foreach ($stores as $storeId) {
            $query="INSERT INTO $table (`review_id`,`store_id`) VALUES $values;";
            echo "OK\n";
        } catch (Exception $e) {

$shell = new Mage_Shell_Review();

I haven't tested it yet because i don't want to effect all stores... i only need the reviews from default to populate the new store with the id of 13.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.