Jump to content

simple PHP problem...


subzerostudio

Recommended Posts

[quote author=obsidian link=topic=107644.msg432060#msg432060 date=1157982081]
are you doing both of those on the same page? my question is, on the second example, are you instantiating the $order object before you try to access it?
[/quote]

Yes I am..  I can place the statements directly after each other on the same page.

The class is part of the osCommerce package.  So I don't think posting the class would be wise, as it would involve posting a few thousand lines of code of a couple of different classes..

or maybe I should? hmm..  I'm not *that* confident with PHP, but i expected that to work! ???
Link to comment
https://forums.phpfreaks.com/topic/20388-simple-php-problem/#findComment-89789
Share on other sites

var_dump returns nothing as well..  Maybe if i put it in context that will help:

[code]
// class methods
    function quote($method = '') {
      global $order;

      //GET THE CITY HERE
      $city = $order->delivery['city'];

      $this->quotes = array('id' => $this->code,
                            'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                            'methods' => array(array('id' => $this->code,
                                                    'title' => $city,
                                                    'cost' => MODULE_SHIPPING_FLAT_COST)));

      if ($this->tax_class > 0) {
        $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
      }

      if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

      return $this->quotes;
    }
[/code]

In the above case, 'title' is blank when returned. However if i subsitute this line:

[code]'title' => $city,[/code]

For this:

[code]$order->delivery['city'][/code]

It works.

??
Link to comment
https://forums.phpfreaks.com/topic/20388-simple-php-problem/#findComment-89805
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.