Jump to content
Sign in to follow this  
Peper

if this bundle then that help

Recommended Posts

This small things that pulling my hair

Please can someone help with this 

$bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM products p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN products_description pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'");
    while ($bundle_info = tep_db_fetch_array($bundle_query)) {
      if (tep_not_null($bundle_info)) {

$bundle_info = $bundleContents;
            
   $bundleContents = '<br /><em style="font-size:12px;">&nbsp;&nbsp;' . $bundle['subproduct_qty'] . ' x ' . $bundle['products_name'] . '</em>';
  }    else {
      $bundleContents = ' ';
    }    
}

and then later to echo  $bundleContents

So if contents is in bundle echo this, else echo nothing. I tried many ways to do this but not close.

Want to use this in the email order confirmation mail to display the bundle purchased


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites
$bundleContents = '';
$bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM products p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN products_description pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'");
while ($bundle_info = tep_db_fetch_array($bundle_query)) {
  $bundleContents .= '<br /><em style="font-size:12px;">&nbsp;&nbsp;' . $bundle_info['subproduct_qty'] . ' x ' . $bundle_info['products_name'] . '</em>';
}

 

Share this post


Link to post
Share on other sites
    $seen_bundles = [];
    $bundleContents = '';
    $bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM products p INNER JOIN products_bundles pb ON (pb.bundle_id=p.products_id) INNER JOIN products_description pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = 1");
    while ($bundle_info = tep_db_fetch_array($bundle_query)) {
      if (!in_array($bundle_info['subproduct_id'], $seen_bundles)) {
        $seen_bundles[] = $bundle_info['subproduct_id'];
        $bundleContents .= '<br /><em style="font-size:12px;">&nbsp;&nbsp;' . $bundle_info['subproduct_qty'] . ' x ' . $bundle_info['products_name'] . '</em>';
      }
    }

I'm not sure I'm clear on what you are trying to do.  If this isn't it, perhaps explain more about what the data holds and what you want to see? 


Always back up before making changes.

Share this post


Link to post
Share on other sites

@ruden @ecartz

Thanks, i tried both, not showing product bundle

Some items are made up of more than on product. I wanted to display the product items included in the bundle

example for my admin/invoice.php this is working perfect

$bundleContents = '';
$bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM " . TABLE_PRODUCTS . " p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN " . TABLE_PRODUCTS_DESCRIPTION . " pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'");
while ($bundle = tep_db_fetch_array($bundle_query)) {
echo "<br> <i>" . $bundle['subproduct_qty'] . " x " . $bundle['products_name'] . "</i>";
}

 

My last attempt i tried both normal product or bundle results into "none"

$bundle_query = tep_db_query("SELECT pb.subproduct_id, pb.subproduct_qty, p.products_id, pd.products_name, pd.language_id FROM products p LEFT JOIN products_bundles pb ON (pb.bundle_id=p.products_id) LEFT JOIN products_description pd ON (pd.products_id=pb.subproduct_id) WHERE p.products_model = '" . $order->products[$i]['model'] . "' AND pd.language_id = '1'");
      if (!tep_db_num_rows($bundle_query) ) {
             $bundleContents = 'none';
      } else {
$bundle = tep_db_fetch_array($bundle_query);
  $bundleContents = '<br /><em style="font-size:12px;">&nbsp;&nbsp;' . $bundle['subproduct_qty'] . ' x ' . $bundle['products_name'] . '</em>';        
}

 

 


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

@hungryfrank yes, there is one

This is a html email confirmation i'm working on for checkout_process

I see though to get model number unrelated from bundle =   <td valign="top" align="center"><font face="verdana" style="font-size:14px;">'.$order->products[$i]['qty'].'</font></td>

So that one in bundles? getting model number for bundles?


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites

Check for needle first? Is this useable

    $bundle_query = tep_db_query('select pb.subproduct_id, pb.subproduct_qty, p.products_bundle, p.products_quantity from products_bundles pb, products p where p.products_id = pb.subproduct_id and bundle_id = ' . (int)tep_get_prid($bundle_id));
    while ($bundle_info = tep_db_fetch_array($bundle_query)) {
      if ($bundle_info['products_bundle'] == 'yes') {

 

 


Getting the Phoenix off the ground

Share this post


Link to post
Share on other sites
27 minutes ago, Peper said:

@hungryfrank yes, there is one

This is a html email confirmation i'm working on for checkout_process

I see though to get model number unrelated from bundle =   <td valign="top" align="center"><font face="verdana" style="font-size:14px;">'.$order->products[$i]['qty'].'</font></td>

So that one in bundles? getting model number for bundles?

I think you have to use your original code right before the attributes are found for each product.

you want to check to see if there is a bundle for each product.  it is the same as attributes.you should put your code in the same loop


you can cut up to 4 pages of your checkout by using my three add_ons

login create account in one page

Express checkout  

login pop up modal

Share this post


Link to post
Share on other sites

Gary released a products bundle module in one of his latest 28days of code. Could be worth asking him about that.


REMEMBER BACKUP, BACKUP AND BACKUP

Get the latest Responsive osCommerce CE (community edition) here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
Share on other sites

@14steve14 I do have that module from Gary,

I did give it a try a while ago, there were few things but one was the bundle display layout was not working for me. 

This is not a train smash, i will still pursue a solution for this as it would been great showing in the email confirmation the bundled products instead of just the bundle product name.

If you change the bundle after customer purchased a bundle, what products was part of the original bundle?


Getting the Phoenix off the ground

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  

×