Zen Cart Logo
Forums / Addon Admin Tools / Edit Orders v4.0 Support Thread

Edit Orders v4.0 Support Thread

Views: 346,058

Results 1,241 to 1,260 of 1,927
14 Feb 2018, 3:04 PM
#1241
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Edit Orders v4.0 Support Thread

Dave224:

The "trick" was to demonstrate that the problem is that quantity discounts is not processed properly in function eoGetOrderTotalTax. If MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_TAX_CLASS were defined, the function would get the tax on the discount from the database, and no trick would be required. I'm trying to be helpful. If I'm not, tell me and I'll go away.
Dave, you ***are ***being helpful and realize that the issues' source is based on the lack of "standardization" of how various order-total modules choose to apply/remove any tax-based values.

14 Feb 2018, 6:16 PM
#1242
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,686
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

lat9:

Dave, you ***are ***being helpful and realize that the issues' source is based on the lack of "standardization" of how various order-total modules choose to apply/remove any tax-based values.

I think most modules have a _CALC_TAX setting, and the use of "Standard" is pretty common. You could start with that.

14 Feb 2018, 6:21 PM
#1243
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,686
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Dave224:

If MODULE_ORDER_TOTAL_QUANTITY_DISCOUNT_TAX_CLASS were defined, the function would get the tax on the discount from the database, and no trick would be required.

This is still a trick. As I said earlier, the TAX_CLASS variables were defined to support Credit Notes. You're overloading it to mean something else. This is not a good approach.

14 Feb 2018, 6:41 PM
#1244
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

swguy:

I think most modules have a _CALC_TAX setting, and the use of "Standard" is pretty common. You could start with that.
Actually, I'm looking to use the calculate_deductions method, if it exists.

14 Feb 2018, 6:43 PM
#1245
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

swguy:

Same problem occurs with Group Discounts. Run the order with no discount, add the customer to a discount group, edit the order - the total is wrong.

Group Discount include tax = false, include shipping = false, recalculate tax = standard.

Original Order:
Sub-Total $500
FL Tax 7% 35.00
Total $535.00

Add Group discount of 25%:

Sub-Total $500
Group Discount $125
FL Tax 7% 26.25
Total $392.50

should be $401.25.
Hmm, I ran this test on EO 4.3.1, ticking the "Reset totals" box and the calculation was correct. What version of EO are you testing with?

14 Feb 2018, 7:34 PM
#1246
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

swguy:

This is still a trick. As I said earlier, the TAX_CLASS variables were defined to support Credit Notes. You're overloading it to mean something else. This is not a good approach.
I've been Googling but have not found anywhere that Zen Cart "Credit Note" functionality is defined. Could/would you fill in the blanks?

14 Feb 2018, 9:18 PM
#1247
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,686
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

lat9:

Hmm, I ran this test on EO 4.3.1, ticking the "Reset totals" box and the calculation was correct. What version of EO are you testing with?

I was on 4.2.3. Upgraded to 4.3.1, you're right - Group Discounts worked; Quantity Discounts did not.

14 Feb 2018, 9:20 PM
#1248
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,686
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

lat9:

I've been Googling but have not found anywhere that Zen Cart "Credit Note" functionality is defined. Could/would you fill in the blanks?

It's just a setting for tax recalc. I'm not positive it was ever fully implemented. You can see it in both ot_coupon.php and ot_group_pricing.php in includes/modules/order_total.

14 Feb 2018, 10:14 PM
#1249
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,686
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Cindy, I wonder if the way to go here is just add up the line items to get the total, rather than depending on the individual machinations of mods (which were designed to run on the catalog side) updating $order->info['total'].

15 Feb 2018, 1:27 PM
#1250
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

swguy:

Cindy, I wonder if the way to go here is just add up the line items to get the total, rather than depending on the individual machinations of mods (which were designed to run on the catalog side) updating $order->info['total'].
@swguy, I've also wondered why that path wasn't taken with the design ... although EO has been around (in various forms) since dinosaurs roamed the earth, so at this point it's not so much a *design *as a go-with-the-flow.

16 Feb 2018, 8:46 PM
#1251
dave224 avatar

dave224

Zen Follower

Join Date:
Jun 2012
Posts:
481
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Cindy,
I hate to tell you, but I found another problem in Edit Orders 4.3.1. If you add a product to an order or change the quantity of an item in the order, the change is made even if there is insufficient stock in inventory. Might be nice to bring up a warning message if there is insufficient stock when adding a product or increasing the quantity of a product.
Dave :(

17 Feb 2018, 12:47 PM
#1252
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Dave224:

Cindy,
I hate to tell you, but I found another problem in Edit Orders 4.3.1. If you add a product to an order or change the quantity of an item in the order, the change is made even if there is insufficient stock in inventory. Might be nice to bring up a warning message if there is insufficient stock when adding a product or increasing the quantity of a product.
Dave :(
Dave, thanks for the report. When I get back to my EO investigations, I've added that to the list!

19 Feb 2018, 1:23 PM
#1253
swguy avatar

swguy

Administrator

Join Date:
Feb 2006
Location:
Tampa Bay, Florida
Posts:
10,686
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

Edit Orders 4.3.1 and my mods (Quantity Discounts, Better Together, et. al.):

This seems to work. In the function process() in the code file in includes/modules/order_total (e.g. includes/modules/order_total/ot_quantity_discount.php for Quantity Discounts)

Change

               if ($this->calculate_tax != 'VAT') {
                  $order->info['total'] -= $od_amount[$key];
               }

to

               if (!IS_ADMIN_FLAG) {
                  if ($this->calculate_tax != 'VAT') {
                     $order->info['total'] -= $od_amount[$key];
                  }
               }
19 Feb 2018, 1:37 PM
#1254
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

swguy:

Edit Orders 4.3.1 and my mods (Quantity Discounts, Better Together, et. al.):

This seems to work. In the function process() in the code file in includes/modules/order_total (e.g. includes/modules/order_total/ot_quantity_discount.php for Quantity Discounts)

Change

           if ($this->calculate_tax != 'VAT') {
              $order->info['total'] -= $od_amount[$key];
           }
> to
> 
> ```
               if (!IS_ADMIN_FLAG) {
                  if ($this->calculate_tax != 'VAT') {
                     $order->info['total'] -= $od_amount[$key];
                  }
               }

Thanks, @swguy. I'm in the process of vetting that integration; I'll give that change a go.

28 Feb 2018, 7:44 PM
#1255
allmart avatar

allmart

Zen Follower

Join Date:
Feb 2016
Location:
Canada
Posts:
192
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

Hello,

I have added the products price to my order confirmation email. The issue I have is that it is not formatted as currency ($-Canadian). See below:

3 x KARMA Wellness Water - Probiotics Blueberry Lemonade 12 x 532ml Plastic (KAR532PBL) @ 35.2 = $105.60

I want the price 35.2 to appear as $35.20 and don't know the syntax.

Below in red is what I changed/added in includes/classes/order.php

\\\\\\\\\\\\\\\\\\\\\\\\\\\\
$sql_data_array = array('orders_id' => $zf_insert_id,
'products_id' => zen_get_prid($this->products[$i]['id']),
'products_model' => $this->products[$i]['model'],
'products_name' => $this->products[$i]['name'],
'products_description' => zen_get_products_description($this->products[$i]['id']), //added by JM
'products_price' => $this->products[$i]['price'],
'final_price' => $this->products[$i]['final_price'],
'onetime_charges' => $this->products[$i]['onetime_charges'],
'products_tax' => $this->products[$i]['tax'],
'products_quantity' => $this->products[$i]['qty'],
'products_priced_by_attribute' => $this->products[$i]['products_priced_by_attribute'],
'product_is_free' => $this->products[$i]['product_is_free'],
'products_discount_type' => $this->products[$i]['products_discount_type'],
'products_discount_type_from' => $this->products[$i]['products_discount_type_from'],
'products_prid' => $this->products[$i]['id']);
zen_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array);
\\\\\\\\\\\\\\\\\\\\\\\\\\\\

I also added the following in red:

\\\\\\\\\\\\\\\\\\\\\\\\\\\\
$this->products[$index] = array('qty' => $products[$i]['quantity'],
'name' => $products[$i]['name'],
'model' => $products[$i]['model'],
'tax_groups'=>$taxRates,
'tax_description' => zen_get_tax_description($products[$i]['tax_class_id'], $taxCountryId, $taxZoneId),
'price' => zen_round($products[$i]['price'],$decimals),
'final_price' => zen_round($products[$i]['price'] + $_SESSION['cart']->attributes_price($products[$i]['id']), $decimals),
'onetime_charges' => $_SESSION['cart']->attributes_price_onetime_charges($products[$i]['id'], $products[$i]['quantity']),
'weight' => $products[$i]['weight'],
'products_priced_by_attribute' => $products[$i]['products_priced_by_attribute'],
'product_is_free' => $products[$i]['product_is_free'],
'products_discount_type' => $products[$i]['products_discount_type'],
'products_discount_type_from' => $products[$i]['products_discount_type_from'],
'id' => $products[$i]['id'],
'rowClass' => $rowClass);
\\\\\\\\\\\\\\\\\\\\\\\\\\\\

the line that displays details of the product order has been changed to the following:

$this->products_ordered .= $this->products[$i]['qty'] . ' x ' . $this->products[$i]['name'] . ' ' .zen_get_products_description($this->products[$i]['id']) . ' ' . ($this->products[$i]['model'] != '' ? ' (' . $this->products[$i]['model'] . ') ' : '') . '@ ' .$this->products[$i]['price']. ' = ' .

Any help is appreciated.

Thanks in advance!

28 Feb 2018, 9:33 PM
#1256
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

@allmart, why is this SIZE=1[/SIZE]posted in the Edit Orders plugin's support thread?

28 Feb 2018, 9:47 PM
#1257
allmart avatar

allmart

Zen Follower

Join Date:
Feb 2016
Location:
Canada
Posts:
192
Plugin Contributions:
0

Re: Edit Orders v4.0 Support Thread

lat9:

@allmart, why is this SIZE=1[/SIZE]posted in the Edit Orders plugin's support thread?
My apologies yesterday I originally posted in the correct thread. Today when I checked the thread I didn't realize that I was viewing the wrong thread and saw nothing posted so I re-posted, now realizing that I was in the incorrect thread (edit orders).
What a dope and I am sorry.
Cheers!

7 Mar 2018, 12:59 PM
#1258
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Edit Orders v4.0 Support Thread

Please take the following with a grain of salt because it was tested on ZC 1.5.6 beta though the results were the same as reported by someone using ZC 1.5.5f.

There are centrally two issues, one for eventual consideration of design of the home grown support software to EO and the following primary issue.

Once an order is placed that contains any number of product with attributes, going to edit orders and selecting the update button causes the attributes of all product in the order to be removed.

The other issue (again with ZC 1.5.6 still being in development) is that the notifiers for adding buttons into the order page are modified away from what is used in the current version of Edit orders (4.3.1) which may be an issue with the software that detects the presence of applicable notifiers (though may not also) in a single install as between two different versions of ZC the "same" notifier may exist but by a different name. I have not looked into the operation to identify the capability but thought notification of that potential issue would help plan for such "control" if not already considered.

7 Mar 2018, 1:28 PM
#1259
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,067
Plugin Contributions:
56

Re: Edit Orders v4.0 Support Thread

mc12345678:

Please take the following with a grain of salt because it was tested on ZC 1.5.6 beta though the results were the same as reported by someone using ZC 1.5.5f.

There are centrally two issues, one for eventual consideration of design of the home grown support software to EO and the following primary issue.

Once an order is placed that contains any number of product with attributes, going to edit orders and selecting the update button causes the attributes of all product in the order to be removed.

The other issue (again with ZC 1.5.6 still being in development) is that the notifiers for adding buttons into the order page are modified away from what is used in the current version of Edit orders (4.3.1) which may be an issue with the software that detects the presence of applicable notifiers (though may not also) in a single install as between two different versions of ZC the "same" notifier may exist but by a different name. I have not looked into the operation to identify the capability but thought notification of that potential issue would help plan for such "control" if not already considered.
The first issue arises from the current EO design. When an order is updated, all products are removed/re-added ... including their attributes. Until I get time to go down a re-design path, that's the way it is.

I'll check on those notifiers; I've been trying to keep them in-line with future ZC base values.

7 Mar 2018, 1:51 PM
#1260
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Edit Orders v4.0 Support Thread

lat9:

The first issue arises from the current EO design. When an order is updated, all products are removed/re-added ... including their attributes. Until I get time to go down a re-design path, that's the way it is.

I'll check on those notifiers; I've been trying to keep them in-line with future ZC base values.

To be clear, the highlighted portion does not fully occur. The "product" itself remains, but the attributes associated are removed. Permanently. They can be "added" back in only if the product is added with the associated attributes (costs and other characteristics), but an update from the current page (whether adjusting the attributes or not) plain removes attributes from all product whether the product was edited or not.

Seeing that little has/had changed in the base "direction" to remove and add product's to the order, my search led me to consider other "black boxes" with current review of the admin's attributes class because of the breadth of changes that were made between the current version and a version that I could readily identify as previously working (4.1.7). (I know a long time ago. :) ).