magento - Getting the reviews page URL for a product in the product page sidebar -


i trying url products reviews page in sidebar on products page. know can't difficult, defeating me @ moment..

i can product page url (basically url page sidebar on) not reviews page... same url -reviews.htm @ end instead of .htm

where going wrong? call have make?

in (your theme) catalog.xml file find section beginning <catalog_product_view translate="label">

look <reference name="right">.

if template not have right section in product view, add 1 in below content , enter:

    <reference name="right">     <block type="review/product_view_list" name="product.info.product_additional_data" as="reviews" template="review/product/view/list.phtml"/>        </reference> 

make sure have cache off, load product page (hopefully product review on there) , should have necessary.

you'll wanting have 'add review' box on product page make easier people add review. there clumsy ways don't work properly. however, easy, simple way...

open same layout.xml file had earlier, go catalog_product_view section, go right bottom of content section. final closing </reference> tag. add:

<block type="review/form" name="product.review.form" as="review_form" template="review/form.phtml"/> 

now go front end, add testimonial , note how wonderfully works, complete theme etc.

hopefully, example begin understand how powerful , useful magento layout xml files are.

extra

since new block needed, need new template file.

add:

app/design/frontend/base/default/template/review/sidebar.phtml

enter like:

 <div class="block block-reviews">     <div class="block-title">         <strong><span>reviews</span></strong>     </div>     <div class="block-content">     <p><a href="<?php echo $this->getmacguffin($this->getproductid()) ?>">macguffin!</a></p>     </div> </div> 

edit app/code/core/mage/review/block/product/view/list.php , add helper url function before class closing brace:

    public function getmacguffin($id)     { return mage::geturl('review/product/list', array('id'=> $id));     } 

now sort out layout xml add reference left block or reference right, whatever, product page directives:

<block type="review/product_view_list" name="review_sidebar" as="macguffin" template="review/sidebar.phtml"/> 

that gets link wanted, in nice sidebar block stuff can css to. copy on main theme. can take want list.phtml template pointed towards earlier , own code summarize reviews or else if have no reviews.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -