Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2008
    Posts
    274
    Plugin Contributions
    0

    Default Easy Question for someone good at PHP

    I am editing one of my shipping modules.

    BAsically I am checking to see if someone ordered an item from a category, if they did I need to add $15

    I am very close to having it figured out but I have a syntac error I can't figure out.



    This code is in my item.php page. When I enter it the shipping page pulls up blank and when I research it this is the error message. I'm not sure what else to put to make it work

    here is the error

    *************************
    [27-Apr-2011 09:41:12] PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/image/public_html/grimmandgorly.com/cart/includes/modules/shipping/item.php on line 131



    *****here is the code, line 131 is this one

    if ($this->$chk_flowers >0) {'cost' => ('cost' + 15)};


    *******************************************

    global $cart;
    $chk_flowers = $_SESSION['cart']->in_cart_check('master_categories_id','14');


    if ($this->$chk_flowers >0) {'cost' => ('cost' + 15)};





    thanks

  2. #2
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Easy Question for someone good at PHP

    Quote Originally Posted by timhersh View Post
    *****here is the code, line 131 is this one

    if ($this->$chk_flowers >0) {'cost' => ('cost' + 15)};
    Try changing that line to read:

    if ($this->chk_flowers >0) {'cost' => ('cost' + 15)};

    The problem, as far as I can see is the double use of the $ operand

    if ($chk_flowers >0) {'cost' => ('cost' + 15)};

    will probably also work

    Cheers
    Rod

  3. #3
    Join Date
    Apr 2009
    Posts
    155
    Plugin Contributions
    1

    Default Re: Easy Question for someone good at PHP

    Hope I'm not overstating my PHP skills by replying to this post. ;)

    In looking at my item.php file from 1.3.9h, it only has 101 lines. Where is the rest of the code you've added? Without seeing that, I'm going to guess the array you're referring to in your condition hasn't been properly defined.

    Hope this helps! :)

    Good catch, Rod! We must have been typing at the same time. My eye went right past that. Still working on my coffee.
    Last edited by ToniScraparoni; 27 Apr 2011 at 04:24 PM.
    [FONT="Verdana"]If you want something done right, you have to get Zenned.
    ♥~-My Zen Cart Mods-~♥[/FONT]

  4. #4
    Join Date
    Aug 2008
    Posts
    274
    Plugin Contributions
    0

    Default Re: Easy Question for someone good at PHP

    Thanks, I am editing the other item.php, under includes/includes/modules/shipping

    I did try that solution and I am still getting the same error message

    here is the error


    [27-Apr-2011 10:26:39] PHP Parse error: syntax error, unexpected T_DOUBLE_ARROW in /home/image/public_html/grimmandgorly.com/cart/includes/modules/shipping/item.php on line 131

    here is what I have for the code now

    ******************

    global $cart;
    $chk_flowers = $_SESSION['cart']->in_cart_check('master_categories_id','14');

    if ($chk_flowers >0) {'cost'=>('cost' + 15)};


    if ($this->tax_class > 0) {

    $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

    }





    any ideas??? thanks

  5. #5
    Join Date
    Aug 2008
    Posts
    274
    Plugin Contributions
    0

    Default Re: Easy Question for someone good at PHP

    Any ideas, I have tried everything. Pretty much I just need to add $15 to the shipping cost if there is anything in category 14. I think I have it almost correct but keep getting the \ unexpected T_DOUBLE_ARROW

 

 

Similar Threads

  1. v150 Can I get someone to install addons for me? Not good w/filezilla
    By coucho in forum General Questions
    Replies: 4
    Last Post: 15 Jul 2012, 09:44 AM
  2. Looking for a good PHP book
    By markw10 in forum General Questions
    Replies: 2
    Last Post: 6 Apr 2009, 03:39 AM
  3. Easy question, someone must know
    By ebaobao in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 9 Aug 2008, 02:51 AM
  4. Easy PHP Question (for someone :( )
    By tracstev in forum General Questions
    Replies: 2
    Last Post: 26 Apr 2008, 04:46 PM
  5. Easy PHP syntax question -- help please?
    By magicpants in forum General Questions
    Replies: 2
    Last Post: 17 Jan 2007, 02:31 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR