Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Buy_Two_Module


Guest

Recommended Posts

  • 2 weeks later...
  • Replies 179
  • Created
  • Last Reply

Top Posters In This Topic

Hi,

 

I really like the idea of setting up two linked products and sell them as a bundle.

 

I installed the xsell module as mentioned before and thougt that the buy two module would only look in this specified data string, but this seems not the case.

 

How do I fix the buy two module that he only shows bundles created from the xsell module, and that he stops to make the on the fly bundles they are not of any of our interest.

 

===

Maybe a new option, the xsell box show mixed we aslo recommend bla bla, and the buy two box show's only the by you pre defined items (bundles)

===

 

Just wondering if anything happened with this query, as it is exactly what we wish to do also, any ideas greatly appreciated :)

 

Cheers

 

Matt

Link to comment
Share on other sites

Thanks so much for the support, the v2.0 is exactly what i was after.

 

I have modified it slightly to fit in with what i required, i also modified the links to be to the product_info rather than the popup image (as I am forcing the 'bundles' this seems the best option), for anyone who wishes to check my use of this or too see it in action plesae see here:

 

http://www.consoleplus.co.uk/product_info....ller-s-for-xbox

 

only that product is 'bundled' at present.

 

great mod, many thanks again.

 

Matt

Link to comment
Share on other sites

  • 2 weeks later...

Hi again,

 

This seemed to be working perfectly, but now i am noticing that i am getting undesired results.

 

the buy_two module is only displayed if a product is assigned a 'partner' in X-Sell - which is fine... but the 'bundled' second product being displayed by buy_two is not restricted to the product/s assigned in X-Sell, it picks a product at random (it only picks products that are assigned in X-Sell, but not the specific product that is assigned to the 'Primary' product).

 

Not sure if that makes sense, i hope so :)

 

As i modified things quite a lot i even tried re-installing the contirbution with all default settings, and get the same result.

 

I am only ever adding 1 product to 1 other in X-Sell, so i should be specifically selecting 2 products to bundle, but it is not being specific and is selecting the second product at random from the other products i have also assigned X-Sell products too.

 

Is this something that is wrong, or is this how it should be?

 

Thanks

 

Matt

Link to comment
Share on other sites

  • 2 weeks later...

okay now I find the problem maybe caused by my thumbnail code in the html_output.php, you can see my function tep_image and the new thumbnail code:

// The HTML image wrapper function
 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {
   if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {
     return false;
   }

/// Add ////////////////////////////////////////////////////
   if ($image_size = @getimagesize($src)) {
     if ((CONFIG_CALCULATE_IMAGE_SIZE == 'true')) {
 if ( ($width) || ($height) ) {
	 if ( $width=="100%" ) {
    $width = $image_size[0];
	 } elseif ( $height=="100%" ) {
    $height = $image_size[1];
	 } elseif ( $width==0 ) {
    unset($width);
	 } elseif ( $height==0 ) {
    unset($height);
	 }
	 $src=thumbimage(DIR_FS_CATALOG . '/' .$src, $width, $height, 1, 1, DIR_FS_CATALOG . '/' . DIR_WS_IMAGES . 'imagecache');
	 if ((($image_size[1]/$height) > ($image_size[0]/$width) ) && $height>0){
    $width=ceil(($image_size[0]/$image_size[1])* $height);
	 } elseif ($width>0) {
    $height=ceil($width/($image_size[0]/$image_size[1]));
	 }
 }
   }
     } elseif (IMAGE_REQUIRED == 'false') {
       return '';
     }

// alt is added to the img tag even if it is null to prevent browsers from outputting
// the image filename as default
   $image = '<img src="' . tep_output_string($src) . '" border="0" alt="' . tep_output_string($alt) . '"';

   if (tep_not_null($alt)) {
     $image .= ' title=" ' . tep_output_string($alt) . ' "';
   }
if (tep_not_null($width) && tep_not_null($height)) {
     $image .= ' width="' . tep_output_string($width) . '" height="' . tep_output_string($height) . '"';
   }

   if (tep_not_null($parameters)) $image .= ' ' . $parameters;

   $image .= '>';

   return $image;
 }

 

and the new thumbnail function here:

/// Add ////////////////////////////////////////////////////
function thumbimage ($image, $x, $y, $aspectratio, $resize, $cachedir){

         /*##############################################
      #          - Thumbnail-Script v1.3 -           #
      # Generating thumbnails 'on-the-fly' with PHP  #
      #                                              #
      #  (c) by Christian Lamine, FlashDreams OHG    #
      #          http://www.flashdreams.de/          #
      #                                              #
      #       Modified by http://www.tse.at                                       #
      #                                              #
      # This script may be freely used, distributed  #
      # and modified without any charge as long as   #
      # this copyright information is included.      #
      #                                              #
      # Any commercial selling of this script is     #
      # forbidden.                                   #
      #                                              #
      # The author is not responsible for possible   #
      # damage which may result from the application #
      # of this script, neither direct nor indirect. #
      # Use at your own risk!                        #
      ##############################################*/

    error_reporting(0);

    $types = array (1 => "gif", "jpeg", "png", "swf", "psd", "wbmp");
 $not_supported_formats = array ("GIF"); // Write in capital Letters!!
    umask(0);
    !is_dir ($cachedir)
        ? mkdir ($cachedir, 0777)
        : system ("chmod 0777 ".$cachedir);

      (!isset ($x) || ereg ('^[0-9]{1,}$', $x, $regs)) &&
      (!isset ($y) || ereg ('^[0-9]{1,}$', $y, $regs)) &&
      (isset ($x) || isset ($y))
           ? true
         : DIE ('Fehlende(r) oder ungtige(r) Grenparameter!');

    !isset ($resize) || !ereg ('^[0|1]$', $resize, $regs)
         ? $resize = 0
         : $resize;

    !isset ($aspectratio) || !ereg ('^[0|1]$', $aspectratio, $regs)
         ? isset ($x) && isset ($y)
                ? $aspectratio = 1
                : $aspectratio = 0
         : $aspectratio;

    !isset ($image)
         ? DIE ('Es wurde kein Bild angegeben!')
         : !file_exists($image)
              ? DIE ('Die angegebene Datei konnte nicht auf dem Server gefunden werden!')
              : false;

    $imagedata = getimagesize($image);

    !$imagedata[2] || $imagedata[2] == 4 || $imagedata[2] == 5
         ? DIE ('Bei der angegebenen Datei handelt es sich nicht um ein Bild!')
         : false;

 $imgtype="!(ImageTypes() & IMG_" . strtoupper($types[$imagedata[2]]) . ")";
    if ((eval($imgtype)) || (in_array(strtoupper(array_pop(explode('.', basename($image)))),$not_supported_formats))) {
     $image = substr ($image, (strrpos (DIR_FS_CATALOG . '/', '/'))+1);
	 return $image;

    }

    if (!isset ($x)) $x = floor ($y * $imagedata[0] / $imagedata[1]);


    if (!isset ($y)) $y = floor ($x * $imagedata[1] / $imagedata[0]);

    if ($aspectratio && isset ($x) && isset ($y)) {
 if ((($imagedata[1]/$y) > ($imagedata[0]/$x) )){
   $x=ceil(($imagedata[0]/$imagedata[1])* $y);
 } else {
   $y=ceil($x/($imagedata[0]/$imagedata[1]));
 }
    }

    $thumbfile =  '/' . basename($image);
    if (file_exists ($cachedir.$thumbfile)) {
         $thumbdata = getimagesize ($cachedir.$thumbfile);
         $thumbdata[0] == $x && $thumbdata[1] == $y
              ? $iscached = true
              : $iscached = false;
    } else {
         $iscached = false;
    }

    if (!$iscached) {
         ($imagedata[0] > $x || $imagedata[1] > $y) || (($imagedata[0] < $x || $imagedata[1] < $y) && $resize)
              ? $makethumb = true
              : $makethumb = false;
    } else {
         $makethumb = false;
    }



    if ($makethumb) {
         $image = call_user_func("imagecreatefrom".$types[$imagedata[2]], $image);
if (function_exists("imagecreatetruecolor") && ($thumb = imagecreatetruecolor ($x, $y))) {
imagecopyresampled ($thumb, $image, 0, 0, 0, 0, $x, $y, $imagedata[0], $imagedata[1]);
} else {
$thumb = imagecreate ($x, $y);
imagecopyresized ($thumb, $image, 0, 0, 0, 0, $x, $y, $imagedata[0], $imagedata[1]);
}
         call_user_func("image".$types[$imagedata[2]], $thumb, $cachedir.$thumbfile);
         imagedestroy ($image);
         imagedestroy ($thumb);
         $image = DIR_WS_IMAGES . 'imagecache' . $thumbfile;
    } else {
         $iscached
              ? $image = DIR_WS_IMAGES . 'imagecache' . $thumbfile
              : $image = substr ($image, (strrpos (DIR_FS_CATALOG . '/', '/'))+1);
    }
return $image;

}

Link to comment
Share on other sites

oh YES! now I have fixed the problem by removing that thumbnail code and adding the faster and better one:

http://www.oscommerce.com/community/contributions,2226

NOW the BUY_TOW works.

 

Glad to hear you got it going ok :)

 

Are you using it with X-Sell to manually pre-select the two products? if so does this work correctly for you? as i still get random selections of products even though the products are linked in X-Sell (the random products are only chosen from other 'X-Sell' links i have setup - but they do not respond to the exact links i set in X-Sell :(

 

Cheers

 

Matt

Link to comment
Share on other sites

  • 4 weeks later...

I use X-sell and discount mode, when i click on button "Buy now" a blank page appear.

 

The probleme is not fixed in previous page, only the contrib work in online and a pb is not fixed!

 

one idea for begin ?

 

thanks

Link to comment
Share on other sites

I found an interesting bug when testing this....

 

After you add the bundle items to the cart you can click on the item. Then it re bundles it again and you can add it to the cart again and then click on it again and so on and so on. Needless to say everytime the discount is applied so your discount gets more and more and you get more and more stuff infinately to the point you are actually loosing money because so many things are bundled for such a low cost. It is most noticeable with one expensive item and many cheaper items.

 

How can we fix this so this does not happen and our customers don't take advantage of the flaw?

 

Thanks!

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

Hi

 

you have not find a bug, because that what you are looking for is already in - at least in the install instructions:

 

// 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 {

 if (tep_first_product_check($product_info['products_id'])) include(DIR_WS_MODULES . 'buy_two_module.php');
 
      }
} else {
}
// buy_two_module EOF

 

This part belongs to product_info.php. If this is installed correctly BUY_WOR will not appear on bundles.

 

Regards

Kai

Link to comment
Share on other sites

  • 1 month later...

When i have installed this contrbution, i have this problem.Could you help me ?

 

Warning: Missing argument 4 for tep_set_bundle() in d:\wamp\www\client_b2b\ecom\boutique\includes\functions\buy_two_func.php on line 293

 

Warning: Cannot modify header information - headers already sent by (output started at d:\wamp\www\client_b2b\ecom\boutique\includes\functions\buy_two_func.php:293) in d:\wamp\www\client_b2b\ecom\boutique\includes\functions\general.php on line 155

 

The GD is installed and the version is Ok for this contribution

Edited by Gyakutsuki


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

 

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

Excellent contrib, I see a lot of possibilities with it, but one small improvement I'd like to see:

 

1) My site uses osCommerce's stock tracking, and from playing around with this module, I see that when a customer adds a bundle to their basket, and checkos out, the stock level of the original two items is not deducted, while they would need to be to keep an accurate count.

The stock levels of the original items should also be restored if the order is deleted with the "restock product quantity" option is checked.

 

I tried to dig through your code and see if I can add these functionalities myself, but no luck, Im just not good enough yet :D

Link to comment
Share on other sites

Hi,

 

Excellent contrib, I see a lot of possibilities with it, but one small improvement I'd like to see:

 

1) My site uses osCommerce's stock tracking, and from playing around with this module, I see that when a customer adds a bundle to their basket, and checkos out, the stock level of the original two items is not deducted, while they would need to be to keep an accurate count.

The stock levels of the original items should also be restored if the order is deleted with the "restock product quantity" option is checked.

 

I tried to dig through your code and see if I can add these functionalities myself, but no luck, Im just not good enough yet :D

 

Hi,

 

well this is a point that really is true and not easy to manage "just for everyone". The reason is that because a lot of contributions are out there and a lot of different adaptation in individual code is done I am not in the situation to offer a general working code.

 

If I would start offering an A-solution the next one would ask me to adapt it because of adapted code. And then B C D etc would ask ... I assume a lot of support time for exactly this feature. And to be honest I do not have that much time for free.

 

Ofcourse I do have my own working solution for this point and I can offer individual solutions - but this is to be discussed as PM

 

Best regards

Kai

Link to comment
Share on other sites

Hi Kai,

 

Sure, I know what you mean, but this would be a modification based on a core osCommerce function, so would not be of use only to me, but anyone using osCommerce to track stock. But please do PM me with some information about your current solution to this.

Link to comment
Share on other sites

  • 3 weeks later...

Hi Kai,

 

I've got a problem with shipping rates not being calculated correctly. Sometimes only the weight of the first product is taken, sometimes the weight is even higher than the weight of the two products added together.

 

I'm using buy_two_module.php, v1.06 2004/06/20

 

Is/was this a known problem in later versions of your (great) contribution?

 

Cheers,

Nick

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...