Claudia M Posted March 9, 2021 Share Posted March 9, 2021 I noticed that when I create an order it does not apply the order weight as it does when a customer creates an order. Is there any way this can be done? Thanks in advance, Claudia Link to comment Share on other sites More sharing options...
havenswift-hosting Posted March 9, 2021 Share Posted March 9, 2021 Yes ! Use our Enhanced Order Entry plugin which fixes a lot of missing functionality and adds a huge amount more ! https://www.cubecart.com/extensions/plugins/enhanced-admin-order-entry Link to comment Share on other sites More sharing options...
Claudia M Posted March 9, 2021 Author Share Posted March 9, 2021 Thanks for showing that to me Ian but it has a lot more to it than I need. I just need the order weight for manually created orders. Link to comment Share on other sites More sharing options...
bsmither Posted March 9, 2021 Share Posted March 9, 2021 Please try this. It is a change to the template, so be careful when upgrading. In the admin skin template orders.index.php, near line 194, find: <div>{$LANG.basket.total_sub}:<span>{$OVERVIEW_SUMMARY.subtotal}</span></div> <div>{$LANG.basket.total_discount} {if !empty($OVERVIEW_SUMMARY.percent)}({$OVERVIEW_SUMMARY.percent}){/if}:<span>{$OVERVIEW_SUMMARY.discount}</span></div> Add after: <div>{$LANG.basket.weight}:<span>{$OVERVIEW_SUMMARY.weight} {$WEIGHT_UNIT}</span></div> Then, near line 398, find: </th> <td><input type="text" id="discount" name="summary[discount]" class="textbox number-right lineprice" value="{$SUMMARY.discount_form}"></td> <td><span id="discount_percent">{if $SUMMARY.discount_type == "p"}%{/if}</span></td> </tr> Add after: <tr> <th colspan="3">{$LANG.basket.weight}</th> <td><input type="text" id="weight" name="summary[weight]" class="textbox number-right shipping" value="{$SUMMARY.weight}"></td> <td>{$WEIGHT_UNIT}</td> </tr> Link to comment Share on other sites More sharing options...
havenswift-hosting Posted March 9, 2021 Share Posted March 9, 2021 8 minutes ago, bsmither said: Please try this. It is a change to the template Will be interesting to see if this works for newly created orders Link to comment Share on other sites More sharing options...
Claudia M Posted March 9, 2021 Author Share Posted March 9, 2021 I added the code then checked one of the orders I had previously created. The order weight did not show up. Link to comment Share on other sites More sharing options...
havenswift-hosting Posted March 9, 2021 Share Posted March 9, 2021 3 hours ago, Claudia M said: Thanks for showing that to me Ian but it has a lot more to it than I need 1) Does it matter if it adds more than you need if it satisfies your requirement 2) Many of the additional functional additions are useful to most store owners, so while they are extra to your request, they will be useful to most stores taking manual orders Link to comment Share on other sites More sharing options...
Claudia M Posted March 10, 2021 Author Share Posted March 10, 2021 I have been able to add the product weight per each item in the order in the Special Data tab I created in the order. I guess I just need to add the weights together to get a total if there are more than one item in an order, but I don't know how to do that. My weights are like 1.900 or .210 etc. I did it this way for the AIOS plugin. Here's the custom code I use: {foreach from=$PRODUCTS item=product} <div class="item"> {$product.name} -- <strong>{$product.quantity} x {$product.excel_name}</strong> - {$product.product_code} {$product.line} / <span>{$product.price_total}</span> <strong>Cost: </strong><span>{$product.cost_price}</span> <strong>Product Weight: </strong><span>{$product.product_weight}</span> </div> {/foreach} Link to comment Share on other sites More sharing options...
bsmither Posted March 10, 2021 Share Posted March 10, 2021 When you say the order weight did not show up, did the phrase Basket Weight appear, but the weight value to display was empty? Or did nothing at all new show up on the Overview tab after the Total Discount line, and nothing new at all show up on the Inventory tab after the Discount text entry field? Here is a test. In the admin template orders.index.php, at the end of the file, add {debug}. Then request the page to view an order. There should now be a pop-up window showing all the Smarty variables. Scroll to $OVERVIEW_SUMMARY and determine if there is an array element named weight. Then scroll to $SUMMARY and determine if there is an array element named weight. On a Create Order, the Inventory tab has a text entry field for the form element summary[weight]. All of $_POST['summary'] is processed near line 174 in orders.index.inc.php where processed customer data, $_POST['summary'], and other pre-processed elements are blended into $record. A few lines later, $record is either inserted as a new database record, or updates an existing database record. Link to comment Share on other sites More sharing options...
bsmither Posted March 10, 2021 Share Posted March 10, 2021 The following needs a change. From: <tr> <th colspan="3">{$LANG.basket.weight}</th> <td><input type="text" id="weight" name="summary[weight]" class="textbox number-right shipping" value="{$SUMMARY.weight}"></td> <td>{$WEIGHT_UNIT}</td> </tr> To: <tr> <th colspan="3">{$LANG.basket.weight}</th> <td><input type="text" id="weight" name="summary[weight]" class="textbox number-right" value="{$SUMMARY.weight}"></td> <td>{$WEIGHT_UNIT}</td> </tr> The difference is that the text input field for the weight needs to have shipping removed from the list of class names. Leaving it in might interfere with recalculating the tax on shipping charges. Link to comment Share on other sites More sharing options...
Claudia M Posted March 10, 2021 Author Share Posted March 10, 2021 The Basket Weight language showed but there is nothing in the field. I did the debug but couldn't find the sections you referenced. I'll try your new code Is there any way I can just add the products weight together if there is more than one item in the order - based on my custom code above Link to comment Share on other sites More sharing options...
bsmither Posted March 10, 2021 Share Posted March 10, 2021 Is this an order that the customer created, or one that you created -- and thus want to have a means of entering an admin-calculated weight? In stock code, obviously, the product's weight is not brought to the form as it is not recorded in CubeCart_order_inventory, nor is it fetched from CubeCart_inventory (possibly affected anyway by any product options that affect the weight). So, from what you say, you have brought the weight of the order item into this form. So, yes, using the same technique of having javascript automatically update the Subtotal and Total fields when any of related fields change, there could be a way to see the weight values in your custom fields and use them to update the overall Basket Weight text field. Link to comment Share on other sites More sharing options...
Claudia M Posted March 10, 2021 Author Share Posted March 10, 2021 "Is this an order that the customer created, or one that you created -- and thus want to have a means of entering an admin-calculated weight?" Either a customer or admin created order "In stock code, obviously, the product's weight is not brought to the form as it is not recorded in CubeCart_order_inventory, nor is it fetched from CubeCart_inventory (possibly affected anyway by any product options that affect the weight)." You had helped me have "excel-name" that I used in the product available in the order. I used the same principal to have the product weight available in the order "So, from what you say, you have brought the weight of the order item into this form." Yes "So, yes, using the same technique of having javascript automatically update the Subtotal and Total fields when any of related fields change, there could be a way to see the weight values in your custom fields and use them to update the overall Basket Weight text field." The basket weight shows correctly for customer created orders. I need it to show for admin created orders. ADMIN CREATED ORDER - Note the order weight does not show. Can Cubecart add the 3 Product Weight together to create the Order Weight? I can create a new database field for it if need be CUSTOMER CREATED ORDER - Note the order weight shows Link to comment Share on other sites More sharing options...
bsmither Posted March 10, 2021 Share Posted March 10, 2021 Please check something: Using an external database utility, view the records of CubeCart_order_summary. Is there a column named weight? Link to comment Share on other sites More sharing options...
Claudia M Posted March 10, 2021 Author Share Posted March 10, 2021 Yes there is a column for weight. I didn't show all of my custom code for the entire fieldset <fieldset > <legend class="green greenlight">Items Information</legend> {foreach from=$PRODUCTS item=product} <div class="item"> {$product.name} -- <strong>{$product.quantity} x {$product.excel_name}</strong> - {$product.product_code} {$product.line} / <span>{$product.price_total}</span> <strong>Cost: </strong><span>{$product.cost_price}</span> <strong>Product Weight: </strong><span>{$product.product_weight}</span> </div> {/foreach} <div> <label for="order_wgt"><strong>Order Weight: </strong> </label>{$SUMMARY.weight} </div> </fieldset> Link to comment Share on other sites More sharing options...
bsmither Posted March 10, 2021 Share Posted March 10, 2021 For the order that you viewed, that didn't show a value for the newly added Basket Weight code, was there a value in the weight column when examining that order using the database utility? I am also concerned you didn't find $OVERVIEW_SUMMARY and $SUMMARY in the Smarty debug popup. Well, I see that your custom code is using {$SUMMARY.weight}. So, why does it not show where the newly added code is at? Link to comment Share on other sites More sharing options...
Claudia M Posted March 10, 2021 Author Share Posted March 10, 2021 "Well, I see that your custom code is using {$SUMMARY.weight}. So, why does it not show where the newly added code is at? " That's what I'm asking. It doesn't show when I create the order I'll check th {debug} again Link to comment Share on other sites More sharing options...
bsmither Posted March 10, 2021 Share Posted March 10, 2021 I think that is the reason why you wanted this edit -- to be able to enter a weight on orders that you create. So, on the Inventory tab, there is a text entry field where you can manually enter the weight. Link to comment Share on other sites More sharing options...
Claudia M Posted March 10, 2021 Author Share Posted March 10, 2021 Yes I saw that. But if I have a bunch of items in the order, at different weights, I'd have to use a calculator to total it up. I was just wondering if there was a way to automate this like with the customer created orders Link to comment Share on other sites More sharing options...
Dirty Butter Posted March 10, 2021 Share Posted March 10, 2021 My solution to the weight and sales tax issues with admin created orders is to make them by logging in as the customer and creating the order that way. Link to comment Share on other sites More sharing options...
Claudia M Posted March 10, 2021 Author Share Posted March 10, 2021 I never thought of that. What a great idea! Thank you Boo ... That doesn't work for me. Mine are for Etsy and Ebay sales and there is no gateway for them and I wouldn't want them to process thru my store anyway. This is all for information purposes only. I think the way I'm doing it will work just fine. Link to comment Share on other sites More sharing options...
bsmither Posted March 10, 2021 Share Posted March 10, 2021 I also see that your custom code above is using {$product.product_weight}. What other code did you use to add the weight to the product data to be sent to the admin View Order. A hard edit or a code snippet? Link to comment Share on other sites More sharing options...
Claudia M Posted March 10, 2021 Author Share Posted March 10, 2021 just the product_weight though excel_name was added the same way. Oh and I made sure the Inventory and Order Summary databases both had these columns. (I think thats what they are called) In the file order.index.inc.php, near line 325, find: foreach ($inventory as $product) { On a new blank line after that, add: if ( empty($product['excel_name']) ) { $product_excel_name_record = $GLOBALS['db']->select('CubeCart_inventory','excel_name',array('product_id' => $product['product_id'])); $product['excel_name'] = $product_excel_name_record[0]['excel_name']; } And then you gave me this, but for some reason I'm not using it or the code snippet and everything works. And instead of using a code snippet can I change a file? The code snippet I just sent? Sure. In /classes/order.class.php, near line 1308, find: $record = array( On a new blank line after that, add: 'excel_name' => $product['excel_name'], Link to comment Share on other sites More sharing options...
bsmither Posted March 11, 2021 Share Posted March 11, 2021 Ok. The hard edit to get the 'excel_name' from the CubeCart_inventory table. Probably also did a hard edit to get the item's 'product_weight' from the Inventory table as well. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.