Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

integrating qtpro with sppc in 2.3.1


14steve14

Recommended Posts

Has anyone integrated these two contributions into 2.3.1.

 

I installed separate pricing per customer with no troubles. I then added qtpro as far as the product info page. The code changes required for qtpro mean adjusting content already modified for sppc and i cannot get them to work together. Has anyone done this on a working store.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

There is an addon called qpbpp for sppc or something like this, however from what I remember, there is not much to do on the product info page.

 

I used this combination a couple of times on 2.3.1, but I don't have something like a "clean package". Do you have issues just with the product info? If so I can send you a merged file

 

EDIT: Please ignore. I thought you talk about qpbpp , just saw it's qtpro

Link to comment
Share on other sites

George

 

Quantity price breaks may be added next. I do need it. I may drop the attributes quantity and stock control if i have to, but it will be a shame as i am planning to add lots of attributes.rather than having loads of similar products.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

As i have said, i have installed sppc for 2.3.1. This has altered the product ingo .php file.

 

QTPRO is saying to look for this code

 

<?php
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
   <p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>
   <p>
<?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
    $products_options_array = array();
    $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
    while ($products_options = tep_db_fetch_array($products_options_query)) {
	  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
	  if ($products_options['options_values_price'] != '0') {
	    $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
    }
    if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
    } else {
	  $selected_attribute = false;
    }
?>
  <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />
<?php
  }
?>
   </p>
<?php
   }
?>

 

In the product info code i have

 

// BOF SPPC Hide attributes from customer groups
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
?>
   <p><?php echo TEXT_PRODUCT_OPTIONS; ?></p>
   <p>
<?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
    $products_options_array = array();
    $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
   $list_of_prdcts_attributes_id = '';
   $products_options = array(); // makes sure this array is empty again
    while ($_products_options = tep_db_fetch_array($products_options_query)) {
 $products_options[] = $_products_options;
 $list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
   }
   if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') {
  $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
  $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
  while ($pag_array = tep_db_fetch_array($pag_query)) {
   $cg_attr_prices[] = $pag_array;
  }

  // substitute options_values_price and prefix for those for the customer group (if available)
  if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
   for ($n = 0 ; $n < count($products_options); $n++) {
    for ($i = 0; $i < count($cg_attr_prices) ; $i++) {
	 if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
	  $products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
	  $products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
	 }
    } // end for ($i = 0; $i < count($cg_att_prices) ; $i++)
   }
  } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
 } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')
 for ($n = 0 ; $n < count($products_options); $n++) {
  $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
  if ($products_options[$n]['options_values_price'] != '0') {
   $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
  }
 }
// EOF SPPC attributes mod
    if (is_string($HTTP_GET_VARS['products_id']) && isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {
	  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
    } else {
	  $selected_attribute = false;
    }
?>
  <strong><?php echo $products_options_name['products_options_name'] . ':'; ?></strong><br /><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?><br />
<?php
  }
?>
   </p>
<?php
   }
?>

 

I need to add for the qtpro code

 

<?php
}
//++++ QT Pro: End Changed Code
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($products_attributes['total'] > 0) {
//++++ QT Pro: Begin Changed code
  $products_id=(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']);
  require(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php');
  $class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN;
  $pad = new $class($products_id);
  echo $pad->draw();
   }
//Display a table with which attributecombinations is on stock to the customer?
if(PRODINFO_ATTRIBUTE_DISPLAY_STOCK_LIST == 'True'): require(DIR_WS_MODULES . "qtpro_stock_table.php"); endif;
//++++ QT Pro: End Changed Code
?>

 

 

I hope someone can see how to integrate these two add ons.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

  • 2 weeks later...

Look for this:

 require(DIR_WS_INCLUDES . 'template_top.php');
 if ($product_check['total'] < 1) {

click (highlight) the curly bracket to find the other end:

 } else {

Now click the right half of the curly bracket and find the end of it:

<?php } ?>

Just before this is where I have this inserted in my version. My site is heavily modified, but this is where it is in mine:

<?php
//++++ QT Pro: End Changed Code
/* ### LINE EDIT: Separate Pricing Per Customer v4.2.2 (10.18.11) (Step 46d) - Hide attributes from customer groups - ADD: and find_in_set()=0 ### */
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");
$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
//++++ QT Pro: Begin Changed code
/* EVERYTHING IN HERE WAS PUT INTO /includes/classes/pad_base.php, LINES 287-313 FOR QT Pro */
  $products_id=(preg_match("/^\d{1,10}(\{\d{1,10}\}\d{1,10})*$/",$HTTP_GET_VARS['products_id']) ? $HTTP_GET_VARS['products_id'] : (int)$HTTP_GET_VARS['products_id']);
  require(DIR_WS_CLASSES . 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN . '.php');
  $class = 'pad_' . PRODINFO_ATTRIBUTE_PLUGIN;
  $pad = new $class($products_id);
  echo $pad->draw();
}
//Display a table with which attribute combinations is in stock to the customer?
if(PRODINFO_ATTRIBUTE_DISPLAY_STOCK_LIST == 'True'): require(DIR_WS_MODULES . "qtpro_stock_table.php"); endif;
//++++ QT Pro: End Changed Code
?>
<?php } ?>

 

My site is heavily modified (and product_info.php is EXTREMELY modified), and as you can see in the one line, a bunch of stuff that use to be there was moved to includes/classes/pad_base.php for QTPro, so that's where some of the code went to. I don't know if this will help or not, but give it a shot.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...