How to add product reviews progmatically to add data on custom field
$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
bumped to the homepage by Community♦ 12 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
|
show 3 more comments
$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
bumped to the homepage by Community♦ 12 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
|
show 3 more comments
$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
$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
magento-1.9 import review programmatically
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♦ 12 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♦ 12 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
|
show 3 more comments
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
|
show 3 more comments
1 Answer
1
active
oldest
votes
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 ();
}
}
}
}
add a comment |
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
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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 ();
}
}
}
}
add a comment |
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 ();
}
}
}
}
add a comment |
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 ();
}
}
}
}
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 ();
}
}
}
}
answered Jan 16 '16 at 12:14
Denis SpalenzaDenis Spalenza
1,1281126
1,1281126
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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