Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Make Change To Core Function Fn_Cart.php Rate Topic   - - - - -

 
  • Eskimo
  • Newbie
  • Trial users
  • Join Date: 20-Mar 18
  • 4 posts

Posted 20 March 2018 - 01:32 PM #1

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.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10551 posts

Posted 21 March 2018 - 01:42 AM #2

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.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • Eskimo
  • Newbie
  • Trial users
  • Join Date: 20-Mar 18
  • 4 posts

Posted 21 March 2018 - 09:07 AM #3

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.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10551 posts

Posted 21 March 2018 - 06:49 PM #4

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.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 22 March 2018 - 05:26 AM #5

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


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 10551 posts

Posted 22 March 2018 - 04:01 PM #6

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.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 23 March 2018 - 03:37 PM #7

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 :)


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Eskimo
  • Newbie
  • Trial users
  • Join Date: 20-Mar 18
  • 4 posts

Posted 26 March 2018 - 11:14 AM #8

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.

 


 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 17267 posts

Posted 26 March 2018 - 01:46 PM #9

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

 

http://forum.cs-cart...ble-in-database


GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.