Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Bundled Products


lildog

Recommended Posts

Many thanks to Tsimi for coming up with this fix!

*************************************************
Look for this piece of code around line 473 - 480
*************************************************

  $product_images_query = tep_db_query("select id, image, htmlcontent, sort_order
                                       from " . TABLE_PRODUCTS_IMAGES . "
                                       where products_id = '" . (int)$product['products_id'] . "'
                                       order by sort_order");

  while ($product_images = tep_db_fetch_array($product_images_query)) {
    $pInfo->products_larger_images[] = array('id' => $product_images['id'],
                                          'image' => $product_images['image'],
                                    'htmlcontent' => $product_images['htmlcontent'],
                                     'sort_order' => $product_images['sort_order']);
  }
}



************************************************************************
now add the following piece of code as it is in between the last two } }
************************************************************************


// BOF Bundled Products
  if (isset($pInfo->products_bundle) && $pInfo->products_bundle == "yes") {

// this product is a bundle so get contents data
    $bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, pd.products_name
                                  FROM " . TABLE_PRODUCTS_DESCRIPTION . " pd
                                  INNER JOIN " . TABLE_PRODUCTS_BUNDLES . " pb ON pb.subproduct_id=pd.products_id
                                  WHERE pb.bundle_id = '" . (int)$HTTP_GET_VARS['pID'] . "'
                                  and language_id = '" . (int)$languages_id . "'");
    while ($bundle_contents = tep_db_fetch_array($bundle_query)) {
      $bundle_array[] = array('id' => $bundle_contents['subproduct_id'],
                             'qty' => $bundle_contents['subproduct_qty'],
                            'name' => $bundle_contents['products_name']);
    }
  }

  $bundle_count = count($bundle_array);
// EOF Bundled Products


********************************
the result should look like this
********************************

  $product_images_query = tep_db_query("select id, image, htmlcontent, sort_order
                                        from " . TABLE_PRODUCTS_IMAGES . "
                                        where products_id = '" . (int)$product['products_id'] . "'
                                        order by sort_order");
  while ($product_images = tep_db_fetch_array($product_images_query)) {
    $pInfo->products_larger_images[] = array('id' => $product_images['id'],
                                          'image' => $product_images['image'],
                                    'htmlcontent' => $product_images['htmlcontent'],
                                     'sort_order' => $product_images['sort_order']);
  }

// BOF Bundled Products
  if (isset($pInfo->products_bundle) && $pInfo->products_bundle == "yes") {

// this product is a bundle so get contents data
    $bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, pd.products_name
                                  FROM " . TABLE_PRODUCTS_DESCRIPTION . " pd
                                  INNER JOIN " . TABLE_PRODUCTS_BUNDLES . " pb ON pb.subproduct_id=pd.products_id
                                  WHERE pb.bundle_id = '" . (int)$HTTP_GET_VARS['pID'] . "'
                                  and language_id = '" . (int)$languages_id . "'");
    while ($bundle_contents = tep_db_fetch_array($bundle_query)) {
      $bundle_array[] = array('id' => $bundle_contents['subproduct_id'],
                             'qty' => $bundle_contents['subproduct_qty'],
                            'name' => $bundle_contents['products_name']);
    }
  }

  $bundle_count = count($bundle_array);

// EOF Bundled Products

}

Malcolm

Link to comment
Share on other sites

  • 3 years later...
  • Replies 52
  • Created
  • Last Reply

Top Posters In This Topic

I'm running 2.3.4BS here, and I'm trying to figure out something with how Bundles and the PayPal payment methods interact, in particular the function reduce_bundle_stock which is added into checkout_process.php

The reduce_bundle_stock function declaration, as I understand it, would be needed in the PayPal payment methods as well, I would think. Wouldn't it make more sense to add this function into the include/functions/general.php location? Or is there some inheritance I'm not seeing here where the function declaration (and code) is somehow accessible in the other checkout methods and so I don't need to move it into general.php to still be successfully called in the paypal payment? I know there's some interesting ways that the alternate payment methods interact with checkout_process.php but this one has me confused.

The concern I have is if I add the new reduce_bundle_stock function into each payment method, wouldn't I then get get a function conflict between checkout_process.php and the two paypal_standard.php and paypal_pro_hs.php payment methods?

I tried putting the function into general.php as a a new function called tep_reduce_bundle_stock, and modified the function to call the function by this new name. With this change however, my customer is saying they are no longer receiving the confirmation email, but the orders table is being successfully updated by PayPal when the checkout process completes. I know that general.php is being loaded as there are other tep_* functions in paypal_standard.php which are successfully being called. I can't see why my change of moving the reduce_bundle_stock function from checkout_process.php into general.php would cause the confirmation emails to not go out tho.

Checkout via standard methods are working and the bundle stock is being reduced in inventory correctly with the function moved to general.php, but for some reason things aren't working correctly when paypal_standard.php checkout method is being used. I'm a bit at a loss as to why the order process email isn't going out. I've attached the relevant changed files here, in case anyone might be able to see if I'm doing something stupid and just need another set of eyes on it to tell me where things are going off the rails.

There is also a function added for LowStockCheck, where if inventory falls below a threshold, then an email goes out to alert that inventory may need to be re-ordered.

Unfortunately I'm working with a live system that I'm modifying, so I can't really experiment TOO much here. I've not found a way to (at least without great efforts) replicate the entire store locally for debugging and testing which would FAR rather be my preference, so I have to just make a best effort to making sure I don't knock the store offline or do anything that would confuse customers and/or block checkout.

general.php.new

paypal_standard.php.new

checkout_process.php.new

Link to comment
Share on other sites

23 hours ago, mattsc said:

I'm running 2.3.4BS here, and I'm trying to figure out something with how Bundles and the PayPal payment methods interact, in particular the function reduce_bundle_stock which is added into checkout_process.php

The reduce_bundle_stock function declaration, as I understand it, would be needed in the PayPal payment methods as well, I would think. Wouldn't it make more sense to add this function into the include/functions/general.php location? Or is there some inheritance I'm not seeing here where the function declaration (and code) is somehow accessible in the other checkout methods and so I don't need to move it into general.php to still be successfully called in the paypal payment? I know there's some interesting ways that the alternate payment methods interact with checkout_process.php but this one has me confused.

The concern I have is if I add the new reduce_bundle_stock function into each payment method, wouldn't I then get get a function conflict between checkout_process.php and the two paypal_standard.php and paypal_pro_hs.php payment methods?

I tried putting the function into general.php as a a new function called tep_reduce_bundle_stock, and modified the function to call the function by this new name. With this change however, my customer is saying they are no longer receiving the confirmation email, but the orders table is being successfully updated by PayPal when the checkout process completes. I know that general.php is being loaded as there are other tep_* functions in paypal_standard.php which are successfully being called. I can't see why my change of moving the reduce_bundle_stock function from checkout_process.php into general.php would cause the confirmation emails to not go out tho.

Checkout via standard methods are working and the bundle stock is being reduced in inventory correctly with the function moved to general.php, but for some reason things aren't working correctly when paypal_standard.php checkout method is being used. I'm a bit at a loss as to why the order process email isn't going out. I've attached the relevant changed files here, in case anyone might be able to see if I'm doing something stupid and just need another set of eyes on it to tell me where things are going off the rails.

 

Well, I've got a little bit more information now. It seems that they ARE receiving SOME of the Order Confirmation emails. It looks like the ones they aren't receiving are when the order comes in via PayPal Standard and there is an order mismatch of $0.01, so this may not be related to the Bundled Products mod after all. I started a thread on that specific issue here:

I'm still not sure if that's the reason why they aren't receiving all of the Order Process emails, but that's my best guess as to why currently... I'm not seeing any other difference between orders that come in and the Order Process message does go out, and the ones where it doesn't.

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