Post by wmall » Thu Feb 28, 2008 12:18 am

When the client try to download a file when the remaining is 0, it receive the error:

Notice: Undefined variable: response in /home/wmall/public_html/catalog/controller/account_download.php on line 141

Fatal error: Call to a member function redirect() on a non-object in /home/wmall/public_html/catalog/controller/account_download.php on line 141

Newbie

Posts

Joined
Sat Oct 20, 2007 9:08 pm

Post by TM » Sat Nov 08, 2008 4:42 am

After updating product.php and .tpl, category.php and .tpl the only place where discount are missing is when you make a search.
The following code worked for me

catalog/controller/search.php

replace

Code: Select all

foreach ($results as $result) {
          			$product_data[] = array(
            			'name'  => $result['name'],
            			'href'  => $url->href('product', FALSE, array('product_id' => $result['product_id'])),
            			'thumb' => $image->resize($result['filename'], $config->get('config_image_width'), $config->get('config_image_height')),
            			'price' => $currency->format($tax->calculate($result['price'], $result['tax_class_id']))
          			);
        		}
with

Code: Select all

foreach ($results as $result) {
        			$product_discount = $database->getRow("select * from product_discount where product_id = '" . (int)$result['product_id'] . "' ORDER BY quantity ASC LIMIT 1");
					
					if (!$product_discount) {
						$discount = 0;
					} else {
						$discount = $product_discount['discount'];
					}
					
          			$product_data[] = array(
            			'name'  => $result['name'],
            			'href'  => $url->href('product', FALSE, array('product_id' => $result['product_id'])),
            			'thumb' => $image->resize($result['filename'], $config->get('config_image_width'), $config->get('config_image_height')),
            			'price' => $currency->format($tax->calculate($result['price'], $result['tax_class_id'])),
            			'discount' => $discount,
						'discount_price' => $currency->format($tax->calculate($result['price'] - $discount, $result['tax_class_id']))
          			);
        		}
catalog/template/default/content/search.tpl

replace

Code: Select all

  <?php foreach ($products as $product) { ?>

  <div class="products"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a><br />

    <b><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></b><br />

    <?php echo $product['price']; ?></div>

  <?php } ?>
with

Code: Select all

  <?php foreach ($products as $product) { ?>

  <div class="products"><a href="<?php echo $product['href']; ?>"><img src="<?php echo $product['thumb']; ?>" title="<?php echo $product['name']; ?>" alt="<?php echo $product['name']; ?>" /></a><br />

    <b><a href="<?php echo $product['href']; ?>"><?php echo $product['name']; ?></a></b><br />
 
 <?php if (!$product['discount']) { ?>
          <?php echo $product['price']; ?>
<?php } else { ?>
          <span class="price_old"><?php echo $product['price']; ?></span>
          <span class="price_new"><?php echo $product['discount_price']; ?></span>
<?php } ?></div>  
<?php } ?>
working example http://duud.no

TM
Newbie

Posts

Joined
Sat Nov 08, 2008 4:22 am
Who is online

Users browsing this forum: No registered users and 5 guests