Re: Just another Cross-Sell mod (support thread)
Quote:
ERROR: Can not insert configuration_key "", it already existsNote: 1 statements ignored. See "upgrade_exceptions" table for additional details.
Seen this before with similar sql, but never found the cause (I think it's some weird sql patch tool issue). But, assuming the sql is correct (and that seems the case here), loading the sql via phpMyAdmin works perfectly in these cases. note that the DB prefix, if any, needs to be added to the table names manually then.
Re: Just another Cross-Sell mod (support thread)
normaly import through phpMyAdmin or with the console or how? Thank U.
Re: Just another Cross-Sell mod (support thread)
The patch is designed to be run on zencart admin->tools-> install sql patches.
Id you ecounter this error while using zencat's tool, try on phpmyadmin, but you need to append zencart table's prefix.
Re: Just another Cross-Sell mod (support thread)
Hi Yellow,
using Alpha 1 rev 39 (I think) and the option "And Cross sell 1 way only?" I got the error which shows: CROSS_SELL_NO_MAIN_FOUND (I did not upload the language file yet, but that's no problem).
I fixed it like this:
Code:
if ($_POST['cross_sell_one_way'] == 1)
if(count($product_id_array)>0){
$_POST['main_product_id'] = zen_db_prepare_input($_POST['product_id'][0]);
if(empty($_POST['main_product_id']))
$messageStack->add(CROSS_SELL_NO_MAIN_FOUND, 'error');
else
foreach ($product_id_array as $id => $pid)
if($id > 0){
add_new_cross_product($_POST['main_product_id'], $pid);
}
}
Not sure if that's how you would want to fix it, but it indicates where the problem is. The "if($id > 0)" part I added because the main product was cross selled to itself after only adding the first fix. (it looks like the actual problem is that 'main_product_id' is not posted by the form)
hth
Re: Just another Cross-Sell mod (support thread)
And I have another feature request :smartalec:
The original cross sell advanced I modified so that when you clicked on edit the cross sell, it would display under "New Cross-Sells", and it would allow you to edit the master (and the other products too if you like). That way it was very easy to copy existing cross sells.
Do you think it would be a nice feature for your version too?
Re: Just another Cross-Sell mod (support thread)
Yeah, I was fixing the codes and forgot about it totally. I'll get it fixed tonite since I have too many things to do now.
Regards
PS: send me the codes of your feature and I'll put it in the next release as well.
1 Attachment(s)
Re: Just another Cross-Sell mod (support thread)
I attached a zip to this post that includes the original and my version. It's just a few edits which are clearly commented (like // BOF copy cross sells). If you compare the two files the differences will be very clear I think. The zip also includes a screenshot.
Off course it's a little different with your version because the form has changed.
Great work so far! :thumbsup:
Re: Just another Cross-Sell mod (support thread)
Thanks paulm. One of my goals is to move all the logic functions out to a separate file, and leave the html alone, that would make it easier for others to work on this mod later.
1 Attachment(s)
Re: Just another Cross-Sell mod (support thread)
Paulm,
I really don't know which version you are using, probably rev 39.
Here is the problem with your fix:
$_POST['main_product_id'] = zen_db_prepare_input($_POST['product_id'][0]);
This is just wrong, when you check the box "Cross sell 1 way only?", a new input field will be added on top of all other fields with the name main_product_id!!!
Quote:
Originally Posted by
paulm
Hi Yellow,
using Alpha 1 rev 39 (I think) and the option "And Cross sell 1 way only?" I got the error which shows: CROSS_SELL_NO_MAIN_FOUND (I did not upload the language file yet, but that's no problem).
I fixed it like this:
Code:
if ($_POST['cross_sell_one_way'] == 1)
if(count($product_id_array)>0){
$_POST['main_product_id'] = zen_db_prepare_input($_POST['product_id'][0]);
if(empty($_POST['main_product_id']))
$messageStack->add(CROSS_SELL_NO_MAIN_FOUND, 'error');
else
foreach ($product_id_array as $id => $pid)
if($id > 0){
add_new_cross_product($_POST['main_product_id'], $pid);
}
}
Not sure if that's how you would want to fix it, but it indicates where the problem is. The "if($id > 0)" part I added because the main product was cross selled to itself after only adding the first fix. (it looks like the actual problem is that 'main_product_id' is not posted by the form)
hth
Re: Just another Cross-Sell mod (support thread)
Hi Yelllow,
Quote:
This is just wrong, when you check the box "Cross sell 1 way only?", a new input field will be added on top of all other fields with the name main_product_id!!!
wrong indeed, if the javascript loads.... but it didn't because I put the js/ folder in the wrong place :blush::blush:
Highly unusual though that it needs to be copied to the webroot. I would suggest to move it to some folder relative to the shop. Is there a special reason why it's not in the includes/javascript/ folder?