Jump to content

Digital Download Database Table


Recommended Posts

I need someone to report on the arrangement of data in the CubeCart_downloads table.


Specifically, I need this scenario:

  • An order was placed with a digital download item in a CC4 store (make note of the cart_order_id)
  • The CC4 store was upgraded to CC5
  • That downloadable item still exists in CC5's Cubecart_downloads table (scan for the cart_order_id)

The exact question is: When examining the contents of the CubeCart_downloads table, at the record that has that digital item, is there a value in the 'order_inv_id' column?

Link to comment
Share on other sites

From what I can see `order_inv_id` is relied on heavily in v5 and not present in v4. I don't see any code in the upgrade to give values to this column which means (I expect) that digital downloads after upgrade will fail in v5 from v4. 


I haven't seen this come up before as I think most store owners have the donwload link set for a few days only and most customers would download it instantly. There may be resultant issues with resetting downloads etc so this is likely to cause problems. 


I think some code is going to be needed during upgrade to try and populate that column. 

Link to comment
Share on other sites

I have a patch that will add a tab to Maintenance, which will list the records needing repair and code to do the repair, but I need to know the exact (wrong) value that is in this column.


The patch, as it is currently coded, looks for null in that column. But as that column is an UNSIGNED INT NOT NULL with no default, I'm fairly certain the result from the upgrade will have a zero (for a not strict-mode database).


But I would like to know for sure.

Link to comment
Share on other sites

Well it needs to have the value of the corresponding line item from the order_inventory table. I suppose this can be done by searching against the product name although this won't work if the name has changed over time or if there are more than one product with the same name. I can't think of a better way to do this than that. 


I hope I understood you correctly. 

Link to comment
Share on other sites

Something got lost in the translation.


I need to know the exact (wrong) value that is in the 'order_inv_id'  column for a digital download that was sold when the database was at the CC4 schema, then the database was updated to the CC5 schema.


As you pointed out, there is no explicit action (during upgrade) that puts a value in this new column.


But that column will end up having something in it! I need to know what - exactly.


My patch relies on that something being a null. But that's just a guess. Using that guess of null, my patch updates only those records (not the entire recordset) by finding the appropriate value and updating the record.


The relevant query is:

select('CubeCart_order_inventory', array('id'), array('cart_order_id' => $to_be_repaired['cart_order_id'],'product_id' => $to_be_repaired['product_id']));


Unless there exists the possibility of more than one "same item" digital product in an order (different options???), the cart_order_id - product_id combo should suffice.

Link to comment
Share on other sites

You should now, if testing hasn't already found it, the query needs fixing.



$GLOBALS['main']->addTabControl("Special 2", 'special2');
$database_download_repairs = $GLOBALS['db']->select('CubeCart_downloads', array('digital_id','cart_order_id','product_id'), array('order_inv_id' => "NULL") );

Change to:

$GLOBALS['main']->addTabControl("Special 2", 'special2');
$database_download_repairs = $GLOBALS['db']->select('CubeCart_downloads', array('digital_id','cart_order_id','product_id'), array('order_inv_id' => 0) );


Link to comment
Share on other sites

And another technical edit. Change:

$download_repaired = $GLOBALS['db']->update('CubeCart_downloads', array('order_inv_id' => $database_order_inventory_id[0]), array('digital_id' => $repair['digital_id']));
$download_repaired = $GLOBALS['db']->update('CubeCart_downloads', array('order_inv_id' => $database_order_inventory_id[0]['id']), array('digital_id' => $repair['digital_id']));
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.

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...