Post by gizmecano » Wed Feb 10, 2016 11:55 pm

Greetings,

I'm looking for a way to get a direct link to a specific review (using review_id), such as :

Code: Select all

<a href="index.php?route=product/product&product_id=1&review_id=1">Review #1</a>
If it's not possible, a link to the tab review could possibly be sufficient, such as:

Code: Select all

<a href="index.php?route=product/product&product_id=1#tab-review">Reviews</a>
I have found some references for the former version of OpenCart (1.5.x), such as Link to select a tab or Linking to different product tab using text link, but nothing for the current version (2.x). Does anybody have an idea to get links like this?

Regards,

User avatar
New member

Posts

Joined
Mon Apr 13, 2015 9:21 pm

Post by vcabreu.py » Thu Feb 11, 2016 4:05 am

Ello, mate.
You can do this both ways...

The first one is the hardest one, you should create a product/review.php controller and a product/review.tpl view and maybe a model, where you call the review and show it to the viewer with a link like https://www.yourstore.com.br/index.php? ... ew_id=9001. It isn't so hard at all.

The second one you can do what i call 'gambiarra'. Just call a script triggering the click on your review tab button on window load when a parametrer is passed. For example: (example link= /index.php?route=product/product&product_id=9001&show_review=0)

Code: Select all

//somewhere in Product-controller
$this->data['show_review'] = $this->request->get['show_review'];
...

Code: Select all

//somewhere in Product-view
<?php if($show_review) { ?>
<script type="text-javascript">
$(window).load(function(){
 $("#[color=#FF0000]your-tab-review-button-id[/color]").trigger('click');
});
</script>
<?php } ?>
:joker:

User avatar
Newbie

Posts

Joined
Thu Jan 14, 2016 12:30 am
Location - Americana | São Paulo | Brazil
Who is online

Users browsing this forum: No registered users and 4 guests