Jump to content

still having matrix issues


keat

Recommended Posts

I'm still getting orders where the matrix part code isn't being populated on some order confirmations.

Customer ordered half a dozen products,  some with matrix entries.. most of which worked.

But one product didn't pass the matrix product code across, the matrix was applied to this product on the 30th of June.

 

I can accept that maybe this product has been in his basket for 10 weeks or more (before the matrix change), so any thoughts on how I can fix this and force the correct code.

We are about to go live with a system that fully requires these matrix items to work.

Link to comment
Share on other sites

You can fix the immediate need to have a custom Product Name as part of the order details. In admin, Orders, bring the order up for editing.

On the Inventory tab, hover the mouse cursor over the product name and click once. There will then display a text entry field.

Enter whatever you want -- a specific Product Code, a different Product Name, whatever. Save.

However, as the Product Code is generally available to skin templates and email templates, I think the Product Name along with annotations of the chosen options is what is mostly used.

Have you made changes to the email templates to show the Product Code?

 

Link to comment
Share on other sites

I've not had to make any changes to the email templates, the matrix codes are being passed.

I'm pretty confident in sayimg that should I search other orders for this matrix prodcut code, it will have been passed, It's always passed when I try to recreate the issue.

My problem appears to be, occasionally some matrix codes are not passed, despite the matrix being populated.

So in this instance, 6 items were passed with the matrix prodcut code and 1 wasn't, even though the matrix for this product was populated about 10 weeks ago.
 

 

The only logical explanation I can come up with is that the customer added this product to his cart prior to me adding a matrix product code.

eg: The product could be a glove with an option for XL.

Prior to the matrix this would have been passed as GLV1, with a descriptive line stating XL.

But siince adding a matrix, this should now be passed as GLV1-XL.

 

If the customer has had GLV1 in his cached cart for weeks, how do I force an update to use the matrix.

Is this even possible. ??

Link to comment
Share on other sites

Looking more closely at the email template for Cart: Order Confirmation and Admin: Order Received, I find that the HTML content does not contain a placeholder (aka, macro) for the Product Code, however, the Plain Text content does.

When the admin prints an Order Summary (shipping list), there is a Product Code printed.

So, as you assert, our best guess is that when that item was placed in the basket, the best Product Code available - in this case, for the base product - was used.

My experiments show that opening the order for editing, Overview tab, check that the target line item has the desired product code. If not, try to simply Save & Reload.

If the product code did not change, then on the Inventory tab, change the option shown to any other available option. Save & Reload. Change the changed option back to the original option. Save & Reload.

Back on the Overview tab, verify that the target line item has the desired product code.

(Then have CubeCart clear its internal cache.)

Edited by bsmither
Link to comment
Share on other sites

Opening the overview tab and choose save/reload did update the product with the matrix code.

However,we take about 200 orders daily, so opening each and every order, just to check if the matrix was populated isn't practical.

I've been working with Noodleman on a project for the past few months, which is about to go live, if not this week then next.

This relies heavily on the matrix codes being correctly passed, so just about all human intervention will be off the cards.

Link to comment
Share on other sites

Its definately related to a chached basket.

I added a product with an option to my cart, then closed my browser.

Created a matrix for the option and saved the changes.

 

Going back and completing the order and the matrix code is not shown.

Link to comment
Share on other sites

"Opening each and every order, just to check if the matrix was populated isn't practical."

Your personal experiments could not reproduce an item's purchase that had the wrong product code -- provided the options matrix's product code was available at the time the item was put in the basket.

Therefore, we can assume that, from this point forward, an inventory item will always have such product codes entered before it is allowed to be purchased.

I did find that in the CubeCart_order_summary table, 'basket' column, the value becomes stale fairly soon. That is, changes a customer makes to an order after a certain point does not change this value, but I'm not sure when this happens. And any admin edits to the order does not change this value. (Admin edits to an order apparently fetches and changes the respective rows in CubeCart_order_inventory.)

 

Link to comment
Share on other sites

I'm slightly misunderstanding part of your reply.

"Your personal experiments could not reproduce an item's purchase that had the wrong product code -- provided the options matrix's product code was available at the time the item was put in the basket. "

 

If I add an item to the basket that doesn't yet contain a matrix entry, then go back and create a matrix entry, this matrix entry is never populated in the basket.

I can continue with the order and complete checkout as if the matrix entry doesn't exist.

The order is then sent to admin and the customer without the matrix entry.

When the order is complete, as an admin I can edit the order, don't make any chnages and just save, the product is then populated with the matrix, but by then it's too late, it's already been posted to admins with an incorrect product code.

 

Link to comment
Share on other sites

You said (post #3): "It's always passed when I try to recreate the issue."

Also, "If I add an item to the basket that doesn't yet contain a matrix entry, then go back and create a matrix entry, this matrix entry is never populated in the basket."

So, there exists the frequent scenario whereby a product has been made available for purchase, but has yet to have its Options Matrix table data fully populated (missing product codes). And that product has been put in shopping baskets, but the order has not yet been transacted.

Having looked at the sequence of events during checkout, I recall where all the products are 'verified'. I'll see if, during this verification of the contents, the product code is included.

Link to comment
Share on other sites

My communication isn't coming across cleanly.

 

If I add an item to my cart where a matrix already exists, then there are no issues, the matrix code is passed.

If I add an item to my cart where no matrix exists, the standard product code is passed.

All Good so far.

 

 

If I add an item to my cart which has no matrix code, then go back and modify the product and add a matrix to it.... this new matrix code isn't updated in the basket, so the order is passed with only the standard product code, just as it was when I added it to my cart initially.

When we first created the matrix 4 months ago, there were loads, I assumed that some form of refresh or the max_gc-sessions timeout would fix it, but 12 weeks on and some items are still filtering through.

Is there anything can be put in place which performs some form of refresh or basket delete, preferabbly on a basket older than say 4 weeks. (or any number of weeks post matrix build)

Edited by keat
Link to comment
Share on other sites

FYI: I now completely understand the nature of this scenario. I was able to reproduce it and have traced the code where the mistake is being made.

I am working on a solution: so that this doesn't happen in the future, and to create a 'fix-it' code snippet to solve all existing shopping baskets that suffer this situation.

 

 

Link to comment
Share on other sites

  • 1 month later...

We will create a code snippet.

When a customer logs in, CubeCart determines if that customer's "saved basket" should be reloaded into their "session". A "saved basket" is from the prior shopping visit where the customer has added items to their cart, then simply logged out (or the session expired). CubeCart maintains a "saved cart" for the customer automatically.

Note: In CubeCart's determination, if the visitor has already placed some items in their shopping cart before logging in, then the prior "saved cart" is abandoned in favor of the new cart's contents.

Just prior to loading the "saved cart" into the just-logged-in customer's "session", there is a hook we can use to have CubeCart scan through the databased "saved cart" and recalculate the "options identifier" of those products that have had options chosen. This will catch and correct those cases where the admin has added or changed the options of items that are incorporated into the Options Matrix Table after when customers have already placed those items in their shopping basket.

In admin, Manage Hooks, Code Snippets tab, click Add Snippet.

Below the list of existing snippets, fill in the form as follows:

Enabled: checked
Unique ID: calcOptionsIdent@CC640+
Execution Order: 5
Description: At login, will recalc options identifier code to align with currently chosen options.
Trigger: class.cart.construct.pre
Version: 1.0.0
Author: https://forums.cubecart.com/topic/58055-still-having-matrix-issues/
PHP Code:
<?php
if ($GLOBALS['user']->is() && ($saved_cart_result = $GLOBALS['db']->select('CubeCart_saved_cart', array('basket'), array('customer_id' => $GLOBALS['user']->getId()), false, false, false, false)) !== false) {
  $saved_cart_basket = unserialize($saved_cart_result[0]['basket']);
  foreach ($saved_cart_basket as $saved_basket_hash => $saved_basket_product_data) {
    if (!empty($saved_basket_product_data['options'])) { // Options are option_id => assign_id
      // Calculate new options_identifier. CubeCart deals with new 'cached_name' and 'cached_array'
      $new_saved_cart_basket[$saved_basket_hash]['options_identifier'] = $GLOBALS['catalogue']->defineOptionsIdentifier($saved_basket_product_data['options']);
    }
  }
  // Merge the recalc'd options_identifier into the saved_cart_basket and save.
  $GLOBALS['session']->set('contents', merge_array($saved_cart_basket,$new_saved_cart_basket), 'basket', true);
  $saved_cart_result[0]['basket'] = serialize(merge_array($saved_cart_basket,$new_saved_cart_basket));
  $GLOBALS['db']->update('CubeCart_saved_cart', array('basket' => $saved_cart_result[0]['basket']), array('customer_id' => $GLOBALS['user']->getId()));
  $this->load();
}

Save the snippet.

A "saved basket" for a customer is not available (as of CC647) for the admin to view directly.

However, CubeCart allows the admin to "login as" a customer, but still, full details of the products in that customer's basket are not shown - specifically, the item's Product Code as given in the Options Matrix Table, as well as the options identifier code.

There are about two ways to verify that the options identifier code has been added/updated.

1. In admin, Store Settings, Advanced tab, enable the Debug Mode and enter your local IP address in the next field (www.showmyip.com). View the storefront as the customer. At the bottom of the page, there will be one or two debug sections. The last section will have the Session:__basket['contents'] with each item's hash-key and details.

2. Look at the database directly, the CubeCart_saved_cart table for that customer_id.

Link to comment
Share on other sites

Before I implement this snippet, could you clarify the below statement.

"Note: In CubeCart's determination, if the visitor has already placed some items in their shopping cart before logging in, then the prior "saved cart" is abandoned in favor of the new cart's contents. "

 

Does this happen now ???, or would this happen after implementing the snippet.

Link to comment
Share on other sites

I applied the code snippet on Friday, my preliminary testing would indicate that it works.

I've had no reports of web site issues over the past few days, so it's now just a matter of monitoring over the coming weeks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...