Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

my brain is being useless

Featured Replies

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.

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)

  • 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 :)

  • Author

I'm not sure isset is the right one for this. as a radio button it's always set. yes/no answer.

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.

  • 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.......

  • 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'))

  • 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;
     	}
     }
?>

  • 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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.