Skip to content

Commit

Permalink
Added default value for the images_per_row to avoid run-timer error w…
Browse files Browse the repository at this point in the history
…hen making a % operation.
  • Loading branch information
rasseljandavid committed Jul 18, 2011
1 parent 9d6c7ff commit 129739e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions framework/modules/ecommerce/controllers/storeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ function showall() {
$rerankSQL = "SELECT DISTINCT p.* FROM ".DB_TABLE_PREFIX."_product p JOIN ".DB_TABLE_PREFIX."_product_storeCategories sc ON p.id = sc.product_id WHERE sc.storecategories_id=".$this->category->id." ORDER BY rank ASC";
//eDebug($router);
$defaultSort = $router->current_url;

assign_to_template(array('page'=>$page, 'defaultSort'=>$defaultSort, 'ancestors'=>$ancestors, 'categories'=>$categories, 'current_category'=>$this->category,'rerankSQL'=>$rerankSQL));
}

Expand All @@ -207,8 +208,13 @@ function grabConfig($category=null){
$cfg->src = "@globalstoresettings";
$cfg->int = "";
$config = new expConfig($cfg);
$this->config = (empty($catConfig->config) || @$catConfig->config['use_global']==1) ? $config->config : $catConfig->config;

$this->config = (empty($catConfig->config) || @$catConfig->config['use_global']==1) ? $config->config : $catConfig->config;
//This is needed since in the first installation of ecom the value for this will be empty and we are doing % operation for this value
//So we need to ensure if the value is = 0, then we can as well make it to 1
if(empty($this->config['images_per_row'])) {
$this->config['images_per_row'] = 3;
}
}

function upcoming_events() {
Expand Down Expand Up @@ -513,8 +519,8 @@ function show() {

if (!empty($tpl)) $template = new controllerTemplate($this, $tpl);
$this->grabConfig();
//eDebug($product);
assign_to_template(array('config'=>$this->config, 'product'=>$product, 'last_category'=>$order->lastcat));
assign_to_template(array('config'=>$this->config, 'product'=>$product, 'last_category'=>$order->lastcat));
}

function showByTitle() {
Expand Down Expand Up @@ -556,7 +562,8 @@ function showByTitle() {
//eDebug($product);
if (!empty($tpl)) $template = new controllerTemplate($this, $tpl);
$this->grabConfig();
assign_to_template(array('config'=>$this->config, 'product'=>$product_type, 'last_category'=>$order->lastcat));

assign_to_template(array('config'=>$this->config, 'product'=>$product_type, 'last_category'=>$order->lastcat));
}

function showByModel() {
Expand Down

0 comments on commit 129739e

Please sign in to comment.