Jump to content

[Solved] QR code - fix dynamic URL - return product url


John_John

Recommended Posts

Hello,

 

I am using Prestashop 1.5.3.1 at the moment and am quite 'happy' so far in that things are still working.

 

Have downloaded and installed the QR code found at : http://prestanesia.c...roduct-qr-code/

Even though it is only compatible up to 1.4.x , i could install it without problems.

 

The real problem is that the dynamic link seems to be wrong.

 

The QR code currently generates the URL based on this line:

 

{$link->getProductLink($product->id, $product->link_rewrite, $product->category)}

 

But i have a feeling that this is not correct with version 1.5.3.1.

Who knows how i can fix this URL so that it works?

 

Thanks in advance

Edited by John_John (see edit history)
Link to comment
Share on other sites

With PrestaShop 1.5, you could just use

 

{$product_link}

 

That would change blockqrcode.tpl from

 

<img src="https://chart.googleapis.com/chart?cht=qr&chs=128x128&chld=L|0&chl={$link->getProductLink($product->id, $product->link_rewrite, $product->category)}" alt="{$product->name}" style="float:right;" />

 

To

 

<img src="https://chart.googleapis.com/chart?cht=qr&chs=128x128&chld=L|0&chl={$product_link}" alt="{$product->name}" style="float:right;" />

Link to comment
Share on other sites

Working locally shouldn't be an issue.

 

Could you add this line to blockqrcode.tpl

 

{debug}

 

That should give you a popup with a quite a few Smarty Variables and their respective outputs. Could you copy that entire output (it's a bit large) and paste it here? It'll list out what variables your system is parsing.

 

Are you using Friendly URL's?

 

P.S. If you don't get a popup with the Smarty Variables, double check that your Popup Blocker is disabled for your test site.

Edited by PotionsFactory (see edit history)
  • Like 1
Link to comment
Share on other sites

Thanks for following up Potions.

 

Have tested this a bit further with Friendly URL's and without.

Also with enabling debug mode.

 

Interestingly, all the {$product} variations don't work

But i found it to return the normal URL when i use

 

{$come_from}

 

And for the alt i just used

 

{$name}

 

At the moment i don't see anything wrong with using the above code so its fixed !? :)

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

Just wanted to report that even though a QR code is generated by the

{$come_from}

it will not generate the complete URL for me.

 

But the

{$product_link}

does generate a correct URL in the QR code!

 

Seems to be a problem with the "&" parameters that is turned into "&amp" when using

{$come_from}

.

 

I am using PS 1.5.1.0

Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

With PrestaShop 1.5, you could just use

 

{$product_link}

 

That would change blockqrcode.tpl from

 

<img src="https://chart.googleapis.com/chart?cht=qr&chs=128x128&chld=L|0&chl={$link->getProductLink($product->id, $product->link_rewrite, $product->category)}" alt="{$product->name}" style="float:right;" />

 

To

 

<img src="https://chart.googleapis.com/chart?cht=qr&chs=128x128&chld=L|0&chl={$product_link}" alt="{$product->name}" style="float:right;" />

 

it's work well

 

the only change is in blockqrcode.php

need to change

 return (parent::install() AND $this->registerHook('productActions'));

and

public function hookProductActions($params)

 

to

 

 return (parent::install() AND $this->registerHook('extraLeft'));

and

public function hookExtraLeft($params)

 

(to appear in the left side of the product page, otherwise is hiding under the "add to cart" and you can not scan the code)

 

m12md.jpg

Edited by Ginno (see edit history)
Link to comment
Share on other sites

  • 4 months later...

Now I am running PS 1.5.6 and different way to implement my google qr code. I am adding the qr code via the CMS> edit HTML source . and it does not work with both the below codes. Can someone tell me how to use it via the CMS (Edit HTML source) ? Both the below code cannot get the product page URL at all. 

<img src="https://chart.googleapis.com/chart?cht=qr&chs=128x128&chld=L|0&chl={$link->getProductLink($product->id, $product->link_rewrite, $product->category)}" alt="{$product->name}" style="float:right;" />

and 

<img src="https://chart.googleapis.com/chart?cht=qr&chs=128x128&chld=L|0&chl={$product_link}" alt="{$product->name}" style="float:right;" />

Appreciate the help guys... Thanks :)

Link to comment
Share on other sites

OK I got it to work on PS 1.5.6. The Module installed into 1.5.6 nicely and it uses the below for the qr code (blockqrcode.tpl)

<img src="https://chart.googleapis.com/chart?cht=qr&chs=128x128&chld=L|0&chl={$link->getProductLink($product->id, $product->link_rewrite, $product->category)}" alt="{$product->name}" />

Vekia, I ditch the use of CMS (edit HTML editor) hheheheh and tried the module and it worked Thanks anyway 

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...