24/7 Support - 800.608.6482

Miva Merchant Community Forums

Thread: Need to keep additional info related to items added to the basket

  1. #1
    Join Date
    Mar 2006
    Posts
    28

    Default Need to keep additional info related to items added to the basket

    I'm working on an upgrade from MM4.13 to MM5.5.

    Our current store has an application guide that allows the customer to choose products that fit their specific widget. We store the information about the customer's widget in a table that keeps the relation to the product in the basket table. We use this information to double check our application guide for errors as well as to show the customer that they got what they ordered.

    It was easy in MM4.13. All I had to do was hack db.mv to add or delete records from our table when the customer added or deleted items from the cart.

    I'm considering my options now that we're going compiled. I was going to use triggers on the BASK page to call external functions with toolkit, but then I decided to write a system extension module. The module will work fine except for one thing. How can I delete records from our associated table when the basket has timed out and is deleted by the system?

    Clear as mud?

    Thanks,
    Todd

  2. #2
    Join Date
    Jun 2009
    Posts
    747

    Default Re: Need to keep additional info related to items added to the basket

    Hey Todd -

    In PR8 update 6 there was a new API function added that allows you to tie into the "Delete Baskets" functionality in the admin. Whenever this is run it will also call your function which you can then cleanup and delete records from your table.


    See the cleanup_store function on page 32 of this PDF

    http://www.mivamerchant.com/apiguide

    I couldn't get the full picture from what you described but there may be a easier way to do what you need using custom fields and or cookies.
    Brennan Heyde
    VP Developer Relations
    Miva Merchant
    bheyde@mivamerchant.com
    http://www.mivamerchant.com

  3. #3
    Join Date
    Mar 2006
    Posts
    28

    Default Re: Need to keep additional info related to items added to the basket

    Hi Brennan. Thanks for the tip on the cleanup_store function.

    Sorry for the poor problem description. Here's the full disclosure of the problem.

    This is a site where the visitor usually has common household item and wants to buy parts or accessories for it. The customer will go to a category page, and we show them an application guide. They choose options that describe exactly what household item they have, and we show them which products will fit that item right on the category page. They can add those products to the cart without going to the individual product pages.

    Early on, we learned that customers don't always pay attention to what they're doing and make wrong selections, so we started showing them the household item that they chose for each line item in the cart.

    Currently, we do this by adding a record to our householditem-to-basketlineitem table when the customer adds something to their cart. The record is deleted when they remove the product from the cart or the basket has timed out. Again, that was accomplished by hacking db.mv.

    We have our own Miva Script order management system, so we move this information over to a householditem-to-orderlineitem table when the customer places the order. This allows us to show the customer their order history including the exact household item that they bought the product for on their account page.

    I'd be interested in alternative ideas to solve this problem.

    I'll also be the first one to admit that I'm green when it comes to writing MM modules, so I'm going to ask a basic question regarding the cleanup_store function. To add that functionality to my module, I'd add "cleanup_store" to my module's features list along with working function named "Module_Cleanup_Store". Is that correct?

    Thanks,
    Todd

  4. #4
    Join Date
    Mar 2006
    Location
    Kirkland, WA USA
    Posts
    179

    Default Re: Need to keep additional info related to items added to the basket

    Quote Originally Posted by TFo View Post
    I'll also be the first one to admit that I'm green when it comes to writing MM modules, so I'm going to ask a basic question regarding the cleanup_store function. To add that functionality to my module, I'd add "cleanup_store" to my module's features list along with working function named "Module_Cleanup_Store". Is that correct?

    Thanks,
    Todd
    Yes this is correct. Put the code you want to run in the Module_Cleanup_Store function.

  5. #5
    Join Date
    Mar 2006
    Posts
    28

    Default Re: Need to keep additional info related to items added to the basket

    Thanks for the assistance Gordon.

    For the record, I came to the conclusion yesterday that I'll need to make this project a log module rather than a system extension. It appears that the system extension module is called before the product is added to the basket items table.

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •