Zen Cart Logo
Forums / All Other Contributions/Addons / Just another Cross-Sell mod (support thread)

Just another Cross-Sell mod (support thread)

Views: 133,957

Results 41 to 60 of 704
3 Sep 2007, 10:58 AM
#41
nickster4321 avatar

nickster4321

New Zenner

Join Date:
Jul 2007
Posts:
5
Plugin Contributions:
0

Just another Cross-Sell mod (support thread)

Hi,

I downloaded the original cross sell a while back and never managed to get it working. I didn't have a chance to post anything about it. Basically my error is that when cross sell is enabled and I have set some products up to link. How ever when I go the the product that is being cross sold at the bottom it says "we also recommend" but then there are NO products showing below that.
I installed your version as your installation guide advised, keeping the original version etc. And have set some products up again and still I get the same. The title displays at the bottom but still no products.

I'm wondering if you have come across this issue before and know how to solve it? I have checked the MySQL Database and it appears to be writting info to it no problems, so I am a little stuck.

Thanks in advance

3 Sep 2007, 2:06 PM
#42
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

I believe in the original CrossSell mod you need to add certain files into "includes", and edit some other files. Check to make sure that you have it set correctly.

Then in you admin->configuration->cross-sell check this:
You will see that you have 2 settings with the same name "Display Cross-Sell Products" (I should have changed those names, in fact I will do in the next version)
The first "Display Cross-Sell Products" is the minimum number of products required to display cross-sell, make sure you set this to 1

The second is the maximum number, set it to whatever you want (i.e: 8)

4 Sep 2007, 3:28 AM
#43
voltage avatar

voltage

Totally Zenned

Join Date:
Apr 2005
Location:
Houston, TX
Posts:
1,356
Plugin Contributions:
1

Re: Just another Cross-Sell mod (support thread)

I know others have had this question before, but I couldn't find the answer. Lets say I have a max display of 6 xsell items, but I actually assign a larger number, 10 for example. It appears that it xsell will only show the first 6 and not randomly show the 10. Has anyone came up with a solution for this? Or am I doing something wrong.

Thanks

4 Sep 2007, 3:37 AM
#44
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

I don't have access to my server now, but it should be something like this:

Edit includes/modules/your_template/xsell_products.php

Replace:

$xsell_query = $db->Execute("select distinct p.products_id, p.products_image, pd.products_name
                                 from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                                 where xp.products_id = '" . $_GET['products_id'] . "'
                                  and xp.xsell_id = p.products_id
                                  and p.products_id = pd.products_id
                                  and pd.language_id = '" . $_SESSION['languages_id'] . "'
                                  and p.products_status = 1
                                 order by xp.sort_order asc limit " . MAX_DISPLAY_XSELL);
  $num_products_xsell = $xsell_query->RecordCount();

By:

$xsell_query = $db->Execute("select distinct p.products_id, p.products_image, pd.products_name
                                 from " . TABLE_PRODUCTS_XSELL . " xp, " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                                 where xp.products_id = '" . $_GET['products_id'] . "'
                                  and xp.xsell_id = p.products_id
                                  and p.products_id = pd.products_id
                                  and pd.language_id = '" . $_SESSION['languages_id'] . "'
                                  and p.products_status = 1
                                 order by RANDOM(), xp.sort_order asc limit " . MAX_DISPLAY_XSELL);
  $num_products_xsell = $xsell_query->RecordCount();

What I did is that I added the order by random() into the sql query.

4 Sep 2007, 3:51 AM
#45
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

Oops, huge mistake, should be rand() instead of random(). Sorryyyy

4 Sep 2007, 4:04 AM
#46
voltage avatar

voltage

Totally Zenned

Join Date:
Apr 2005
Location:
Houston, TX
Posts:
1,356
Plugin Contributions:
1

Re: Just another Cross-Sell mod (support thread)

...........................

4 Sep 2007, 4:42 AM
#47
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

Ok, my site is back up so I have the chance to test the query. It works. So you should see the effect you expected.

5 Sep 2007, 11:40 AM
#48
tekkjeskj avatar

tekkjeskj

New Zenner

Join Date:
Sep 2006
Posts:
8
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

Hi!
I get some error when i use, Add Product Field Button. I get "error on the site" in the status field. And when I use the new funksion "Cross sell 1 way only" i get the message "Please input main product's model" what have gone wrong.

Regards
Kjetil:wacko:

5 Sep 2007, 1:21 PM
#49
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

It'd be great if you can provide a screenshot.

6 Sep 2007, 10:58 AM
#50
miweb avatar

miweb

New Zenner

Join Date:
Jul 2007
Posts:
31
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

10 statements processed. ERROR: Can not insert configuration_key "", it already existsNote: 1 statements ignored. See "upgrade_exceptions" table for additional details.

..it doesnt work to me....I have cross sell and advanced too. What I did wrong. It happend when I insert your sql script

SET @t4=0;
SELECT (@t4:=configuration_group_id) as t4
FROM configuration_group
WHERE configuration_group_title= 'Cross Sell';
DELETE FROM configuration WHERE configuration_group_id = @t4;
DELETE FROM configuration_group WHERE configuration_group_id = @t4;

INSERT INTO configuration_group VALUES ('', 'Cross Sell', 'Set Cross Sell Options', '1', '1');
UPDATE configuration_group SET sort_order = last_insert_id() WHERE configuration_group_id = last_insert_id();

SET @t4=0;
SELECT (@t4:=configuration_group_id) as t4
FROM configuration_group
WHERE configuration_group_title= 'Cross Sell';

UPDATE configuration SET configuration_group_id = @t4 WHERE configuration_key IN ('MIN_DISPLAY_XSELL','MAX_DISPLAY_XSELL','SHOW_PRODUCT_INFO_COLUMNS_XSELL_PRODUCTS','XSELL_DISPLAY_PRICE');

INSERT INTO configuration (configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function) VALUES
('', 'Input type to be used in form', 'XSELL_FORM_INPUT_TYPE', 'model', 'Choose to use product ID or MODEL as your input type. Check readme file for more info', @t4, 1, NOW(), NOW(), NULL, 'zen_cfg_select_option(array(''id'', ''model''),');

6 Sep 2007, 11:56 AM
#51
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

If you host your image on your localhost then there is no way I can access it.

6 Sep 2007, 12:23 PM
#52
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Just another Cross-Sell mod (support thread)

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.

6 Sep 2007, 12:32 PM
#53
miweb avatar

miweb

New Zenner

Join Date:
Jul 2007
Posts:
31
Plugin Contributions:
0

Re: Just another Cross-Sell mod (support thread)

normaly import through phpMyAdmin or with the console or how? Thank U.

6 Sep 2007, 1:15 PM
#54
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

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.

6 Sep 2007, 2:03 PM
#55
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

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:

    if ($_POST['cross_sell_one_way'] == 1)
      if(count($product_id_array)>0){
        $_POST['main_product_id'] = zen_db_prepare_input([B]$_POST['product_id'][0][/B]);
        if(empty($_POST['main_product_id']))
          $messageStack->add(CROSS_SELL_NO_MAIN_FOUND, 'error');
        else
          foreach ($product_id_array as $id => $pid)
            [B]if($id > 0){[/B]
              add_new_cross_product($_POST['main_product_id'], $pid);
            [B]}[/B]
      }

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

6 Sep 2007, 2:09 PM
#56
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

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?

6 Sep 2007, 5:12 PM
#57
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

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.

6 Sep 2007, 6:27 PM
#58
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

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:

6 Sep 2007, 9:51 PM
#59
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

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.

6 Sep 2007, 11:52 PM
#60
yellow1912 avatar

yellow1912

Totally Zenned

Join Date:
Oct 2006
Posts:
5,422
Plugin Contributions:
0

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

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:

if ($_POST['cross_sell_one_way'] == 1)
  if(count($product_id_array)>0){
    $_POST['main_product_id'] = zen_db_prepare_input([B]$_POST['product_id'][0][/B]);
    if(empty($_POST['main_product_id']))
      $messageStack->add(CROSS_SELL_NO_MAIN_FOUND, 'error');
    else
      foreach ($product_id_array as $id => $pid)
        [B]if($id > 0){[/B]
          add_new_cross_product($_POST['main_product_id'], $pid);
        [B]}[/B]
  }
> 
> hth