Results 1 to 7 of 7
  1. #1
    Join Date
    Apr 2005
    Location
    London, Ont. Canada
    Posts
    73
    Plugin Contributions
    0

    Default Exporting tax class id into php variable

    I'm trying to tweak the MYOB module and would like the Tax Class (HST, GST) in a variable. (Not the value 7.000 or 13.000)
    I've tried variations of this with no luck

    Code:
    $taxcode = $order->products[$i]['tax_class_id'];
    Can anyone give me a hand on this?

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,401
    Plugin Contributions
    87

    Default Re: Exporting tax class id into php variable

    I'm not quite sure what you're asking for ... is it the name of the tax class associated with the tax_class_id?

  3. #3
    Join Date
    Apr 2005
    Location
    London, Ont. Canada
    Posts
    73
    Plugin Contributions
    0

    Default Re: Exporting tax class id into php variable

    Yes, I'm looking for the tax class names.
    I use : GST, HST, PST, TX1 and TX2
    I use the same names in MYOB so when the tax class gets exported from Zen-Cart MYOB will know how to tax the item being imported.

    The MYOB Zen-Cart module exports some stuff into a txt file but I can't seem to get the tax class name:

    PHP Code:
    $customers_id $customer_id;
    $customers_firstname $order->customer['firstname'];
    $customers_lastname $order->customer['lastname'];
    $customers_street_address $order->customer['street_address'];
    $customers_suburb $order->customer['suburb'];
    $customers_city $order->customer['city'];
    $customers_postcode $order->customer['postcode'];
    $customers_state $order->customer['state'];
    $customers_country $order->customer['country']['title'];
    $customers_telephone $order->customer['telephone'];
    $customers_email_address $order->customer['email_address'];
    $customers_address_format_id $order->customer['format_id'];
    $delivery_name $order->delivery['firstname'] . ' ' $order->delivery['lastname'];
    $delivery_street_address $order->delivery['street_address'];
    $delivery_suburb $order->delivery['suburb'];
    $delivery_city $order->delivery['city'];
    $delivery_postcode $order->delivery['postcode'];
    $delivery_state $order->delivery['state'];
    $delivery_country $order->delivery['country']['title'];
    $delivery_address_format_id $order->delivery['format_id'];
    $payment_method $order->info['payment_method'];
    $cc_type $order->info['cc_type'];
    $cc_owner $order->info['cc_owner'];
    $cc_number $order->info['cc_number'];
    $cc_expires $order->info['cc_expires'];
    $date_purchased 'now()';
    $orders_status DEFAULT_ORDERS_STATUS_ID;
    $currency $order->info['currency'];
    $currency_value $order->info['currency_value'];
    $shipvia $order->info['shipping_method'];
    $comments str_replace(array("\n""\t""\r"), ' '$order->info['comments']); 

  4. #4
    Join Date
    Apr 2005
    Location
    London, Ont. Canada
    Posts
    73
    Plugin Contributions
    0

    Default Re: Exporting tax class id into php variable

    sorry, missed some code:

    PHP Code:
    $lines=$ordernum;
    $lines++;

    for (
    $i=0$i<sizeof($order->products); $i++)
    {  
        
    $product_number $order->products[$i]['model'];  
        
    $qty $order->products[$i]['qty'];  
        
    $taxcode $order->products[$i]['tax_class'];  
        
        
    $line ="$customers_lastname\t$ordernum\t$printed\t$product_number\t$qty\t$inctxprc\t$taxcode\t$payment_method - $shipvia - $comments";    
        
    fputs($fp,"$line\r\n");  
        
    $lines++;


  5. #5
    Join Date
    Apr 2005
    Location
    London, Ont. Canada
    Posts
    73
    Plugin Contributions
    0

    Default Re: Exporting tax class id into php variable

    Ahh, case of the Mondays,

    I meant tax_class_id

    PHP Code:
    $lines=$ordernum;
    $lines++;

    for (
    $i=0$i<sizeof($order->products); $i++)
    {  
        
    $product_number $order->products[$i]['model'];  
        
    $qty $order->products[$i]['qty'];  
        
    $taxcode $order->products[$i]['tax_class_id'];  

        if (
    $taxcode == "1") {    $taxcode "GST";  } 
        elseif (
    $taxcode == "2") {    
        
    $taxcode "HST";  } 
        elseif (
    $taxcode == "3") {    
        
    $taxcode "PST";  } 
        elseif (
    $taxcode == "4") {    
        
    $taxcode "TX1";  } 
        elseif (
    $taxcode == "5") {    
        
    $taxcode "TX2";  } ;
        
        
    $line ="$customers_lastname\t$ordernum\t$printed\t$product_number\t$qty\t$inctxprc\t$taxcode\t$payment_method - $shipvia - $comments";    
        
    fputs($fp,"$line\r\n");  
        
    $lines++;


  6. #6
    Join Date
    Apr 2005
    Location
    London, Ont. Canada
    Posts
    73
    Plugin Contributions
    0

    Default How do I get the 'tax_class_id'

    I'm trying to get the 'tax_class_id' from a product during the checkout process, I've been googling different combinations of this with no luck.
    PHP Code:
    $products_tax_class_id $order->products[$i]['tax_class_id']; 

  7. #7
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Exporting tax class id into php variable

    Use:
    Code:
    $tax_class_id = zen_products_lookup($product_id, 'products_tax_class_id');
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. access a custom static class variable in tpl_checkout_stacked.php?
    By tcarden in forum Addon Shipping Modules
    Replies: 0
    Last Post: 4 Jul 2013, 01:16 AM
  2. v151 paypaldp.php: Invalid class variable
    By lat9 in forum Bug Reports
    Replies: 0
    Last Post: 27 May 2013, 07:41 PM
  3. v150 tax related bug in order.php class
    By j_vovus in forum Bug Reports
    Replies: 0
    Last Post: 9 Apr 2012, 11:34 AM
  4. Please how do I get to a variable in a class
    By Dayo in forum General Questions
    Replies: 1
    Last Post: 21 Mar 2008, 02:53 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