Try this again just in case...

I have a few line item scripts that all happen on the checkout page. The one that is giving trouble is a coupon line item.

  • All line items are being saved to the database, as  should be with hook-order.
  • All line items display, as they should but the tax is incorrect.
  • In admin/store/settings/taxes/1/edit I have a tax set up with a couple of rules.
    • These should have no bearing: one being the state for the tax and another being a user role (wholesalers are not taxed) .
    • Tax is applied to the Coupon line item on this page, as well as to the products.
    • I also set the Coupon line item type as taxable.

It is correct on the checkout page(it is written in real time with line_item_add JS...

However, when I output the order to screen in the uc_tax module... my line items aren't in the order yet.
I am using hook order with the $op of "save".

So I tried playing with line item weights: to try to get the total line item after my coupon.
If I use the following, it throws a fatal error on the review page load.
static $lines;
$lines = module_invoke_all('line_item', NULL); // this produces the names in the next array to which I added weights...
Actually re-ordered them. I think "total" was 2nd or 3rd.
$l_item_ids = array(
    'subtotal' => 0,
    'generic' =>1,
    'coupon' => 2,
    'free_offer' => 3,
    'shipping' => 4,
    'handling' => 5,
    'total' => 6
);
foreach( $lines as $i => $line ){
    foreach($l_item_ids as $id => $weight){
        if( $id === $line['id'] ){
            $lines[$i]['weight'] = $weight;
            // uc_li_tax_subtotal_weight
            // variable_set('uc_line_items_'. $lines[$i]['id'] .'_weight', $weight);
        }
    }
}

So nothing is working and I have no idea where to turn.
Seems like line item weights would be taken into consideration. Hints anyone?

--


Kindest regards, Dayton Perkins Dayton
                Perkins

Good News Design

Intelligent Web Programming for Business
Dayton Perkins: Recent American Expat in Hong Kong

day...@goodnewsdesign.com day...@goodnewsdesign.com
Phone Me U.S Phone (rings me in HK) 616-795-9039

http://goodnewsdesign.com
GND Logo



Reply via email to