Make Change To Core Function Fn_Cart.php

Hi,

I have had to make a change to the core function, fn_cart.php. I have made a change to fn_checkout_update_steps. I am now looking to make the change to this function using a hook or an override in an addon but fn_checkout_update_steps does not have a hook and I am a noob to this so not sure how to achieve this. Any help would be appreciated.

Kind Regards,

Jason.

Please describe the problem you're trying to solve, Your statement is confusing. Strongly suggest you not modify core files. At this point, there is very little that can't be addressed by hooks.

If you tell us your problem (rather than your solution) we might be able to better advise you.

Hi,

Thank you for your reply. I have added a input box in the checkout section where a customer can add extra details for there order if they want to. I cannot use comments as I need more specific information from our customers relating to their trade. I have made the change to step 3, which is shipping I believe. I have created overrides for the input box in shipping_rates.tpl and also to invoice.tpl to email the extra information to the customer that they have added but when it comes to saving the data in the database I could only find the fn_cart.php core function to save the data. Sorry for waffling on :-) I guess I am trying to save the extra data from the textbox in my checkout to the database. I am a noob to coding with cs cart and any help would be appreciated.

Kind Regards,

Jason.

Why don't you use a production addon like our EZ Checkout Summary Fields addon which does all of that for you? You can specify the header text, type of input (checkbox, radio buttons, selectbox, input text, etc); as well as any modifiers that might apply (like Giftwrap checkbox with a $5.00 add to the order). No reason to reinvent the wheel and you could learn from that code. You certainly don't need to use any overrides for that activity.

You have two choices for saving the data. You can save it as an "additional fields" where the data is stored in the cscart_order_data table based on a 'type' value. Or you can add a field to the cscart_orders table. If your info is large or complicated (or multiple entries) you should use the additional fields method. If you data is simple like a binary or scaler value then you could extend the cscart_orders table.

You can update cart content in the checkout.pre.php controller. Isn't it?

You can update cart content in the checkout.pre.php controller. Isn't it?

There are a ton of ways to update cart content (or prices). My point was why not use an addon that was developed for that purpose rather than reinventing the wheel. But since we don't know exactly what problem he is trying to solve, it's hard to give him a well directed answer.

There are a ton of ways to update cart content (or prices). My point was why not use an addon that was developed for that purpose rather than reinventing the wheel. But since we don't know exactly what problem he is trying to solve, it's hard to give him a well directed answer.

The problem is simple and described in another ticket. He need to add new value to cart array similar to customer notes. So I vote for pre controller :)

The problem is simple and described in another ticket. He need to add new value to cart array similar to customer notes. So I vote for pre controller :)

Thank you for your reply. Please can you send a link to the other ticket so I can see how it is done.

Kind Regards,

Jason.

Sorry, looks I mixed you up with another customer with similar request

http://forum.cs-cart.com/topic/51698-how-to-add-custom-order-fields-to-orders-table-in-database