Ecom Product reviews

Permalink 1 user found helpful
Hi Team..

I have been modifying the ecom template to enable Rich Snippets to work with product reviews using schema.org.
all Is going well I have modified the view.php to have the options in and added custom attributes to the products which I have pulled into the view.php so they all work nice.

Now the bit I am stuck on.. Adding Customer Reviews under each product added them through the dashboard under each product? I can't add the reviews on the page as a block as they have to be inside the schemes div to register.

Now I have added the new variables to the forms, and the DB.xml no problems. My problem Is I cant fine How I pull the information back into the view.php from the Database.

ATM they use this code: " $product->getProductDescription "
Now I can't find where this is set? getProductDescription???

As I have set mine to "echo $product->getProductReviewsName "

I Get: Fatal error: Call to undefined method BlockView::prReviewsName() in /home/Adminminitrex/www/packages/core_commerce/blocks/product/templates/Minitrix-productDisplay/view.php on line 229

Now I guess this is because it was a defined function some where?
I found by searching some public functions defined in \model\order\product.php

public function getProductName() {
return $this->prName;
}

So I Added Mine
public function getProductReviewsName() {
return $this->prReviewsName;
}

But No Luck? Can Any one explain hot the getProduct works for me so I can Have product reviews?

Or another way of printing out my db enty in view.php?

Thanks For the Help.

carl101lee
 
carl101lee replied on at Permalink Reply
carl101lee
OK Team..

I forgot you had to uninstall the package and re-install to get new DB.xml rules to work.. So I done this...

Ok From What I can see.. My data isn't being saved to db.. (Checked manually no data being saved to DB, fields are their at least now) AS the form.php when I edit a product don't display the saved data? but this could be because I cant call it out the DB correctly?

I added this to the top of the form..

$prReviewsName = $product->$this->prReviewsName;;
   $prReviewsTitle = $product->getProductReviewsTitle();
   $prReviewsScore = $product->getProductReviewsScore();
   $prReviewsdate = $product->getProductReviewsdate();
   $prReviewsDiscription = $product->prReviewsDiscription();
//and this to the form its self..
<legend><?php echo t('Product Reviews')?></legend>
         <div class="clearfix">
         <?php echo $form->label('prReviewsName', t('Name'))?>
         <div class="input">
            <?php echo $form->text('prReviewsName', $prReviewsName, array('class' => "span10"))?>
         </div>
         <?php echo $form->label('prReviewsTitle', t('Title'))?>
         <div class="input">
            <?php echo $form->text('prReviewsTitle', $prReviewsTitle, array('class' => "span10"))?>

But I get this error
Fatal error: Call to undefined method CoreCommerceProduct::getProductReviewsName() in /home/Adminminitrex/www/packages/core_commerce/elements/product/form.php on line 43

Any Help Any one?
carl101lee replied on at Permalink Reply
carl101lee
HI Any one

OK I am making some progress now!

I have modified the following files and added the same layout actions for my new fields.
core/models/product/model.php
core/models/order/product.php
core/elements/product/form.php
db.xml

Now so far I have Managed to be able get the review to save to the Database and appear on the page. How ever I can't seem to get it to pull the current data into the edit product option? Can any one tell me If i have missed a file ? Can supply more info if needed?

in the form.php I have
$prReviewsName = $product->getProductReviewsName(); (top)
<?php echo $form->label('prReviewsName', t('Name'))?>
<div class="input">
<?php echo $form->text('prReviewsName', $prReviewsName )?>
</div>

Thanks For Any Help