Post by LegendarnyZiom » Thu May 21, 2015 11:34 pm

Hi guys,
This is my discount_v2
opencart 1.5.6.1
model/catalog/product.php

Code: Select all

			if(!$special) {
				$results = $this->getProductRabats($product_id);
				foreach ($results as $result) {
					if ($result['type']=='P') {
						$price -= ( ( $price * $result['rabat'] ) / 100);
					if ($special) $special -= ( ( $special * $result['rabat'] ) / 100);
					} else {
						$price -= $result['rabat'];
						if ($special) $special -= $result['rabat'];
						}
				}
			}
rabat is sql table
but i want without new sql table change this to shows crossed out price.

my tpl:

Code: Select all

		        <?php if (!$special) { ?>
		        <span class="price-new"><?php echo implode(',<span class="small">', explode(',',$price)).'</span>'; ?></span><br />
		        <?php } else { ?>
		        <span class="price-new"><?php echo implode(',<span class="small">', explode(',',$special)).'</span>'; ?></span><br /><span class="price-old"><?php echo implode(',<span class="small">', explode(',',$price)).'</span>'; ?></span><br />
		        <?php } ?>


But it isn't special, it's normal price.

I try change

Code: Select all

$price -= ( ( $price * $result['rabat'] ) / 100);
to

Code: Select all

$cena = $price - ( ( $price * $result['rabat'] ) / 100);
and then in tpl

if ($cena = $price) {
echo "is $price";
} else {
echo "Was $price, Is $cena";

undefined variable error, any idea how do this?


Posts

Joined
Thu May 21, 2015 11:24 pm
Who is online

Users browsing this forum: No registered users and 1 guest