Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
dfTools notices and warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoslado committed May 6, 2016
1 parent ece3c9a commit b3c3da5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 12 deletions.
20 changes: 17 additions & 3 deletions dfTools.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ public static function getVariationImg($id_product, $id_product_attribute){
inner join ps_image i
on i.id_product = P.id_product and i.position = P.posicion";
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);

return $result[0]['id_image'];
if(isset($result[0]))
return $result[0]['id_image'];
else
return "";

}

Expand Down Expand Up @@ -306,6 +308,13 @@ public static function getFeaturesForProduct($id_product, $id_lang, $feature_key

$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);

if(count($feature_keys) > 0){
$features = array_fill(0, count($feature_keys), array());
}
else {
$features = array();
}

$features = array_fill(0, count($feature_keys), array());


Expand Down Expand Up @@ -352,7 +361,12 @@ public static function getAttributesForProductVariation($variation_id, $id_lang,
$result = array();
}

$attributes = array_fill(0, count($attribute_keys), "");
if(count($attribute_keys) > 0){
$attributes = array_fill(0, count($attribute_keys), "");
}
else{
$attributes = array();
}

foreach($result as $elem){
$attributes[array_search($elem['group_name'], $attribute_keys)] = $elem['name'];
Expand Down
Binary file modified dist/doofinder-p1.5-latest.zip
Binary file not shown.
2 changes: 1 addition & 1 deletion doofinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Doofinder extends Module

const GS_SHORT_DESCRIPTION = 1;
const GS_LONG_DESCRIPTION = 2;
const VERSION = "2.1.2";
const VERSION = "2.1.3";

const YES = 1;
const NO = 0;
Expand Down
13 changes: 6 additions & 7 deletions feed.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ function slugify($text)
ini_set('display_errors', 1);
}

if ($cfg_debug){
error_log("Starting feed.\n", 3, dirname(__FILE__).'/doofinder.log');
}


// OUTPUT
if (isset($_SERVER['HTTPS']))
Expand Down Expand Up @@ -161,9 +165,6 @@ function slugify($text)

if($cfg_product_variations && isset($row['id_product_attribute']) and intval($row['id_product_attribute']) > 0){
// ID
if($row['id_product_attribute'] == '1006'){
error_log(var_export($row), 3, dirname(__FILE__).'/doofinder.log');
}
echo "VAR-".$row['id_product_attribute'].TXT_SEPARATOR;
// TITLE
$product_title = dfTools::cleanString($row['name']);
Expand Down Expand Up @@ -295,16 +296,14 @@ function slugify($text)
else if ($cfg_display_prices && $cfg_product_variations)
{
echo TXT_SEPARATOR;

$product_price = Product::getPriceStatic($row['id_product'], $cfg_prices_w_taxes, $row['id_product_attribute'], 2, null, false, false);
$onsale_price = Product::getPriceStatic($row['id_product'], $cfg_prices_w_taxes, $row['id_product_attribute'], 2);

echo ($product_price ? Tools::convertPrice($product_price, $currency) : "").TXT_SEPARATOR;
echo (($product_price && $onsale_price && $product_price != $onsale_price) ? Tools::convertPrice($onsale_price, $currency) : "");
}

if ($cfg_product_variations){

if ($cfg_product_variations)
{
echo TXT_SEPARATOR;
echo $row['variation_reference'];
$variation_attributes = dfTools::getAttributesForProductVariation($row['id_product_attribute'], $lang->id, $attribute_keys);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "doofinder-for-prestashop",
"version": "2.1.2",
"version": "2.1.3",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-contrib-clean": "^0.5.0",
Expand Down

0 comments on commit b3c3da5

Please sign in to comment.