Post by nzjollyroger » Thu Feb 04, 2010 3:56 am

Code: Select all

<?php
class ModelShippingCost extends Model {
	function getQuote($country_id, $zone_id) {
		$this->load->language('shipping/cost');

		if ($this->config->get('cost_status')) {

      		$query = $this->db->query("SELECT geo_zone_id FROM " . DB_PREFIX . "zone_to_geo_zone WHERE country_id = '" . (int)$country_id . "' AND (zone_id = '" . (int)$zone_id . "' OR zone_id = '0')");
			
			$method_data = array();
			$quote_data = array();
			
			$costes = unserialize($this->config->get('cost_zone_geozone'));
			
			$totalEnvio = null;
			$impuestoEnvio = null;
			$minimo = 0;
			
			foreach($costes as $coste) {
				if ($query->row['geo_zone_id'] == $coste['geo_zone_id'] && $this->cart->getSubTotal() > $coste['total'] && $minimo <= $coste['total']) {
					$minimo = $coste['total'];
					$totalEnvio = $coste['cost'];
					$impuestoEnvio = $coste['tax_class_id'];
				}
			}
			
			if ($totalEnvio == null) {
				$text = $this->language->get('consultar');
			} else {
				$text = $this->currency->format($this->tax->calculate($totalEnvio, $impuestoEnvio, $this->config->get('config_tax')));
			}
			
      		$quote_data['cost'] = array(
        		'id'           => 'cost.cost',
        		'title'        => $this->language->get('text_description'),
        		'cost'         => $totalEnvio,
         		'tax_class_id' => $impuestoEnvio,
				'text'         => $text
      		);

      		$method_data = array(
        		'id'         => 'cost',
        		'title'      => $this->language->get('text_title'),
        		'quote'      => $quote_data,
				'sort_order' => $this->config->get('cost_sort_order'),
        		'error'      => FALSE
      		);
		}
	
		return $method_data;
	}
}
?>
problem with this i think, as any value set will return this value
if ($totalEnvio == null) {
$text = $this->language->get('consultar');

New member

Posts

Joined
Mon Nov 16, 2009 5:26 am

Post by Qphoria » Thu Feb 04, 2010 4:07 am

what is this? random code?

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by nzjollyroger » Thu Feb 04, 2010 4:16 am

this is the based on cost mod from the contrib section,
this is the contents of the catalog\model\shipping\cost.php.

basicly install contrib but the value returned inside shipping when the contrib is installed is the value generated from the line of code above.

wondering if anyone can see why that might be

New member

Posts

Joined
Mon Nov 16, 2009 5:26 am
Who is online

Users browsing this forum: No registered users and 87 guests