December 8, 201114 yr Ok so my brain has apparently retired for the day and I'm stuck on this... it should be fairly easy and I'm not getting it. <?php if (!$canada) { ?> <span><img style="padding: 10px 0 0 0;" src="catalog/view/theme/default/image/canada.png" alt="not available" / ?></span> <?php } else { ?> <?php } ?> This first part is the code I haev inputed in the HTML... it works fine does what I want when I set the parameter with a radio button. Fairly simple. if ($this->config->get('canada_geo_zone_id') && $this->cart->!$canada) { $status = true; } else { $status = false; } this second part I'm essentially trying to get it so when the canada option is true for a product in the cart it will set the status as false. I'm hitting a wall here and I know i'm missing something fairly easy.
December 9, 201114 yr Firstly, I don't think you need to worry because if !$canada you'll cease to exist. Secondly, I think you're wanting: !isset($this->cart->canada)
December 9, 201114 yr Author Firstly, I don't think you need to worry because if !$canada you'll cease to exist. Secondly, I think you're wanting: !isset($this->cart->canada) HAHAHA... if this works you'll be getting a beer! made my morning
December 9, 201114 yr HAHAHA... if this works you'll be getting a beer! made my morning Should work, isset() can access object properties directly through the magic of overloading. Edited December 9, 201114 yr by Renaissance-Design
December 9, 201114 yr Author I'm not sure isset is the right one for this. as a radio button it's always set. yes/no answer.
December 9, 201114 yr In that case: if($this->cart->canada != false) If you have a default on the radio button, it'll always be set. Your problem was with: $this->cart->!$canada The $ isn't necessary for a property, and the ! shouldn't be placed there.
December 12, 201114 yr Author it's still no coperating... I'll dig into a bit further later today and see if i cant figure out why. now off to teach my boss how to do IF statements in excel.......
December 13, 201114 yr Author ok so I found a line that will access it, but still cant get it to be true only when set to 1 if ($this->config->get('canada_geo_zone_id') && $this->cart->getProducts('canada'))
December 13, 201114 yr Author <?php class ModelShippingCanada extends Model { public function getQuote($address) { $this->load->language('shipping/canada'); $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('canada_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')"); if ($this->config->get('canada_geo_zone_id') && $this->cart->getProducts('canada')) { $status = false; } else { $status = true; } $method_data = array(); if ($status) { $quote_data = array(); $quote_data['canada'] = array( 'code' => 'canada.canada', 'title' => $this->language->get('text_description'), 'cost' => 0.00, 'tax_class_id' => 0, 'text' => $this->currency->format(0.00) ); $method_data = array( 'code' => 'canada', 'title' => $this->language->get('text_title'), 'quote' => $quote_data, 'sort_order' => $this->config->get('canada_sort_order'), 'error' => false ); } return $method_data; } } ?>
December 14, 201114 yr Author I've gotten something to return now... although it returns "array" $this->cart->getProducts('canada') $this->cart->canada returned nothing at all progress I guess
Create an account or sign in to comment