Jan Zonjee Posted June 21, 2006 Share Posted June 21, 2006 Now i have just one other question. When a new customer is filling out the form is it possible to hide the company entry details as default and that it appears only when the customer chooses "Corporate" or "Wholesale" group? That is something that cannot/should not be done in PHP. I guess you could have the corporate infobox in a div that has a "hidden" attribute in css and than be toggled to visible using JavaScript... I assume. Quote Link to comment Share on other sites More sharing options...
angdawa Posted June 23, 2006 Share Posted June 23, 2006 I installed the module for this seperate pricing and looks like wholesale price display works until the logged in wholesale customer gets into Product info page. And when they click on "Add to Cart" button on product_info.php, the next page shopping_cart.php page shows the retail price instead of showing wholesale price. Does anyone have fix for this? I would really appreciate. Dawa I'm getting the discount group's price to display in boxes and product listings but the main product info page shows the retail price. Here is (i think) the pertinent code from product_info.php: <?php ?if ($product_check['total'] < 1) { ? // BOF Separate Price per Customer ? ? if(!tep_session_is_registered('sppc_customer_group_id')) { ? ? $customer_group_id = '0'; ? ? } else { ? ? ?$customer_group_id = $sppc_customer_group_id; ? ? } ? // EOF Separate Price per Customer ?> ? ? ?<tr> ? ? ? ?<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td> ? ? ?</tr> ? ? ?<tr> ? ? ? ?<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> ? ? ?</tr> ? ? ?<tr> ? ? ? ?<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> ? ? ? ? ?<tr class="infoBoxContents"> ? ? ? ? ? ?<td><table border="0" width="100%" cellspacing="0" cellpadding="2"> ? ? ? ? ? ? ?<tr> ? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> ? ? ? ? ? ? ? ?<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> ? ? ? ? ? ? ? ?<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> ? ? ? ? ? ? ?</tr> ? ? ? ? ? ?</table></td> ? ? ? ? ?</tr> ? ? ? ?</table></td> ? ? ?</tr> <?php ?} else { ? ?$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); ? ?$product_info = tep_db_fetch_array($product_info_query); ? ?tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); ? ?if ($new_price = tep_get_products_special_price($product_info['products_id'])) { // BOF Separate Price per Customer ? ? ? ?$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = ?'" . $customer_group_id . "'"); ? ? ? ?if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { ? ? ? ?$product_info['products_price']= $scustomer_group_price['customers_group_price']; } // EOF Separate Price per Customer ? ? ?$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; ? ?} else { // BOF Separate Price per Customer ? ? ? ?$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = ?'" . $customer_group_id . "'"); ? ? ? ?if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { ? ? ? ?$product_info['products_price']= $scustomer_group_price['customers_group_price']; } // EOF Separate Price per Customer ? ? ?$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); ? ?} ? ?if (tep_not_null($product_info['products_model'])) { ? ? ?$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>'; ? ?} else { ? ? ?$products_name = $product_info['products_name']; ? ?} ?> Any help is greatly appreciated. One other thing I've noticed is in the table products_groups, the products_price is 0.00 for each customers_group_price I have set up - should this be equal to the default (retail) price? Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 23, 2006 Share Posted June 23, 2006 I installed the module for this seperate pricing and looks like wholesale price display works until the logged in wholesale customer gets into Product info page. And when they click on "Add to Cart" button on product_info.php, the next page shopping_cart.php page shows the retail price instead of showing wholesale price. Does anyone have fix for this? Hard to say where that goes wrong. Double-check those pages where it goes wrong to see if you haven't made a mistake adding the code. Perhaps you have had a previous problem with register globals being turned off? In that case it might help if you use the super global $_SESSION in these parts: if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $_SESSION['sppc_customer_group_id']; } Quote Link to comment Share on other sites More sharing options...
Roger_Sweden Posted June 24, 2006 Share Posted June 24, 2006 Hello JanZ. First I want to thank you for a bunch of great contributions :) Now to my question: I have "Seperate Pricing Per Customer" (http://www.oscommerce.com/community/contributions,716) and "Hide products from customer groups for SPPC" (http://www.oscommerce.com/community/contributions,3059) installed in my shop and Im working on including "Quantity Price Breaks for Separate Pricing Per Customer" (http://www.oscommerce.com/community/contributions,3039). As im updating admin/categories.php I notise that "hide products" and "price breaks" change the same blocks of code in diffrent ways and Im stuck, as Im unsure exactly what to change into what... :blush: Could you help me out? Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 24, 2006 Share Posted June 24, 2006 (edited) As im updating admin/categories.php I notise that "hide products" and "price breaks" change the same blocks of code in diffrent ways and Im stuck, as Im unsure exactly what to change into what... I took a quick look and it is not as bad as it looks on first impression. If you look e.g. at the $sql_data_array that is built around line 220 and further just add in the 'products_hide_from_groups' => $hide_from_these_groups, where all the products_price1 etc. are added too. And there are a couple of queries where the only change is adding p.products_hide_from_groups, to the query where the price break adds a whole string (products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks). Just add p.products_hide_from_groups to the Price Break changed query (e.g. in } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') (around line 425) and you should be fine. The two contributions should be able to co-exist peacefully in categories.php And you will love to hear that in not too long there will be new version of hide products that can also hide categories (and adds even more code to admin/categories.php) :rolleyes: Edited June 24, 2006 by JanZ Quote Link to comment Share on other sites More sharing options...
Roger_Sweden Posted June 25, 2006 Share Posted June 25, 2006 Thank you for the fast reply :) Sounds like it be easier to add the "hide"-contrib to the "price breaks"-contrib, than the other way around, right? and yes I would love a "hide categories"-contrib. :wub: How about a bundle-pack-contrib? (SPPC + Hide products + Hide categories + Price Breaks) :D Quote Link to comment Share on other sites More sharing options...
Roger_Sweden Posted June 25, 2006 Share Posted June 25, 2006 (edited) JanZ, I thank you for your previous help and tips. But now I have a real problem... I simply cant find the piece of code Im supposed to replace! :'( As I said above: I have SPPC 4.11 and Hide Products v103a installed and Im working on installing Price Breaks v1_02. in admin/categories.php the install.txt for Price Breaks says: Line 561-610 ***REPLACE*** <!-- BOF Separate Pricing Per Customer --> <?php $customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id"); $header = false; while ($customers_group = tep_db_fetch_array($customers_group_query)) { if (tep_db_num_rows($customers_group_query) > 0) { $attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $pInfo->products_id . "' and customers_group_id = '" . $customers_group['customers_group_id'] . "' order by customers_group_id"); } else { $attributes = array('customers_group_id' => 'new'); } if (!$header) { ?> <tr bgcolor="#ebebff"> <td class="main" colspan="2" style="font-style: italic">Note that if a field is left empty, no price for that customer group will be inserted in the database.<br /> If a field is filled, but the checkbox is unchecked no price will be inserted either.<br /> If a price is already inserted in the database, but the checkbox unchecked it will be removed from the database. <?php if (isset($pInfo->sppcoption[$customers_group['customers_group_id']])) { // when a preview was done and the back button used print ("<br />\n<strong>Make sure you uncheck the appropriate boxes again!</strong>\n"); } ?> </td> </tr> <?php $header = true; } // end if (!header), makes sure this is only shown once ?> <tr bgcolor="#ebebff"> <td class="main"><?php echo tep_draw_checkbox_field('sppcoption[' . $customers_group['customers_group_id'] . ']', 'sppcoption[' . $customers_group['customers_group_id'] . ']', true) . ' ' . $customers_group['customers_group_name']; ?> </td> <td class="main"><?php if ($attributes = tep_db_fetch_array($attributes_query)) { echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcprice[' . $customers_group['customers_group_id'] . ']', $attributes['customers_group_price']); } else { if (isset($pInfo->sppcprice[$customers_group['customers_group_id']])) { // when a preview was done and the back button used $sppc_cg_price = $pInfo->sppcprice[$customers_group['customers_group_id']]; } else { // nothing in the db, nothing in the post variables $sppc_cg_price = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcprice[' . $customers_group['customers_group_id'] . ']', $sppc_cg_price ); } ?></td> </tr> <?php } // end while ($customers_group = tep_db_fetch_array($customers_group_query)) ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <!-- EOF Separate Pricing Per Customer --> ***WITH*** <!-- BOF Separate Pricing Per Customer --> <?php $customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id"); $header = false; while ($customers_group = tep_db_fetch_array($customers_group_query)) { if (tep_db_num_rows($customers_group_query) > 0) { $attributes_query = tep_db_query("select customers_group_id, customers_group_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $pInfo->products_id . "' and customers_group_id = '" . $customers_group['customers_group_id'] . "' order by customers_group_id"); } else { $attributes = array('customers_group_id' => 'new'); } if (!$header) { ?> <tr bgcolor="#ebebff""> <td class="main" colspan="2" style="font-style: italic">Note that if the price field for the customer group is left empty, <b>no</b> price and <b>no</b> price break levels and quantities for that customer group will be inserted in the database.<br /> If a field or fields is/are filled, but the checkbox is unchecked no price/price break levels etc. will be inserted either.<br /> If a price and price break levels are already inserted in the database, but the checkbox unchecked they will be removed from the database. </td> </tr> <?php $header = true; } // end if (!header), makes sure this is only shown once ?> <tr bgcolor="#ebebff"> <td class="main"><?php if (isset($pInfo->sppcoption)) { echo tep_draw_checkbox_field('sppcoption[' . $customers_group['customers_group_id'] . ']', 'sppcoption[' . $customers_group['customers_group_id'] . ']', (isset($pInfo->sppcoption[ $customers_group['customers_group_id']])) ? 1: 0); } else { echo tep_draw_checkbox_field('sppcoption[' . $customers_group['customers_group_id'] . ']', 'sppcoption[' . $customers_group['customers_group_id'] . ']', true) . ' ' . $customers_group['customers_group_name']; } </td> <td class="main"><?php $customer_prices_set = false; $customer_prices_in_post = false; if ($attributes = tep_db_fetch_array($attributes_query)) { $customer_prices_set = true; echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcprice[' . $customers_group['customers_group_id'] . ']', $attributes['customers_group_price']); } else { if (isset($pInfo->sppcprice[$customers_group['customers_group_id']])) { // when a preview was done and the back button used $customer_prices_in_post = true; $sppc_cg_price = $pInfo->sppcprice[$customers_group['customers_group_id']]; } else { // nothing in the db, nothing in the post variables $sppc_cg_price = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcprice[' . $customers_group['customers_group_id'] . ']', $sppc_cg_price ); } ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_QTY_BLOCKS; ?></td> <td class="main"><?php if ($customer_prices_set == true) { $sppc_cg_products_qty_blocks = $attributes['products_qty_blocks']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_qty_blocks = $pInfo->sppcproducts_qty_blocks[$customers_group['customers_group_id']]; } else { $sppc_cg_products_qty_blocks = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_qty_blocks[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_qty_blocks, 'size="10"') . ' ' . TEXT_PRODUCTS_QTY_BLOCKS_INFO; ?></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE1; ?></td> <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price1 = $attributes['products_price1']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price1 = $pInfo->sppcproducts_price1[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price1 = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price1[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price1, 'size="10"'); ?></td> <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE1_QTY; ?></td> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price1_qty = $attributes['products_price1_qty']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price1_qty = $pInfo->sppcproducts_price1_qty[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price1_qty = ''; } echo tep_draw_input_field('sppcproducts_price1_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price1_qty, 'size="10"'); ?></td> </tr></table></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE2; ?></td> <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price2 = $attributes['products_price2']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price2 = $pInfo->sppcproducts_price2[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price2 = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price2[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price2, 'size="10"'); ?></td> <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE2_QTY; ?></td> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price2_qty = $attributes['products_price2_qty']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price2_qty = $pInfo->sppcproducts_price2_qty[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price2_qty = ''; } echo tep_draw_input_field('sppcproducts_price2_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price2_qty, 'size="10"'); ?></td> </tr></table></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE3; ?></td> <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price3 = $attributes['products_price3']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price3 = $pInfo->sppcproducts_price3[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price3 = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price3[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price3, 'size="10"'); ?></td> <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE3_QTY; ?></td> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price3_qty = $attributes['products_price3_qty']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price3_qty = $pInfo->sppcproducts_price3_qty[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price3_qty = ''; } echo tep_draw_input_field('sppcproducts_price3_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price3_qty, 'size="10"'); ?></td> </tr></table></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE4; ?></td> <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price4 = $attributes['products_price4']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price4 = $pInfo->sppcproducts_price4[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price4 = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price4[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price4, 'size="10"'); ?></td> <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE4_QTY; ?></td> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price4_qty = $attributes['products_price4_qty']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price4_qty = $pInfo->sppcproducts_price4_qty[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price4_qty = ''; } echo tep_draw_input_field('sppcproducts_price4_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price4_qty, 'size="10"'); ?></td> </tr></table></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE5; ?></td> <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price5 = $attributes['products_price5']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price5 = $pInfo->sppcproducts_price5[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price5 = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price5[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price5, 'size="10"'); ?></td> <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE5_QTY; ?></td> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price5_qty = $attributes['products_price5_qty']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price5_qty = $pInfo->sppcproducts_price5_qty[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price5_qty = ''; } echo tep_draw_input_field('sppcproducts_price5_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price5_qty, 'size="10"'); ?></td> </tr></table></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE6; ?></td> <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price6 = $attributes['products_price6']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price6 = $pInfo->sppcproducts_price6[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price6 = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price6[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price6, 'size="10"'); ?></td> <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE6_QTY; ?></td> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price6_qty = $attributes['products_price6_qty']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price6_qty = $pInfo->sppcproducts_price6_qty[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price6_qty = ''; } echo tep_draw_input_field('sppcproducts_price6_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price6_qty, 'size="10"'); ?></td> </tr></table></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE7; ?></td> <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price7 = $attributes['products_price7']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price7 = $pInfo->sppcproducts_price7[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price7 = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price7[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price7, 'size="10"'); ?></td> <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE7_QTY; ?></td> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price7_qty = $attributes['products_price7_qty']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price7_qty = $pInfo->sppcproducts_price7_qty[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price7_qty = ''; } echo tep_draw_input_field('sppcproducts_price7_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price7_qty, 'size="10"'); ?></td> </tr></table></td> </tr> <tr> <td class="main"><?php echo TEXT_PRODUCTS_PRICE8; ?></td> <td class="main"><table border="0" cellspacing="0" cellpadding="0" width="80%"><tr> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price8 = $attributes['products_price8']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price8 = $pInfo->sppcproducts_price8[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price8 = ''; } echo tep_draw_separator('pixel_trans.gif', '24', '15') . ' ' . tep_draw_input_field('sppcproducts_price8[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price8, 'size="10"'); ?></td> <td class="main" align="right"><?php echo TEXT_PRODUCTS_PRICE8_QTY; ?></td> <td class="main" align="left"><?php if ($customer_prices_set == true) { $sppc_cg_products_price8_qty = $attributes['products_price8_qty']; } elseif ($customer_prices_in_post == true) { $sppc_cg_products_price8_qty = $pInfo->sppcproducts_price8_qty[$customers_group['customers_group_id']]; } else { $sppc_cg_products_price8_qty = ''; } echo tep_draw_input_field('sppcproducts_price8_qty[' . $customers_group['customers_group_id'] . ']', $sppc_cg_products_price8_qty, 'size="10"'); ?></td> </tr></table></td> </tr> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <?php } // end while ($customers_group = tep_db_fetch_array($customers_group_query)) ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <!-- EOF Separate Pricing Per Customer --> I couldnt find the code to replace so I made a search for "$customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id");" (found in the beginning of the code to replace) and I only find that line in one place (row 282). That area looks like this (showing 4 rows above and 4 rows below): tep_db_perform(TABLE_PRODUCTS, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'"); } // BOF Separate Pricing Per Customer, Price Break 1.11.3 mod $customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " where customers_group_id != '0' order by customers_group_id"); while ($customers_group = tep_db_fetch_array($customers_group_query)) // Gets all of the customers groups { $attributes_query = tep_db_query("select customers_group_id, customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where ((products_id = '" . $products_id . "') && (customers_group_id = " . $customers_group['customers_group_id'] . ")) order by customers_group_id"); $attributes = tep_db_fetch_array($attributes_query); I hope you can help me and tell me what to do :) *EDIT* My appoligies for the loooong post :blush: Edited June 25, 2006 by Roger_Sweden Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 25, 2006 Share Posted June 25, 2006 I hope you can help me and tell me what to do Since the hide products contribution (the one in the contribution area) only has a few minor changes to admin/categories.php you are better off taking the file from the Price Break contribution and merge that with the hide products instead of the other way around. Then the first part (that starts around line 210) would become: case 'update_product': if (isset($HTTP_POST_VARS['edit_x']) || isset($HTTP_POST_VARS['edit_y'])) { $action = 'new_product'; } else { if (isset($HTTP_GET_VARS['pID'])) $products_id = tep_db_prepare_input($HTTP_GET_VARS['pID']); $products_date_available = tep_db_prepare_input($HTTP_POST_VARS['products_date_available']); // BOF Separate Price Per Customer, Hide products from groups modification $hide_from_these_groups = '@,'; if ( $HTTP_POST_VARS['hide'] ) { // if any of the checkboxes are checked foreach($HTTP_POST_VARS['hide'] as $val) { $hide_from_these_groups .= tep_db_prepare_input($val).','; } // end foreach $hide_from_these_groups = substr($hide_from_these_groups,0,strlen($hide_from_these_groups)-1); // remove last comma } // EOF Separate Price Per Customer, Hide products from groups modification $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null'; $sql_data_array = array('products_quantity' => tep_db_prepare_input($HTTP_POST_VARS['products_quantity']), 'products_model' => tep_db_prepare_input($HTTP_POST_VARS['products_model']), 'products_price' => tep_db_prepare_input($HTTP_POST_VARS['products_price']), //BOF Price Break 1.11.3 mod 'products_price1' => tep_db_prepare_input($HTTP_POST_VARS['products_price1']), 'products_price2' => tep_db_prepare_input($HTTP_POST_VARS['products_price2']), 'products_price3' => tep_db_prepare_input($HTTP_POST_VARS['products_price3']), 'products_price4' => tep_db_prepare_input($HTTP_POST_VARS['products_price4']), 'products_price5' => tep_db_prepare_input($HTTP_POST_VARS['products_price5']), 'products_price6' => tep_db_prepare_input($HTTP_POST_VARS['products_price6']), 'products_price7' => tep_db_prepare_input($HTTP_POST_VARS['products_price7']), 'products_price8' => tep_db_prepare_input($HTTP_POST_VARS['products_price8']), 'products_price1_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price1_qty'])) < 0) ? 0 : $i, 'products_price2_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price2_qty'])) < 0) ? 0 : $i, 'products_price3_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price3_qty'])) < 0) ? 0 : $i, 'products_price4_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price4_qty'])) < 0) ? 0 : $i, 'products_price5_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price5_qty'])) < 0) ? 0 : $i, 'products_price6_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price6_qty'])) < 0) ? 0 : $i, 'products_price7_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price7_qty'])) < 0) ? 0 : $i, 'products_price8_qty' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_price8_qty'])) < 0) ? 0 : $i, 'products_qty_blocks' => (($i=tep_db_prepare_input($HTTP_POST_VARS['products_qty_blocks'])) < 1) ? 1 : $i, // EOF Price Break 1.11.3 mod 'products_date_available' => $products_date_available, 'products_weight' => tep_db_prepare_input($HTTP_POST_VARS['products_weight']), 'products_status' => tep_db_prepare_input($HTTP_POST_VARS['products_status']), 'products_tax_class_id' => tep_db_prepare_input($HTTP_POST_VARS['products_tax_class_id']), // BOF Separate Price Per Customer, hide for these groups modification 'products_hide_from_groups' => $hide_from_these_groups, // EOF Separate Price Per Customer, hide for these groups modification 'manufacturers_id' => tep_db_prepare_input($HTTP_POST_VARS['manufacturers_id'])); Then the part that starts in the file with the above changes at around line 505-550 would become: <!-- body_text //--> <td width="100%" valign="top"> <?php if ($action == 'new_product') { // changed for Price Break 1.11.3 $parameters = array('products_name' => '', 'products_description' => '', 'products_url' => '', 'products_id' => '', 'products_quantity' => '', 'products_model' => '', 'products_image' => '', 'products_price' => '', 'products_price1' => '', 'products_price2' => '', 'products_price3' => '', 'products_price4' => '', 'products_price5' => '', 'products_price6' => '', 'products_price7' => '', 'products_price8' => '', 'products_price1_qty' => '', 'products_price2_qty' => '', 'products_price3_qty' => '', 'products_price4_qty' => '', 'products_price5_qty' => '', 'products_price6_qty' => '', 'products_price7_qty' => '', 'products_price8_qty' => '', 'products_qty_blocks' => '', 'products_weight' => '', 'products_date_added' => '', 'products_last_modified' => '', 'products_date_available' => '', 'products_status' => '', 'products_tax_class_id' => '', // BOF SPPC hide from groups mod 'products_hide_from_groups' => '', // EOF SPPC hide from groups mod 'manufacturers_id' => ''); $pInfo = new objectInfo($parameters); if (isset($HTTP_GET_VARS['pID']) && empty($HTTP_POST_VARS)) { // product_query changed for Price Break 1.11.3 // and hide products 1.03a $product_query = tep_db_query("select pd.products_name, pd.products_description, pd.products_url, p.products_id, p.products_quantity, p.products_model, p.products_image, p.products_price, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, p.products_weight, p.products_date_added, p.products_last_modified, date_format(p.products_date_available, '%Y-%m-%d') as products_date_available, p.products_status, p.products_tax_class_id, p.products_hide_from_groups, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$HTTP_GET_VARS['pID'] . "' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "'"); $product = tep_db_fetch_array($product_query); Then find the part that starts around line 1020 in this new file: <?php } // end while ($customers_group = tep_db_fetch_array($customers_group_query)) ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <!-- EOF Separate Pricing Per Customer --> <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { ?> and change it to: <?php } // end while ($customers_group = tep_db_fetch_array($customers_group_query)) ?> <!-- BOF SPPC hide from groups mod --> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <tr> <td colspan="2" class="main" ><?php echo TEXT_HIDE_PRODUCTS_FROM_GROUP; ?></td> </tr> <?php $hide_customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id"); $hide_from_groups_array = explode(',',$pInfo->products_hide_from_groups); $hide_from_groups_array = array_slice($hide_from_groups_array, 1); // remove "@" from the array while ($hide_customers_group = tep_db_fetch_array($hide_customers_group_query)) { ?> <tr bgcolor="#ebebff"> <td class="main" colspan="2"><?php if (isset($pInfo->hide)) { echo tep_draw_checkbox_field('hide[' . $hide_customers_group['customers_group_id'] . ']', $hide_customers_group['customers_group_id'] , (isset($pInfo->hide[ $hide_customers_group['customers_group_id']])) ? 1: 0); } else { echo tep_draw_checkbox_field('hide[' . $hide_customers_group['customers_group_id'] . ']', $hide_customers_group['customers_group_id'] , (in_array($hide_customers_group['customers_group_id'], $hide_from_groups_array)) ? 1: 0); } ?>??<?php echo $hide_customers_group['customers_group_name']; ?></td> </tr> <?php } // end while ($hide_customers_group = tep_db_fetch_array($hide_customers_group_query)) ?> <tr> <td colspan="2"><?php echo tep_draw_separator('pixel_trans.gif', '1', '10'); ?></td> </tr> <!-- EOF Separate Pricing Per Customer --> <?php for ($i=0, $n=sizeof($languages); $i<$n; $i++) { ?> And that should do it. Quote Link to comment Share on other sites More sharing options...
invasi0n Posted June 30, 2006 Share Posted June 30, 2006 Hello, I'd like to know if it's possible to integrate Minimum Order Amount contribution with Separate Prices. I mean, with min order amount contrib, we can set an min amount for all customers. What we have to modify in order to have for each group a min order amount? Thank you all, Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted July 1, 2006 Share Posted July 1, 2006 I'd like to know if it's possible to integrate Minimum Order Amount contribution with Separate Prices.I mean, with min order amount contrib, we can set an min amount for all customers. What we have to modify in order to have for each group a min order amount? A simple version of this has been discussed before (see this post). If you would want to have it for every customer group I think it would be the easiest to have defines for every customer group made up of the MIN_ORDER_AMOUNT followed by the customer group id. You would need to change the line: if ($order->info['subtotal'] < MIN_ORDER_AMOUNT) { to: if ($order->info['subtotal'] < MIN_ORDER_AMOUNT . $customer_group_id ) { You might have to check if $customer_group_id is set as this point, or perhaps you can get away with it by using the same minimum order amount for the define MIN_ORDER_AMOUNT and MIN_ORDER_AMOUNT0. Then add the sql queries for each group: INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Minimum Order Amount for retail', 'MIN_ORDER_AMOUNT0', '', 'The minimum amount an order must total to be able to checkout. Empty means no minimum.', '1', '23', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Minimum Order Amount for Wholesale', 'MIN_ORDER_AMOUNT1', '', 'The minimum amount an order must total to be able to checkout. Empty means no minimum.', '1', '23', now()); I haven't tried this... :) Quote Link to comment Share on other sites More sharing options...
invasi0n Posted July 1, 2006 Share Posted July 1, 2006 A simple version of this has been discussed before (see this post). If you would want to have it for every customer group I think it would be the easiest to have defines for every customer group made up of the MIN_ORDER_AMOUNT followed by the customer group id. You would need to change the line: if ($order->info['subtotal'] < MIN_ORDER_AMOUNT) { to: if ($order->info['subtotal'] < MIN_ORDER_AMOUNT . $customer_group_id ) { You might have to check if $customer_group_id is set as this point, or perhaps you can get away with it by using the same minimum order amount for the define MIN_ORDER_AMOUNT and MIN_ORDER_AMOUNT0. Then add the sql queries for each group: INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Minimum Order Amount for retail', 'MIN_ORDER_AMOUNT0', '', 'The minimum amount an order must total to be able to checkout. Empty means no minimum.', '1', '23', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Minimum Order Amount for Wholesale', 'MIN_ORDER_AMOUNT1', '', 'The minimum amount an order must total to be able to checkout. Empty means no minimum.', '1', '23', now()); I haven't tried this... :) Thanks for reply, If i add that sql how should i modify shopping_cart.php and check out files? Quote Link to comment Share on other sites More sharing options...
invasi0n Posted July 1, 2006 Share Posted July 1, 2006 but i think the best way is to modify somehow admin/customers_groups.php, to add there a min order field Quote Link to comment Share on other sites More sharing options...
beruska77 Posted July 2, 2006 Share Posted July 2, 2006 Said, Below would be the admin part for hide categories for groups for SPPC. You already did the sql query needed: SQL query needed for this mod hi janZ, thanks for your code... it works perfekt! the only problem is i have categories_description installed and a few other bits and bobs! i can only use it when i turn the categories description off. i cant get it to show the buttons linke the hide products! i have copied code and modified it like the hiden products but it wont work out! can you help me on that issue??? Best Reagrds Beruska Quote Link to comment Share on other sites More sharing options...
xearoth Posted July 5, 2006 Share Posted July 5, 2006 Guys I have completed the installation and now i am getting this error, can somebody please help me? 1054 - Unknown column 'p.products_id' in 'on clause' Quote Link to comment Share on other sites More sharing options...
Roger_Sweden Posted July 6, 2006 Share Posted July 6, 2006 Thank you for all your help so far JanZ! :thumbsup: Now I have a small problem with "Price_Break_v1_02". When I add diffrent price levels the price up in the right corner in products_info.php gets swapped for a table with the diffrent levels and their prices. Ive managed to edit the look of the table, so "so far so good" :D But, now to my question: in that table it lists the price "inc.VAT" or "ex.VAT". By snooping around in includes/classes/PriceFormatter.php Ive found that it is "taxClass" who does this. But, how to I make it multilingual or change the "inc.VAT" and "ex.VAT" into their Swedish translations? Thanks in advance :) /Roger Quote Link to comment Share on other sites More sharing options...
BoulderDash Posted July 6, 2006 Share Posted July 6, 2006 Hello, Ever since adding this most excellent osC Contribution... whenever anyone logs in, they are sent to an unsecure (http) "/account.php" page. My question is this: - How can I force osC to send people to a secure (https) "/account.php" page? Thank you so much in advance, BD Quote Link to comment Share on other sites More sharing options...
Roger_Sweden Posted July 6, 2006 Share Posted July 6, 2006 Thank you for all your help so far JanZ! :thumbsup: Now I have a small problem with "Price_Break_v1_02". When I add diffrent price levels the price up in the right corner in products_info.php gets swapped for a table with the diffrent levels and their prices. Ive managed to edit the look of the table, so "so far so good" :D But, now to my question: in that table it lists the price "inc.VAT" or "ex.VAT". By snooping around in includes/classes/PriceFormatter.php Ive found that it is "taxClass" who does this. But, how to I make it multilingual or change the "inc.VAT" and "ex.VAT" into their Swedish translations? Thanks in advance :) /Roger Im gonna answer my own question :D in includes/classes/currencies.php the "Switch betwing Inc.VAT/Ex.VAT-contrib"I have installed added the following code: function display_price($products_price, $products_tax, $quantity = 1) { /*return $this->format(tep_add_tax($products_price, $products_tax) * $quantity); */ global $vat_disp; if ($vat_disp == '1') { return $this->format(tep_add_tax($products_price, $products_tax) * $quantity) . ' (inc. VAT)'; } else { return $this->format($products_price * $quantity). ' (ex. VAT)'; } } And as you can see the "inc. VAT" and "ex. VAT" is "hard coded" in the last few lines there. I changed it and now everything works fine :D Quote Link to comment Share on other sites More sharing options...
FrostCS Posted July 7, 2006 Share Posted July 7, 2006 Okay, I have a little problem, I searched and searched this topic, but was unable to find it. It involves advanced_search_result.php I ran into a little clash between extra fields, and seperate pricing per customer. Here is my problem see the file was originally this Line 216 'ish $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price "; if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { $select_str .= ", SUM(tr.tax_rate) as tax_rate "; } $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; That's what I start with ^^, but extra fields wants me to replace this (below) $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; With the following; // START: Extra Fields Contribution // $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; $from_str = "from (" . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS . " p2pef on p.products_id=p2pef.products_id) left join " . TABLE_MANUFACTURERS . " m on m.manufacturers_id=p.manufacturers_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; // END: Extra Fields Contribution But, Seperate Pricing Per Customer tells me to replace all of the first code (top) with // BOF Separate Pricing Per Customer $status_tmp_product_prices_table = false; $status_need_to_get_prices = false; // find out if sorting by price has been requested if ( (isset($HTTP_GET_VARS['sort'])) && (ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) && (substr($HTTP_GET_VARS['sort'], 0, 1) <= sizeof($column_list)) ){ $_sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') { $status_need_to_get_prices = true; } } if ((tep_not_null($pfrom) || tep_not_null($pto) || $status_need_to_get_prices == true) && $customer_group_id != '0') { $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id; // the table with product prices for a particular customer group is re-built only a number of times per hour // (setting in /includes/database_tables.php called MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE, in minutes) // to trigger the update the next function is called (new function that should have been // added to includes/functions/database.php) tep_db_check_age_products_group_prices_cg_table($customer_group_id); $status_tmp_product_prices_table = true; } elseif ((tep_not_null($pfrom) || tep_not_null($pto) || $status_need_to_get_prices == true) && $customer_group_id == '0') { // to be able to sort on retail prices we *need* to get the special prices instead of leaving them // NULL and do product_listing the job of getting the special price // first make sure that table exists and needs no updating tep_db_check_age_specials_retail_table(); $status_tmp_special_prices_table = true; } // end elseif ((tep_not_null($pfrom) || (tep_not_null($pfrom)) && .... if ($status_tmp_product_prices_table == true) { $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, tmp_pp.products_price, p.products_tax_class_id, if(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price "; } elseif ($status_tmp_special_prices_table == true) { $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price "; } else { $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, NULL as specials_new_products_price, NULL as final_price "; } // next line original select query // $select_str = "select distinct " . $select_column_list . " m.manufacturers_id, p.products_id, pd.products_name, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price "; if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) { $select_str .= ", SUM(tr.tax_rate) as tax_rate "; } if ($status_tmp_product_prices_table == true) { $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; } elseif ($status_tmp_special_prices_table == true) { $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id , " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; } else { $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c"; } // EOF Separate Pricing Per Customer What is the best recommendation? I have stopped at this point because I am not so good with code, I am still learning. Any help is greatly appreciated. Thank You. Quote Link to comment Share on other sites More sharing options...
FrostCS Posted July 7, 2006 Share Posted July 7, 2006 Tried to edit, but wouldn't allow me.. I was going to ask, if I should the Seperate pricing per customer code, and abort the extra fields? It looks to me like it's essentially the same code, just Seperate pricing has the special retail pricing and special pricing code in it.. This is probably easy for you to answer.. but it's not for me :-) Quote Link to comment Share on other sites More sharing options...
Guest Posted July 8, 2006 Share Posted July 8, 2006 (edited) Hello. I want to extend SPPC like other contribs for SPPC but for Attributes Price Per Customer. I'm new to create new mods, but have a little experience with PHP. My idea is to place a different price per attribute per customer. I draw a draft with the new table: Name: product_group_attributes Field 1: customers_group_id Field 2: products_options_values_to_products_options_id Field 3: group_options_values_price Field 4 (optional): group_price_prefix This table "link" table products_options_values_to_products_options and customers_group, and set the new prices (and optional prefix) for the attribute but per customer. The hard part is the php modifications. Any help? Thanks Normando Edited July 8, 2006 by PicsOne Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted July 8, 2006 Share Posted July 8, 2006 I want to extend SPPC like other contribs for SPPC but for Attributes Price Per Customer. Part of that is done (the catalog side). See this post on page 54. Never got around to the admin side (popup window from a button perhaps?). Quote Link to comment Share on other sites More sharing options...
Guest Posted July 8, 2006 Share Posted July 8, 2006 Hello JanZ, you are a Guru. I see the code in page 54. I have a question about table (sorry for any mistake). Why not create the table, like SPPC logical model? Name: product_group_attributesField 1: customers_group_id Field 2: products_options_values_to_products_options_id Field 3: group_options_values_price Field 4 (optional): group_price_prefix In this table the connections are through Field 1 and Field 2, because the attributes are already created. This table is similar to table products_groups, where the field product_id is the link (connection) to the product that has defined. In the present case, the field products_options_values_to_products_options_id is the link to the attribute that has the product. Maybe for admin section adapt this contrib? = http://www.oscommerce.com/community/contributions,1119 Sorry for my baaaaddd english, and my little knowledge. Thank you Normando Quote Link to comment Share on other sites More sharing options...
ppruett Posted July 9, 2006 Share Posted July 9, 2006 Apolgies, but this thread is soooo long I may have missed this question: For --Seperate Pricing Per Customer-- looking at http://www.oscommerce.com/community/contributions,716/ The latest community post appears to be Separate Pricing Per Customer v.4.1.4 (bugfix) by idolcemia on 1 Jun 2006 with an newer error comment and another comment for adding german lanuguage files. I looked through the attached zip and the some of the file dates are older that the files included with osCommerce 2.2 Milestone 2 Update 051113 So.... If you are using a new install or have updated to osCommerce 2.2 Milestone 2 Update 051113 just copying the files in the zip over the catalog files from the build may be a bad idea. For contributions that include the files to be changed, we may need to say what build the file was revisioned from.... I can see why many readme files recommend making changes by hand instead of copying, especially if the file will be edited by other contributions... That said... if using v4.1.4 - you may want to hand edit to merge for OS Update 051113 Anyone doing v4.1.5 bug fix, if so, with edited files from Update 051113? Quote Link to comment Share on other sites More sharing options...
ppruett Posted July 9, 2006 Share Posted July 9, 2006 (edited) Of note the contributed v414 has changes from v413 in the catalog/admin/specials.php file that do not appear documented in the manual edits. # diff specials.php-SPPCv413 specials.php-SPPCv414 49,50c49 < // EOF Separate Pricing Per Customer < if (substr($specials_price, -1) == '%') { --- > if (substr($specials_price, -1) == '%' && $customers_group == '0') { 55a55,56 > } elseif (substr($specials_price, -1) == '%' && $customers_group != '0') { > $specials_price = ($products_price - (($specials_price / 100) * $products_price)); 56a58 > // EOF Separate Pricing Per Customer 147a150,156 > > $product = tep_db_fetch_array($product_query); > > $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $product['products_id']. "' and customers_group_id = '" . $product['customers_group_id'] . "'"); > if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) { > $product['products_price']= $customer_group_price['customers_group_price']; > } 149d157 < $product = tep_db_fetch_array($product_query); 151a160 > # Edited July 9, 2006 by ppruett Quote Link to comment Share on other sites More sharing options...
ppruett Posted July 9, 2006 Share Posted July 9, 2006 In the contributed v414 the file catalog/includes/boxes/special.php has additional edits that are not mentioned in the new_install_directions.txt 26c44 < 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_produ ct["products_id"]) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMA LL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_prod uct['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['pr oducts_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $ currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class _id'])) . '</span>'); --- > 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_produ ct['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMA LL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_prod uct['products_id']) . '">' . $random_product['products_name'] . '</a><br><s>' . $currencies->display_price($random_product['pr oducts_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . $ currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class _id'])) . '</span>'); 30c48 < </td> --- > </td> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.