Values Of Combination_Hash

Hi all,

Which values are used to create the ‘combination_hash’ ? (found in the product_options_inventory table in the database)

I know how to call the function so that is working well but I get the wrong output.

So I -desperately- need the values which are used to create the hash value.

I thought it is the product_id value (like ‘56’ ) and the combination value (like ‘56_1’ ) but I’m clearly missing something becauses it doesn’t output the same value as if it is done through the administration panel.

I’ve found some older topics in relation to this but unfortunately no answers :( .

Other topics:

combination_hash how to create? - General Questions - CS-Cart Forums

What is combination_hash in the DB? - General Questions - CS-Cart Forums

Hope somebody knows beacause this is the bit of the puzzle for me what is missing for getting my site live…

Thanx in advance, Mirco

From fn.cart.php:

$cart_id = fn_generate_cart_id($product_id, array('product_options' => $product_options), true);
$product = db_get_row("SELECT amount, product_code FROM ?:product_options_inventory WHERE combination_hash = ?i", $cart_id);

So it's a hash of the product_id and whatever the option combination is for that product.

Hi, thank you. Product id should be straight forward.

How do you think this option combination should look like? please give an example…

o by the way, I think the wright code is:

$combination_hash = fn_generate_cart_id($_REQUEST['product_id'], array('product_options' => $_REQUEST['add_options_combination'][$k]));

found in controllers/backend/product_options.php

Both examples are from the code. They just pass different variables to the function based on the context of the caller.

I've given you pointers to the code. You'll have to do your own research for the specifics. But it's a pretty generic function. Give it a product_id and an array of the option combination elements and it returns you an md5 hash of the result.

Hi, again thank you for pointing this one out.

Finally found it.

Staring to long at this piece of code made me overlook => this is a multidimensional array to put in otherwise you get the wrong results.

Now it is working!!!

Again thank you for taking the time to help the beginners like me :-)