Post by cosmicx » Sun Jul 21, 2013 11:17 pm

Hello developers,

I don't have php skills yet.

I want to modify my product.tpl template and wanted to hard-code my own facebook likebox, twitter and google buttons.

But my problem is, I don't know how to get and echo out the seo product url of a product page.

This is what a facebook like box count looks like, and I needed to substite the data-href value dynamically with the currently viewed product's url. So it's gonna be data-href="http://mysite.com/the-product-seo-url"

Code: Select all

<div class="fb-like" data-href="http://facebook.com" data-send="false" data-layout="box_count" data-width="50" data-show-faces="false" data-font="verdana"></div>
Last edited by cosmicx on Wed Dec 11, 2013 8:19 am, edited 1 time in total.

Active Member

Posts

Joined
Mon Jan 09, 2012 6:27 pm

Post by MarketInSG » Mon Jul 22, 2013 9:15 am

Code: Select all

<?php echo $this->url->link('product/product', 'product_id=' . $product_id); ?>
This will give you the seo url


User avatar
Guru Member

Posts

Joined
Wed Nov 16, 2011 11:53 am
Location - Singapore

Post by cosmicx » Sat Dec 29, 2018 1:19 am

@MarketInSG thanks! The code above works in 2.3.0.2. I hope you have time for this question below.

What is the counterpart of the above code in OpenCart 3.0.2.0:

Code: Select all

<?php echo $this->url->link('product/product', 'product_id=' . $product_id); ?>
I've tried converting using openconverter.io but it did not work.

Active Member

Posts

Joined
Mon Jan 09, 2012 6:27 pm
Who is online

Users browsing this forum: No registered users and 9 guests