Jump to content
Sign in to follow this  
saletco

Buy_Two_Module

Recommended Posts

Hi Peter

 

well, did you recognize that it breaks as soon as you display the "customers also purchased..." module?

 

As long as this module is not activated it displays fine.

 

The thing with the MS1 : there are some points - here in the forum there are some instructions how to adapt it. Just use the search...

 

 

you had trouble with 1.7? do you remember the missing table?

 

BTW nice site.

 

regards

kai

Share this post


Link to post
Share on other sites

Hi Kai,

 

well, did you recognize that it breaks as soon as you display the "customers also purchased..." module?

 

As long as this module is not activated it displays fine.

 

Thanks for pointing that out. As per step 8c from Buy_Two_Module_Install.HTML of V1.06b, the following lines are in product_info.php

 

<?php
   // Total-Inn Buy_two_module (2155) begin
   // BOF: This is the buy_two_module and if there is a wording in the beginning of the produkt model text then
   // this will not appear because it makes no sense to bundle a bundle and so on...
   if (BUY_TWO_YES_NO == 'yes') {

      if (ereg('^'.BUY_TWO_BUNDLE_MODEL_NAMING.'_', $product_info['products_model'])) {
         //        echo 'TEST this is a bundle';
      } else {
         include(DIR_WS_MODULES . 'buy_two_module.php');
      }
   } else {
   
   }
   // buy_two_module EOF
   // Total-Inn Buy_two_module (2155) end

   if ( (USE_CACHE == 'true') && !defined('SID')) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
 }
?>
       </td>
     </tr>
   </table></form></td>
<!-- body_text_eof //-->

 

you had trouble with 1.7? do you remember the missing table?

 

I don't have access to _that_ computer at present, but from memory, it was the 'X-Sell' table. From memory again (which isn't good sometimes), the code tried a query on the table, before it checked whether the option was set from admin (I think).

 

Thanks,

 

Peter

Share this post


Link to post
Share on other sites

Hi,

 

Just d/loaded v1.07 and found the lines of code, lines 60 to 67 of /catalog for xsell/includes/modules/buy_two_module.php

 

//XSELL is active and holds products?
$xsell_query_one = tep_db_query("select distinct x.xsell_id from ". TABLE_PRODUCTS_XSELL ." x, ". TABLE_PRODUCTS ." p where x.products_id = '" . $main_page_product['products_id'] . "' and p.products_status='1' and p.products_tax_class_id='". $main_page_product['products_tax_class_id'] ."'");
$num_products_xsell = tep_db_num_rows($xsell_query_one);
if ((XSELLYESNO=='yes') && ($num_products_xsell>0)) {

$btpq ="select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price, p.manufacturers_id from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, ".TABLE_PRODUCTS_XSELL." x where p.products_id=x.xsell_id and p.products_status = '1' and p.products_id!='" . $HTTP_GET_VARS['products_id'] . "' and p.products_tax_class_id='". $main_page_product['products_tax_class_id'] ."' order by rand($mtm) DESC limit 1";

} else {

 

Notice the qry is done before checking whether xsell is set or not. However, the actual message (from memory agin ?? ) was that the table not found had this in the string:

 

TABLE_PRODUCTS_XSELL

 

therefore the define is missing, is that correct ?

 

Peter

Share this post


Link to post
Share on other sites

Hi Kai,

 

well, did you recognize that it breaks as soon as you display the "customers also purchased..." module?

 

As long as this module is not activated it displays fine.

 

Yes, but this works ...............

 

http://www.candlesofeden.com/shop/product_.../products_id/27

 

and doesn't work for:

 

http://www.candlesofeden.com/test/product_.../products_id/27

 

but I would have to have the data the same, to narrow the cause down a bit more.

 

Thanks,

 

Peter

Share this post


Link to post
Share on other sites

Hi,

 

For both products 22 (displays ok) and 27 (doesn't display ok), the form 'buy_tinn' on product_info.php, has no fields ??

 

Is that correct ?

 

Peter

Share this post


Link to post
Share on other sites

hi peter

 

it is always better to see the code ;-)

 

would be good if you could mail me the product_info.php

 

regards

kai

Share this post


Link to post
Share on other sites

hi peter

you are right with the xsell-statement part in buy_two_module.php

 

I have uploaded a new version 1.07a - just take the mentioned file from the catalog/includes/modules and copy it over the old one (your current one)

 

regards

Kai

Share this post


Link to post
Share on other sites

Hi Kai,

 

would be good if you could mail me the product_info.php

 

Okay, will do.

 

I ran the url through 'htmltidy', and I was expecting a lot of errors, because the tool is quite strict. I ignored anything not related to 'buy two', and looked for missing (or extra) table rows, or cells. Here is some of the output:

 

121  Warning: <table> lacks "summary" attribute; Warning: missing <td>; Warning: <script> lacks "type" attribute

 

<img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="10"><table align="left"><tr><tr><td colspan="5" align="left" class="buybothText"><a class="buybothHeading">Special Bundling Offer</a><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="5">Buy <script language="javascript"><!--

 

and one that is probably a lot more important:

 

149  Error: discarding unexpected </form>; Warning: missing <td>; Warning: <form> shouldn't be nested; Warning: unescaped & or unknown entity "&auroranien"; Warning: missing </form> before </td>; Warning: missing </font> before </a>; Warning: missing </span> before </td>

 

</td><td width="50%" align="center" valign="middle" class="buybothText">together for: <a class="buybothPrice">$27.00</a></td><td width="50%" valign="middle" class="buybothText" align="left"></form><form name="buy_tinn" action="http://www.candlesofeden.com/test/product_info.php/products_id/25/action/buy_tinn/buy_tinn_add/24" method="post"><input type="hidden" name="osCsid" value="" /><input type="image" src="includes/languages/english/images/buttons/button_buy_both_small.gif?osCsid=" border="0" alt="In Cart" title=" In Cart " align="left"><a href="http://www.candlesofeden.com/test/product_info.php/products_id/25/action/buy_tinn/buy_tinn_add/24&auroranien=http://www.auroranien.de"><img src="includes/languages/english/images/buttons/button_buy_both_small.gif" border="0" alt="In Cart" title=" In Cart " width="60" height="14" align="left"></a></td></tr><tr><td colspan="5"><img src="images/pixel_trans.gif" border="0" alt="" width="100%" height="2"></td></tr><tr><td colspan="5" valign="top" class="buybothText">You save NOW: $3.00<span style="visibility:hidden"><a href="http://www.auroranien.de"><font face="Arial, Helvetica, sans-serif" size="1" color="#EEEEEE">Auroranien Living Puppets Folkmanis</a></td></tr></table>

 

and in regards to the positioning of the 'form' tag ...

 

178  Warning: missing </form> before </td>

 

</td>

 

180  Error: discarding unexpected </form>

 

</table></form></td>

 

I used http://infohound.net/tidy/ with the url http://www.candlesofeden.com/test/product_.../products_id/25

 

I have stripped out the value for the value for "osCsid" because search engines can pick it up.

 

Thanks,

 

Peter

Share this post


Link to post
Share on other sites

Hi Kai,

 

As per your request via email, I have commented out the "also purchased" code in product_info.php, as follows:

 

    if ( (USE_CACHE == 'true') && !defined('SID')) {
     echo tep_cache_also_purchased(3600);
   } else {
     //include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }

 

and as I _expected_, this one here:

 

http://www.candlesofeden.com/test/product_.../products_id/27

 

that didn't display properly beforehand, is now okay. We had already established that there is something strange happening, and only with products that had a "also purchased". However, I have checked the code for the "also purchased" for MS-1, MS-2 and what resides on the website, and they are all equal. :)

 

The problem only started occuring when the contrib. was installed. The code for the contrib. is _just_ before "also purchased", so I would suggest there is something being put out in the buy two code that is causing the table/row/cell misalignment ???

 

As I say though, ..... "suggest" :)

 

Tomorrow I will uncomment the "also purchased" line in product_info.php, then run the url for ..test/...products_id/27 , save the html code, then comment out the buy two code, run the url again, save that html, compare the two, and _hopefully_ my favourite file compate tool (Beyond Compare) will tell me some secrets. :D

 

Thanks for your help,

 

Peter

Share this post


Link to post
Share on other sites

I have isntalled the contribution.

 

It works well when I set the following option

 

Want to use it as discount module or just simple

 

to "Normal "

 

But when i try to use it as a Discount Module. This is where it creates problem.

 

When i click on the Buy Now button in Product_info page, i get a blank page and the products are not added to the Shopping Cart.

 

But when i change the settings back to Normal Module, the products get added to the Shopping Cart.

 

Is there a fix for this ?

Share this post


Link to post
Share on other sites

Hi,

 

But when i try to use it as a Discount Module. This is where it creates problem.

 

When i click on the Buy Now button in Product_info page, i get a blank page and the products are not added to the Shopping Cart.

 

Usually, with PHP, a blank page indicates a parse error, when you have 'display_errors' set to zero (off). That is, no errors get reported to the browser. Do you have a control panel, which may have an option to display any web server errors ??

 

Peter

Share this post


Link to post
Share on other sites

Hi,

 

Well, I have tried various things this morning, in summary, when I use the buy two module this displays everything correctly:

 

http://www.candlesofeden.com/test/product_.../products_id/22

 

and this has the table/row alignment problems:

 

http://www.candlesofeden.com/test/product_.../products_id/27

 

When I comment out the include statement for the buy two module, all products display correctly.

 

Peter

Share this post


Link to post
Share on other sites

Hi,

 

Made a very minor mod to the /includes/modules/buy_two_module.php , and now at least the right hand column is displaying okay again.

 

Just one small problem with this:

 

http://www.candlesofeden.com/test/product_.../products_id/22

 

with the white box up the top right hand side. Hopefully that won't take much to fix. will send the mod to Kai.

 

Thanks,

 

Peter

Share this post


Link to post
Share on other sites

I did enable display of errors in php.ini.

 

 

but it didnt help. Its the same thing . A blank page

 

Is it that i am running it on Localhost.

Share this post


Link to post
Share on other sites

I have just updated the mod with the latest version.

 

 

Now when i uncomment the line below in buy_two_module.php

 

 

//if you are having problems then comment the next two line
//  '</form>'.
 tep_draw_form('buy_tinn', tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_tinn'.'&buy_tinn_add='.$buy_two_products['products_id'])).
 tep_image_submit('button_buy_both_small.gif', IMAGE_BUTTON_IN_CART,'align="left"').

// if you are having problems then uncomment this following line
//           	 '<a href="'.tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_tinn'.'&buy_tinn_add='.$buy_two_products['products_id']).'&auroranien=http://www.auroranien.de'.'">'. tep_image_button('button_buy_both_small.gif', IMAGE_BUTTON_IN_CART,'align="left"') .'</a>' .

 

When i comment the seond link to Add to Cart and uncomment the above two lines to Add to cart.

It works but it only adds the Main Product leaving out the second bundled product.

 

 

 

 

And when i uncomment the last line and comment out the first two lnes. I get the Blank Page

Share this post


Link to post
Share on other sites

Hi,

 

I did enable display of errors in php.ini.

but it didnt help. Its the same thing . A blank page

 

Is it that i am running it on Localhost.

 

Hopefully you restarted Apache ??

 

Peter

Share this post


Link to post
Share on other sites

@Farrukh

 

1. there is now the newest version 1.07g uploaded - try this first.

 

2. Why do you want to uncomment the lines? Are you having problems with the "normal" version?

 

3. If you uncomment the lines you have to make sure not to mess up with form things in your product info. This is the reason why I did offer the other (normal) solution.

 

regards

kai

Share this post


Link to post
Share on other sites

Hi Saletco

 

I tried out the latest verion 1.07g

 

I replaced the buy_two_module.php with the one in 1.07g

 

And when i click on Buy Now, it opened into a Blank Page.

 

 

It works fine when i set this option to " NORMAL " in the admin

 

Want to use it as discount module or just simple 	 =  normal

 

but when i set it to "DISCOUNT "

 

Want to use it as discount module or just simple 	 =  discount

 

Discount, the Blank page appears on clicking the Buy now.

Edited by Farrukh

Share this post


Link to post
Share on other sites

Hi,

 

The blank page that results from using the "buy now" button in the buy two module part is caued by the following message:

 

Warning: Missing argument 4 for add_cart() in ......./includes/classes/shopping_cart.php on line 79

 

and line 79 for me is:

 

function add_cart($products_id, $qty = '1', $attributes = '', $category_id, $notify = true) {

 

The fourth argument is $category_id, and is usually passed (e.g. application_top.php) something like this ........

 

$cart->add_cart($HTTP_GET_VARS['pid'],$cart->get_quantity($HTTP_GET_VARS['pid'])+1,'', $HTTP_GET_VARS['category_id']);

 

and in the new section of code inserted into application_top.php, for the buy two has the following:

 

                              // Total-Inn Buy_two_module (2155) begin
     case 'buy_tinn' :       if (isset($HTTP_GET_VARS['products_id'])) {
                               if (BUY_TWO_DISCOUNT_BUNDLE == 'normal') {
                                 if ($HTTP_GET_VARS['buy_tinn_add']) {
                                    $cart->add_cart($HTTP_GET_VARS['buy_tinn_add'],  $cart->get_quantity($HTTP_GET_VARS['buy_tinn_add']) +1);
                                 }
                                 if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
                                    tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' .$HTTP_GET_VARS['products_id']));
                                 } else {
                                    $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id']) +1);
                                 }
                               } elseif (BUY_TWO_DISCOUNT_BUNDLE =='discount') {
                                   $bundle_products_id = tep_set_bundle($HTTP_GET_VARS['products_id'],$HTTP_GET_VARS['buy_tinn_add'],BUY_TWO_BUNDLE_DISCOUNT_RATE);
                                   $cart->add_cart($bundle_products_id, $cart->get_quantity($bundle_products_id) +1);
                               }
                             }
                             tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
                             break;
                             // Total-Inn Buy_two_module (2155) end

 

so, there needs to be a 4th parm passed to the function. The url, btw, was:

 

http://example.com/product_info.php/produc...w.auroranien.de

 

what is the string "&auroranien=http://www.auroranien.de" appended to the end of the uri for ??

 

Hope that helps someone,

 

Peter

Share this post


Link to post
Share on other sites

Hi,

 

Well, no more blank screens, we are using "bundle discount". Have put through 2 or 3 orders now, using the 'buy two module', all seems to be working fine.

 

Thanks,

 

Peter

Share this post


Link to post
Share on other sites

Hi.

 

How did you fix the Blank Page problem.

 

I am only getting it when i switch to Bundle Discount.

 

I don't think you have 'display_errors' turned on ??

 

Add this at the very top of /includes/application_top.php

 

if (function_exists('ini_set')) @ini_set('display_errors', 'On');

 

Peter

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×