How to add product reviews progmatically to add data on custom fieldHow to add product reviews...

Use comma instead of & in table

How to count words in a line

Magento 2: Override XML file from vendor folder to app folder doesn't work/update

What are these green text/line displays shown during the livestream of Crew Dragon's approach to dock with the ISS?

How would we write a misogynistic character without offending people?

Why is working on the same position for more than 15 years not a red flag?

Replacement ford fiesta radiator has extra hose

Pure Functions: Does "No Side Effects" Imply "Always Same Output, Given Same Input"?

How to kill a localhost:8080

Are small insurances worth it

How can I handle a player who pre-plans arguments about my rulings on RAW?

Is there a ternary operator in math

Should I choose Itemized or Standard deduction?

I can't die. Who am I?

Why does Starman/Roadster have radial acceleration?

Avoiding unpacking an array when altering its dimension

CBP Reminds Travelers to Allow 72 Hours for ESTA. Why?

Linear regression when Y is bounded and discrete

How would one optimize conventional modern weapons for fighting robots

How do I construct an nxn matrix?

What if I store 10TB on azure servers and then keep the vm powered off?

You'll find me clean when something is full

What to do when being responsible for data protection in your lab, yet advice is ignored?

Series pass transistor, LM7812



How to add product reviews progmatically to add data on custom field


How to add product reviews progmaticallyCreate categories through installerCall custom attribute of child within configurable productUpdate product custom option price on product price changeHow to add a custom page with cross-sell productsCustom Attribues in Frontend showing for wrong productHow to add a dropdown in Adminhtml Form Block, selecting data from a table referenced by foreign key?Changing Status of Review creates duplicate in “review_detail” tableMagento not saving custom product attributes after version upgradeMagento 2.2.5: Add, Update and Delete existing products Custom Options













1















    $review = Mage::getModel('review/review')
->setEntityPkValue(intval($pressquote->product_id)) //product id
->setStatusId(intval($pressquote->status))
->setDetail($pressquote->text)
->setTitle('')
->setEntityId(1)
->setStatusId(intval($pressquote->status)) //approved
->setCustomerId(null) //null is for administrator
->setNickname($pressquote->source)
->setLink($pressquote->link) //custom field
->setLinktext($pressquote->linktext) //custom field
->setYear($pressquote->year) //custom field
->setStoreId(1)
->setStores(array('base'))
->save();


I am not be able to save data on custom field above commented for custom field.










share|improve this question
















bumped to the homepage by Community 5 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • have you added custom fileds in database table "review" or any other table?

    – Abdul
    Dec 4 '15 at 11:11











  • if you are added in "review" table then but first clear cash and indexing in admin side after try again

    – Abdul
    Dec 4 '15 at 11:13











  • I have cleared cash but did not get save even I update just after inserting but did not get desire result.

    – Manish
    Dec 4 '15 at 11:27











  • Which file or location added above code?

    – Abdul
    Dec 4 '15 at 11:28











  • I have created a module and on crontroller xxxAction(), I am performing this task

    – Manish
    Dec 4 '15 at 11:30


















1















    $review = Mage::getModel('review/review')
->setEntityPkValue(intval($pressquote->product_id)) //product id
->setStatusId(intval($pressquote->status))
->setDetail($pressquote->text)
->setTitle('')
->setEntityId(1)
->setStatusId(intval($pressquote->status)) //approved
->setCustomerId(null) //null is for administrator
->setNickname($pressquote->source)
->setLink($pressquote->link) //custom field
->setLinktext($pressquote->linktext) //custom field
->setYear($pressquote->year) //custom field
->setStoreId(1)
->setStores(array('base'))
->save();


I am not be able to save data on custom field above commented for custom field.










share|improve this question
















bumped to the homepage by Community 5 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
















  • have you added custom fileds in database table "review" or any other table?

    – Abdul
    Dec 4 '15 at 11:11











  • if you are added in "review" table then but first clear cash and indexing in admin side after try again

    – Abdul
    Dec 4 '15 at 11:13











  • I have cleared cash but did not get save even I update just after inserting but did not get desire result.

    – Manish
    Dec 4 '15 at 11:27











  • Which file or location added above code?

    – Abdul
    Dec 4 '15 at 11:28











  • I have created a module and on crontroller xxxAction(), I am performing this task

    – Manish
    Dec 4 '15 at 11:30
















1












1








1








    $review = Mage::getModel('review/review')
->setEntityPkValue(intval($pressquote->product_id)) //product id
->setStatusId(intval($pressquote->status))
->setDetail($pressquote->text)
->setTitle('')
->setEntityId(1)
->setStatusId(intval($pressquote->status)) //approved
->setCustomerId(null) //null is for administrator
->setNickname($pressquote->source)
->setLink($pressquote->link) //custom field
->setLinktext($pressquote->linktext) //custom field
->setYear($pressquote->year) //custom field
->setStoreId(1)
->setStores(array('base'))
->save();


I am not be able to save data on custom field above commented for custom field.










share|improve this question
















    $review = Mage::getModel('review/review')
->setEntityPkValue(intval($pressquote->product_id)) //product id
->setStatusId(intval($pressquote->status))
->setDetail($pressquote->text)
->setTitle('')
->setEntityId(1)
->setStatusId(intval($pressquote->status)) //approved
->setCustomerId(null) //null is for administrator
->setNickname($pressquote->source)
->setLink($pressquote->link) //custom field
->setLinktext($pressquote->linktext) //custom field
->setYear($pressquote->year) //custom field
->setStoreId(1)
->setStores(array('base'))
->save();


I am not be able to save data on custom field above commented for custom field.







magento-1.9 import review programmatically






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 4 '15 at 11:06









Qaisar Satti

26.8k1255107




26.8k1255107










asked Dec 4 '15 at 11:05









ManishManish

1,99431840




1,99431840





bumped to the homepage by Community 5 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 5 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.















  • have you added custom fileds in database table "review" or any other table?

    – Abdul
    Dec 4 '15 at 11:11











  • if you are added in "review" table then but first clear cash and indexing in admin side after try again

    – Abdul
    Dec 4 '15 at 11:13











  • I have cleared cash but did not get save even I update just after inserting but did not get desire result.

    – Manish
    Dec 4 '15 at 11:27











  • Which file or location added above code?

    – Abdul
    Dec 4 '15 at 11:28











  • I have created a module and on crontroller xxxAction(), I am performing this task

    – Manish
    Dec 4 '15 at 11:30





















  • have you added custom fileds in database table "review" or any other table?

    – Abdul
    Dec 4 '15 at 11:11











  • if you are added in "review" table then but first clear cash and indexing in admin side after try again

    – Abdul
    Dec 4 '15 at 11:13











  • I have cleared cash but did not get save even I update just after inserting but did not get desire result.

    – Manish
    Dec 4 '15 at 11:27











  • Which file or location added above code?

    – Abdul
    Dec 4 '15 at 11:28











  • I have created a module and on crontroller xxxAction(), I am performing this task

    – Manish
    Dec 4 '15 at 11:30



















have you added custom fileds in database table "review" or any other table?

– Abdul
Dec 4 '15 at 11:11





have you added custom fileds in database table "review" or any other table?

– Abdul
Dec 4 '15 at 11:11













if you are added in "review" table then but first clear cash and indexing in admin side after try again

– Abdul
Dec 4 '15 at 11:13





if you are added in "review" table then but first clear cash and indexing in admin side after try again

– Abdul
Dec 4 '15 at 11:13













I have cleared cash but did not get save even I update just after inserting but did not get desire result.

– Manish
Dec 4 '15 at 11:27





I have cleared cash but did not get save even I update just after inserting but did not get desire result.

– Manish
Dec 4 '15 at 11:27













Which file or location added above code?

– Abdul
Dec 4 '15 at 11:28





Which file or location added above code?

– Abdul
Dec 4 '15 at 11:28













I have created a module and on crontroller xxxAction(), I am performing this task

– Manish
Dec 4 '15 at 11:30







I have created a module and on crontroller xxxAction(), I am performing this task

– Manish
Dec 4 '15 at 11:30












1 Answer
1






active

oldest

votes


















0














Based on comments, you want to import customers reviews from csv, so you can use this: https://www.magentocommerce.com/magento-connect/product-review-import-export.html



This extension is not ready to multistore but works fine. You can edit Adapter (MK_Reviewexport_Model_Convert_Adapter_Reviewimport) and add your custom field.



class MK_Reviewexport_Model_Convert_Adapter_Reviewimport extends Mage_Catalog_Model_Convert_Adapter_Product
{
public function saveRow(array $data)
{
$write = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
$sku = $write->query ( 'select entity_id from `catalog_product_entity` where sku = "' . $data ['Sku'] . '" ' );
$sku = $sku->fetch ();

if ($sku) {
$product_id = $sku ['entity_id'];
if ($data ['customer_id'] == '') {
$customerid = NULL;
} else {
$customerid = $data ['customer_id'];
}
$_review = Mage::getModel ( 'review/review' )
->setCreatedAt ( $data ['created_at'] )
->setEntityPkValue ( $product_id )->setEntityId ( 1 )
->setStatusId ( $data ['status_id'] )
->setTitle ( $data ['title'] )->setDetail ( $data ['detail'] )
->setStoreId ( 1 )
->setStores ( 1 )
->setCustomerId ( $customerid )
// set your custom field here.
->setNickname ( $data ['nickname'] )->save ();

if ($data ['option_id']) {
$arr_data = explode ( "@", $data ['option_id'] );

if (! empty ( $arr_data )) {

foreach ( $arr_data as $each_data ) {

$arr_rating = explode ( ":", $each_data );

if ($arr_rating [1] != 0) {

Mage::getModel ( 'rating/rating' )
->setRatingId ( $arr_rating [0] )
->setReviewId ( $_review->getId () )
->setCustomerId ( $customerid )
->addOptionVote ( $arr_rating [1], $product_id );
}
}
}
$_review->aggregate ();
}
}
}
}





share|improve this answer























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f92648%2fhow-to-add-product-reviews-progmatically-to-add-data-on-custom-field%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Based on comments, you want to import customers reviews from csv, so you can use this: https://www.magentocommerce.com/magento-connect/product-review-import-export.html



    This extension is not ready to multistore but works fine. You can edit Adapter (MK_Reviewexport_Model_Convert_Adapter_Reviewimport) and add your custom field.



    class MK_Reviewexport_Model_Convert_Adapter_Reviewimport extends Mage_Catalog_Model_Convert_Adapter_Product
    {
    public function saveRow(array $data)
    {
    $write = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
    $sku = $write->query ( 'select entity_id from `catalog_product_entity` where sku = "' . $data ['Sku'] . '" ' );
    $sku = $sku->fetch ();

    if ($sku) {
    $product_id = $sku ['entity_id'];
    if ($data ['customer_id'] == '') {
    $customerid = NULL;
    } else {
    $customerid = $data ['customer_id'];
    }
    $_review = Mage::getModel ( 'review/review' )
    ->setCreatedAt ( $data ['created_at'] )
    ->setEntityPkValue ( $product_id )->setEntityId ( 1 )
    ->setStatusId ( $data ['status_id'] )
    ->setTitle ( $data ['title'] )->setDetail ( $data ['detail'] )
    ->setStoreId ( 1 )
    ->setStores ( 1 )
    ->setCustomerId ( $customerid )
    // set your custom field here.
    ->setNickname ( $data ['nickname'] )->save ();

    if ($data ['option_id']) {
    $arr_data = explode ( "@", $data ['option_id'] );

    if (! empty ( $arr_data )) {

    foreach ( $arr_data as $each_data ) {

    $arr_rating = explode ( ":", $each_data );

    if ($arr_rating [1] != 0) {

    Mage::getModel ( 'rating/rating' )
    ->setRatingId ( $arr_rating [0] )
    ->setReviewId ( $_review->getId () )
    ->setCustomerId ( $customerid )
    ->addOptionVote ( $arr_rating [1], $product_id );
    }
    }
    }
    $_review->aggregate ();
    }
    }
    }
    }





    share|improve this answer




























      0














      Based on comments, you want to import customers reviews from csv, so you can use this: https://www.magentocommerce.com/magento-connect/product-review-import-export.html



      This extension is not ready to multistore but works fine. You can edit Adapter (MK_Reviewexport_Model_Convert_Adapter_Reviewimport) and add your custom field.



      class MK_Reviewexport_Model_Convert_Adapter_Reviewimport extends Mage_Catalog_Model_Convert_Adapter_Product
      {
      public function saveRow(array $data)
      {
      $write = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
      $sku = $write->query ( 'select entity_id from `catalog_product_entity` where sku = "' . $data ['Sku'] . '" ' );
      $sku = $sku->fetch ();

      if ($sku) {
      $product_id = $sku ['entity_id'];
      if ($data ['customer_id'] == '') {
      $customerid = NULL;
      } else {
      $customerid = $data ['customer_id'];
      }
      $_review = Mage::getModel ( 'review/review' )
      ->setCreatedAt ( $data ['created_at'] )
      ->setEntityPkValue ( $product_id )->setEntityId ( 1 )
      ->setStatusId ( $data ['status_id'] )
      ->setTitle ( $data ['title'] )->setDetail ( $data ['detail'] )
      ->setStoreId ( 1 )
      ->setStores ( 1 )
      ->setCustomerId ( $customerid )
      // set your custom field here.
      ->setNickname ( $data ['nickname'] )->save ();

      if ($data ['option_id']) {
      $arr_data = explode ( "@", $data ['option_id'] );

      if (! empty ( $arr_data )) {

      foreach ( $arr_data as $each_data ) {

      $arr_rating = explode ( ":", $each_data );

      if ($arr_rating [1] != 0) {

      Mage::getModel ( 'rating/rating' )
      ->setRatingId ( $arr_rating [0] )
      ->setReviewId ( $_review->getId () )
      ->setCustomerId ( $customerid )
      ->addOptionVote ( $arr_rating [1], $product_id );
      }
      }
      }
      $_review->aggregate ();
      }
      }
      }
      }





      share|improve this answer


























        0












        0








        0







        Based on comments, you want to import customers reviews from csv, so you can use this: https://www.magentocommerce.com/magento-connect/product-review-import-export.html



        This extension is not ready to multistore but works fine. You can edit Adapter (MK_Reviewexport_Model_Convert_Adapter_Reviewimport) and add your custom field.



        class MK_Reviewexport_Model_Convert_Adapter_Reviewimport extends Mage_Catalog_Model_Convert_Adapter_Product
        {
        public function saveRow(array $data)
        {
        $write = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
        $sku = $write->query ( 'select entity_id from `catalog_product_entity` where sku = "' . $data ['Sku'] . '" ' );
        $sku = $sku->fetch ();

        if ($sku) {
        $product_id = $sku ['entity_id'];
        if ($data ['customer_id'] == '') {
        $customerid = NULL;
        } else {
        $customerid = $data ['customer_id'];
        }
        $_review = Mage::getModel ( 'review/review' )
        ->setCreatedAt ( $data ['created_at'] )
        ->setEntityPkValue ( $product_id )->setEntityId ( 1 )
        ->setStatusId ( $data ['status_id'] )
        ->setTitle ( $data ['title'] )->setDetail ( $data ['detail'] )
        ->setStoreId ( 1 )
        ->setStores ( 1 )
        ->setCustomerId ( $customerid )
        // set your custom field here.
        ->setNickname ( $data ['nickname'] )->save ();

        if ($data ['option_id']) {
        $arr_data = explode ( "@", $data ['option_id'] );

        if (! empty ( $arr_data )) {

        foreach ( $arr_data as $each_data ) {

        $arr_rating = explode ( ":", $each_data );

        if ($arr_rating [1] != 0) {

        Mage::getModel ( 'rating/rating' )
        ->setRatingId ( $arr_rating [0] )
        ->setReviewId ( $_review->getId () )
        ->setCustomerId ( $customerid )
        ->addOptionVote ( $arr_rating [1], $product_id );
        }
        }
        }
        $_review->aggregate ();
        }
        }
        }
        }





        share|improve this answer













        Based on comments, you want to import customers reviews from csv, so you can use this: https://www.magentocommerce.com/magento-connect/product-review-import-export.html



        This extension is not ready to multistore but works fine. You can edit Adapter (MK_Reviewexport_Model_Convert_Adapter_Reviewimport) and add your custom field.



        class MK_Reviewexport_Model_Convert_Adapter_Reviewimport extends Mage_Catalog_Model_Convert_Adapter_Product
        {
        public function saveRow(array $data)
        {
        $write = Mage::getSingleton ( 'core/resource' )->getConnection ( 'core_write' );
        $sku = $write->query ( 'select entity_id from `catalog_product_entity` where sku = "' . $data ['Sku'] . '" ' );
        $sku = $sku->fetch ();

        if ($sku) {
        $product_id = $sku ['entity_id'];
        if ($data ['customer_id'] == '') {
        $customerid = NULL;
        } else {
        $customerid = $data ['customer_id'];
        }
        $_review = Mage::getModel ( 'review/review' )
        ->setCreatedAt ( $data ['created_at'] )
        ->setEntityPkValue ( $product_id )->setEntityId ( 1 )
        ->setStatusId ( $data ['status_id'] )
        ->setTitle ( $data ['title'] )->setDetail ( $data ['detail'] )
        ->setStoreId ( 1 )
        ->setStores ( 1 )
        ->setCustomerId ( $customerid )
        // set your custom field here.
        ->setNickname ( $data ['nickname'] )->save ();

        if ($data ['option_id']) {
        $arr_data = explode ( "@", $data ['option_id'] );

        if (! empty ( $arr_data )) {

        foreach ( $arr_data as $each_data ) {

        $arr_rating = explode ( ":", $each_data );

        if ($arr_rating [1] != 0) {

        Mage::getModel ( 'rating/rating' )
        ->setRatingId ( $arr_rating [0] )
        ->setReviewId ( $_review->getId () )
        ->setCustomerId ( $customerid )
        ->addOptionVote ( $arr_rating [1], $product_id );
        }
        }
        }
        $_review->aggregate ();
        }
        }
        }
        }






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 16 '16 at 12:14









        Denis SpalenzaDenis Spalenza

        1,1281126




        1,1281126






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f92648%2fhow-to-add-product-reviews-progmatically-to-add-data-on-custom-field%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            “%fieldName is a required field.”, in Magento2 REST API Call for GET Method Type The Next...

            How to change City field to a dropdown in Checkout step Magento 2Magento 2 : How to change UI field(s)...

            夢乃愛華...