Skip to content

Commit

Permalink
Fix inability to use this in anonymous function in PHP 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
RBech committed Jun 16, 2017
1 parent 99205db commit 208ff05
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion clerk.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public function __construct()
{
$this->name = 'clerk';
$this->tab = 'advertising_marketing';
$this->version = '1.4.4';
$this->version = '1.4.5';
$this->author = 'Clerk';
$this->need_instance = 0;
$this->ps_versions_compliancy = array('min' => '1.5', 'max' => _PS_VERSION_);
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<module>
<name>clerk</name>
<displayName><![CDATA[Clerk]]></displayName>
<version><![CDATA[1.4.4]]></version>
<version><![CDATA[1.4.5]]></version>
<description><![CDATA[Clerk.io Turns More Browsers Into Buyers]]></description>
<author><![CDATA[Clerk]]></author>
<tab><![CDATA[advertising_marketing]]></tab>
Expand Down
11 changes: 7 additions & 4 deletions controllers/front/product.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ public function __construct()
return (bool) $product['on_sale'];
});

$this->addFieldHandler('url', function($product) {
return $this->context->link->getProductLink($product['id_product']);
//Needed for PHP 5.3 support
$context = $this->context;

$this->addFieldHandler('url', function($product) use($context) {
return $context->link->getProductLink($product['id_product']);
});

$this->addFieldHandler('image', function($product) {
$this->addFieldHandler('image', function($product) use($context) {
$image = Image::getCover($product['id_product']);
return $this->context->link->getImageLink($product['link_rewrite'], $image['id_image'], 'home_default');
return $context->link->getImageLink($product['link_rewrite'], $image['id_image'], 'home_default');
});

$this->addFieldHandler('price', function($product) {
Expand Down

0 comments on commit 208ff05

Please sign in to comment.