Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
getdatakick committed May 24, 2018
1 parent ba13d77 commit bce0c4d
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
3 changes: 1 addition & 2 deletions ajax.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?php
define('PRICEALERT_PS_BASE', '/Users/tyruk/sites/prestashop_1730');
//define('PRICEALERT_PS_BASE', dirname(__FILE__) . '/../..');
define('PRICEALERT_PS_BASE', dirname(__FILE__) . '/../..');
require_once(PRICEALERT_PS_BASE.'/config/config.inc.php');
require_once(PRICEALERT_PS_BASE.'/init.php');
require_once(dirname(__FILE__).'/pricealert.php');
Expand Down
13 changes: 9 additions & 4 deletions pricealert.php
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ public static function sendNotification($data, $context) {
$images = (isset($comb[$combination][0])) ? $comb[$combination] : $product->getImages($context->language->id);
}
$image_id = (int)((isset($images[0]['id_image']) ? $images[0]['id_image'] : 0));
$image = $this->getImageLink($product->link_rewrite, $image_id);
$image = self::getImageLinkStatic($context->link, $product->link_rewrite, $image_id, $context->language->id);
$currency = Currency::getCurrencyInstance((int)$data['id_format_currency']);

$data = array(
Expand Down Expand Up @@ -700,15 +700,20 @@ protected function getProduct($product)
);
}

private function getImageLink($rewrite, $imageId) {
private static function getImageLinkStatic($link, $rewrite, $imageId, $languageId) {
if ($imageId) {
$link = $this->context->link;
if (is_array($rewrite)) {
$rewrite = $rewrite[$this->context->language->id];
$rewrite = $rewrite[$languageId];
}
$type = is_callable('ImageType', 'getFormattedName') ? ImageType::getFormattedName('home') : ImageType::getFormatedName('home');
return $link->getImageLink($rewrite, $imageId, $type);
}
return '';
}

private function getImageLink($rewrite, $imageId) {
$link = $this->context->link;
$language = $this->context->language->id;
return self::getImageLinkStatic($link, $rewrite, $imageId, $language);
}
}
5 changes: 3 additions & 2 deletions src/css/cleanslate.less
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@

.gdpr {
margin-top: 1em;
font-size: 0.875em;
color: #666;
label {
text-align: left;
}
}
12 changes: 6 additions & 6 deletions views/js/pricealert.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion views/js/pricealert.js.map

Large diffs are not rendered by default.

0 comments on commit bce0c4d

Please sign in to comment.