Jump to content

Create Order


Claudia M

Recommended Posts

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}&nbsp;{$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

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

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} &nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;<strong>{$product.quantity} &nbsp;x&nbsp; {$product.excel_name}</strong> - {$product.product_code}&nbsp;&nbsp;{$product.line}&nbsp;/&nbsp;<span>{$product.price_total}</span>&nbsp;&nbsp;<strong>Cost:&nbsp;</strong><span>{$product.cost_price}</span>  &nbsp;&nbsp;&nbsp;&nbsp;<strong>Product Weight:&nbsp;</strong><span>{$product.product_weight}</span>     </div>
{/foreach}

 

Link to comment
Share on other sites

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

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

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

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

"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

1952052434_AdminCreatedOrder.thumb.PNG.3df0819e4c894f44e602dd1dc01395eb.PNG

 

CUSTOMER CREATED ORDER - Note the order weight shows

877195970_CustomerCreatedOrder.thumb.PNG.7530b4427653fb2dc54fc36b70462ac7.PNG

Link to comment
Share on other sites

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} &nbsp;&nbsp;&nbsp;&nbsp;--&nbsp;&nbsp;&nbsp;&nbsp;<strong>{$product.quantity} &nbsp;x&nbsp; {$product.excel_name}</strong> - {$product.product_code}&nbsp;&nbsp;{$product.line}&nbsp;/&nbsp;<span>{$product.price_total}</span>&nbsp;&nbsp;<strong>Cost:&nbsp;</strong><span>{$product.cost_price}</span>
            &nbsp;&nbsp;&nbsp;&nbsp;<strong>Product Weight:&nbsp;</strong><span>{$product.product_weight}</span>
    </div>
{/foreach}
<div>    <label for="order_wgt"><strong>Order Weight:&nbsp;</strong> </label>{$SUMMARY.weight} </div> </fieldset>

 

Link to comment
Share on other sites

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

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

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...