brij_theinvader Posted November 21, 2007 Share Posted November 21, 2007 hi, I have installed SPPC. Its mind blowing contribution. I just wanted to know how can i add facility of invoice or receipt in some customer groups. For example, if there are two groups : retail and dealer. Then , a retailer should get receipt, while dealer should get invoice. Any help will be greatly appreciated. Many thanks, Brij. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 23, 2007 Share Posted November 23, 2007 I just wanted to know how can i add facility of invoice or receipt in some customer groups.For example, if there are two groups : retail and dealer. Then , a retailer should get receipt, while dealer should get invoice. I have never read about a modification like that, it sure is not in SPPC now. I have thought about how you could do that, but I really don't see how because all orders stuff is tied to the customer_id. Quote Link to comment Share on other sites More sharing options...
gaspower Posted November 24, 2007 Share Posted November 24, 2007 Hello, I have been using SPPC for a while and it works great. I just started a new site and I am getting the following error, 1054 - Unknown column 'c.entry_company_tax_id' in 'field list' select c.customers_id, c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, c.entry_company_tax_id, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_group_id, c.customers_group_ra, c.customers_payment_allowed, c.customers_shipment_allowed, c.customers_specific_taxes_exempt, c.customers_default_address_id from customers c left join address_book a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '3' Any help would be great, Thanks JR Quote Link to comment Share on other sites More sharing options...
gaspower Posted November 24, 2007 Share Posted November 24, 2007 Hello, I uploaded a contribution for SPPC, Quick Group Discount Module, (http://addons.oscommerce.com/info/5569/v,22). It allows from admin panel to give complete groups percentage discounts. Example, say you had a group called dealers and currently the discount from retail is 40%, but you wanted to change the entire group to 50%, just go to this panel and set the dealers to 50%, entire group will now reflect 50% off of retail. First contribution, and hope it saves you time. Thanks JR Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 24, 2007 Share Posted November 24, 2007 I have been using SPPC for a while and it works great. I just started a new site and I am getting the following error, 1054 - Unknown column 'c.entry_company_tax_id' in 'field list' This field was moved from the address book table to the customers table in 4.2.0. If it is a new site just add the field using this sql: ALTER TABLE `customers` ADD entry_company_tax_id VARCHAR(32) DEFAULT NULL; Quote Link to comment Share on other sites More sharing options...
gaspower Posted November 24, 2007 Share Posted November 24, 2007 Thank you as always JR Quote Link to comment Share on other sites More sharing options...
brij_theinvader Posted November 25, 2007 Share Posted November 25, 2007 I have thought about how you could do that, but I really don't see how because all orders stuff is tied to the customer_id. Actually i have thought about a way of doing it. I will be differentiating customers based on "Company's Tax Id". If it is set then the customer is a dealer otherwise he is a retailer. Now for the particular customer_id, i will make this test to determine if he is customer or dealer and send an invoice or receipt accordingly. What do you think, is this going to work or not ? Please send me your suggestions. Thanks and Regards, Brijesh. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 25, 2007 Share Posted November 25, 2007 I will be differentiating customers based on "Company's Tax Id". If it is set then the customer is a dealer otherwise he is a retailer. Now for the particular customer_id, i will make this test to determine if he is customer or dealer and send an invoice or receipt accordingly. What do you think, is this going to work or not ? I thought you wanted to give a retail customer (customer group id: 0) a receipt (packing list) but someone else had to pay for it (he gets the invoice). If you want to do things differently for different customer groups just act on their customer group id. The tax id helps to identify customers who need to be put in another group (that why they get alerted with the red dot when they open an account). Quote Link to comment Share on other sites More sharing options...
treycopeland Posted November 25, 2007 Share Posted November 25, 2007 Quote Link to comment Share on other sites More sharing options...
gaspower Posted November 25, 2007 Share Posted November 25, 2007 Hello Jan, I have one site using the SPPC 4.16 version, but for some reason, just noticed it, specials are showing in all groups. I have specials in group 2 (dealers), and it is showing in group 0 (retail)? What should I be looking for to fix? I probably crossed something wrong, but I did check loin.php and specials.php and did not see anything wrong? Thanks JR Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 27, 2007 Share Posted November 27, 2007 I figured out how to get the html field in there with the dropbox that says 'Wholesale' or 'Retail' but received many errors too. That is a lot of not-relevant code you added where the only thing that is needed is to add somewhere where the other post variables are "cleaned": // BOF SPPC $group_id = (int)$_POST['group_id']; // provided the post variable of the customer group id is called group_id and is the same as the "real" customer_group_id // EOF SPPC and then before the info is inserted in the table customers around line 208: tep_db_perform(TABLE_CUSTOMERS, $sql_data_array); you add: // BOF SPPC $sql_data_array['customers_group_id'] = $group_id; // EOF SPPC Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 27, 2007 Share Posted November 27, 2007 I have one site using the SPPC 4.16 version, but for some reason, just noticed it, specials are showing in all groups. I have specials in group 2 (dealers), and it is showing in group 0 (retail)? What should I be looking for to fix? I probably crossed something wrong, but I did check loin.php and specials.php and did not see anything wrong? loin.php? No clue what is wrong. Check that the session you are browsing with contains the right group id. Quote Link to comment Share on other sites More sharing options...
ksource Posted November 27, 2007 Share Posted November 27, 2007 I was wondering if this works with a custom template install, ie templatemonster ones. I got one for a company that I work for and it seems that using this messes up the tables and all the images. Is it safe to assume this wont work with custom templates? Do I need to go through the manual install to get it working. Quote Link to comment Share on other sites More sharing options...
TracyS Posted November 28, 2007 Share Posted November 28, 2007 I would think it would work just fine - but you would need to do a manual install because your table code is going to be different from the stock osc table code (which is the template this contribution was created with). It might be easier to install the SPPC on a clean osC install, and then make the manual edits for the template. Another option would be to use STS for your templates. I was wondering if this works with a custom template install, ie templatemonster ones. I got one for a company that I work for and it seems that using this messes up the tables and all the images. Is it safe to assume this wont work with custom templates? Do I need to go through the manual install to get it working. Quote ~Tracy Link to comment Share on other sites More sharing options...
ksource Posted November 28, 2007 Share Posted November 28, 2007 I would think it would work just fine - but you would need to do a manual install because your table code is going to be different from the stock osc table code (which is the template this contribution was created with). It might be easier to install the SPPC on a clean osC install, and then make the manual edits for the template. Another option would be to use STS for your templates. I may go with STS if all else failed, the company paid for a template so I need to do as best as I can. Thanks for the help, I guess what I feared needed to be done, needs to be done. :lol: Quote Link to comment Share on other sites More sharing options...
TracyS Posted November 28, 2007 Share Posted November 28, 2007 Did you check all three specials.php files? catalog/admin/specials.php catalog/specials.php catalog/includes/boxes/specials.php loin.php? No clue what is wrong. Check that the session you are browsing with contains the right group id. Quote ~Tracy Link to comment Share on other sites More sharing options...
Teamjr Posted November 28, 2007 Share Posted November 28, 2007 Thank you, I missed the includes/boxes/specials.php JR Quote Link to comment Share on other sites More sharing options...
ksource Posted November 29, 2007 Share Posted November 29, 2007 Doing the manual install into a custom layout, I've hit a stump at new_products.php I don't know which code to inject into my file as it is not the original file, so where to replace is off as well as how much content to replace is different. If someone can direct me which pieces of code needs to go into which section that would be great, if not then I may just not use the new products. <?php /* $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $ adapted for Separate Pricing Per Customer v4.2 2007/08/10 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); // new contentBoxHeading($info_box_contents); if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } $row = 0; $col = 0; $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { $new_products['products_name'] = tep_get_products_name($new_products['products_id']); // ---------- $product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$new_products['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); $product = tep_db_fetch_array($product_query); $p_id = $product['products_id']; $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; $p_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a>'; $p_desc = ''.substr($product['products_description'], 0, MAX_DESCR_1); $p_price = '<span class="productSpecialPrice">'.$currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])).'</span>'; $info_box_contents[$row][$col] = array('align' => 'center', 'params' => ' style="width:50%;"', 'text' => ' <table cellpadding="0" cellspacing="0" border="0" style="height:294px;"> <tr> <td> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td style="height:71px; border:1px solid #FFFFFF; border-width:23px 0 0 13px "> '.$p_name.'<br> <br style="line-height:21px"> '.tep_image(DIR_WS_IMAGES.'1_li.gif').'<br> </td> </tr> <tr> <td class="pic" align="center">'.$p_pic.'</td> </tr> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" style="height:89px "> <tr> <td style="width:45%;" align="center" class="vam">'.$p_price.'</td> <td>'.tep_image(DIR_WS_IMAGES.'z.gif').'</td> <td style="width:50%;" class="vam" align="center"> <table cellpadding="0" cellspacing="0" border="0" style="width:1px;"> <tr><td><a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a><br style="line-height:1px;"><br style="line-height:8px;"><a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart1.gif').'</a></td></tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> '); $col ++; if ($col > 1) { $col = 0; $row ++; } } new contentBox($info_box_contents); ?> <!-- new_products_eof //--> Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 29, 2007 Share Posted November 29, 2007 Doing the manual install into a custom layout, I've hit a stump at new_products.php I don't know which code to inject into my file as it is not the original file, so where to replace is off as well as how much content to replace is different. If someone can direct me which pieces of code needs to go into which section that would be great, if not then I may just not use the new products. Do these template makers get paid by the mysql query they generate? One for the module and then two for each product (querying first for the name in products_description and then again for the products_description). Great. Fixed that here if you don't mind :) <?php /* $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $ adapted for Separate Pricing Per Customer v4.2 2007/11/29 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); // new contentBoxHeading($info_box_contents); if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { // BOF Separate Pricing Per Customer $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_description from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } else { $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name, pd.products_description from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS); } // global variable (session) $sppc_customer_group_id -> local variable customer_group_id if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') { $customer_group_id = $_SESSION['sppc_customer_group_id']; } else { $customer_group_id = '0'; } if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0) { while ($_new_products = tep_db_fetch_array($new_products_query)) { $new_products[] = $_new_products; $list_of_prdct_ids[] = $_new_products['products_id']; } $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' "; if ($no_of_new_products > 1) { for ($n = 1; $n < count($list_of_prdct_ids); $n++) { $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' "; } } // get all customers_group_prices for products with the particular customer_group_id // however not necessary for customer_group_id = 0 if ($customer_group_id != '0') { $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."'"); while ($pg_array = tep_db_fetch_array($pg_query)) { $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => ''); } for ($x = 0; $x < $no_of_new_products; $x++) { // replace products prices with those from customers_group table if(!empty($new_prices)) { for ($i = 0; $i < count($new_prices); $i++) { if( $new_products[$x]['products_id'] == $new_prices[$i]['products_id'] ) { $new_products[$x]['products_price'] = $new_prices[$i]['products_price']; } } } // end if(!empty($new_prices) } // end for ($x = 0; $x < $no_of_products_new; $x++) } // end if ($customer_group_id != '0') // an extra query is needed for all the specials $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "' "); while ($specials_array = tep_db_fetch_array($specials_query)) { $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'specials_new_products_price' => $specials_array['specials_new_products_price']); } // replace products_price with the correct specials_new_products_price if(!empty($new_s_prices)) { for ($x = 0; $x < $no_of_new_products; $x++) { for ($i = 0; $i < count($new_s_prices); $i++) { if( $new_products[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) { $new_products[$x]['products_price'] = $new_s_prices[$i]['specials_new_products_price']; } } } } // // end if(!empty($new_s_prices) $row = 0; $col = 0; $info_box_contents = array(); // while ($new_products = tep_db_fetch_array($new_products_query)) { for ($x = 0; $x < $no_of_new_products; $x++) { // $new_products['products_name'] = tep_get_products_name($new_products['products_id']); // ---------- /* $product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$new_products['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); $product = tep_db_fetch_array($product_query); */ $p_id = $new_products[$x]['products_id']; $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; $p_name = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a>'; $p_desc = ''.substr($new_products[$x]['products_description'], 0, MAX_DESCR_1); $p_price = '<span class="productSpecialPrice">'.$currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])).'</span>'; $info_box_contents[$row][$col] = array('align' => 'center', 'params' => ' style="width:50%;"', 'text' => ' <table cellpadding="0" cellspacing="0" border="0" style="height:294px;"> <tr> <td> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td style="height:71px; border:1px solid #FFFFFF; border-width:23px 0 0 13px "> '.$p_name.'<br> <br style="line-height:21px"> '.tep_image(DIR_WS_IMAGES.'1_li.gif').'<br> </td> </tr> <tr> <td class="pic" align="center">'.$p_pic.'</td> </tr> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" style="height:89px "> <tr> <td style="width:45%;" align="center" class="vam">'.$p_price.'</td> <td>'.tep_image(DIR_WS_IMAGES.'z.gif').'</td> <td style="width:50%;" class="vam" align="center"> <table cellpadding="0" cellspacing="0" border="0" style="width:1px;"> <tr><td><a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a><br style="line-height:1px;"><br style="line-height:8px;"><a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart1.gif').'</a></td></tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> '); $col ++; if ($col > 1) { $col = 0; $row ++; } } } // end if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0) new contentBox($info_box_contents); ?> <!-- new_products_eof //--> Quote Link to comment Share on other sites More sharing options...
Guest Posted November 30, 2007 Share Posted November 30, 2007 (edited) Hi JanZ, I have started a whole new fresh copy of the cart and added SPPC first this time. I've also got Price Break, Hide Categories and Multi Columns loaded and working. I'm trying to get the Actual Attributes Price to work with it and am having trouble integrating it into the files. I got an error on the shopping_cart.php page Parse error: syntax error, unexpected T_ELSE, expecting T_FUNCTION in /home/infinity/public_html/catalog/includes/classes/shopping_cart.php on line 530 Here is the part of the page with the problem: // function attributes_price changed partially according to FalseDawn's post // [url="http://www.oscommerce.com/forums/index.php?showtopic=139587"]http://www.oscommerce.com/forums/index.php?showtopic=139587[/url] // changed completely for Separate Pricing Per Customer, attributes mod function attributes_price($products_id) { // global variable (session) $sppc_customer_group_id -> class variable cg_id $this->cg_id = $this->get_customer_group_id(); if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); $where = " AND (("; while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $where .= "options_id = '" . (int)$option . "' AND options_values_id = '" . (int)$value . "') OR ("; } $where=substr($where, 0, -5) . ')'; $attribute_price_query = tep_db_query("SELECT products_attributes_id, options_values_price, price_prefix FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . (int)$products_id . "'" . $where .""); if (tep_db_num_rows($attribute_price_query)) { $list_of_prdcts_attributes_id = ''; while ($attributes_price_array = tep_db_fetch_array($attribute_price_query)) { $attribute_price[] = $attributes_price_array; $list_of_prdcts_attributes_id .= $attributes_price_array['products_attributes_id'].","; } if (tep_not_null($list_of_prdcts_attributes_id) && $this->cg_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 = '" . $this->cg_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($attribute_price); $n++) { for ($i = 0; $i < count($cg_attr_prices) ; $i++) { if ($cg_attr_prices[$i]['products_attributes_id'] == $attribute_price[$n]['products_attributes_id']) { $attribute_price[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix']; $attribute_price[$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') // now loop through array $attribute_price to add up/substract attribute prices for ($n = 0 ; $n < count($attribute_price); $n++) { if ($attribute_price[$n]['price_prefix'] == '+') { $attributes_price += $attribute_price[$n]['options_values_price']; //BOF PHPMOM.COM AAP } elseif ($attribute_price[$n]['price_prefix'] == '-') { $attributes_price -= $attribute_price[$n]['options_values_price']; } else $attributes_price+= $attribute_price[$n]['options_values_price']; } } //EOF PHPMOM.COM AAP } // end for ($n = 0 ; $n < count($attribute_price); $n++) return $attributes_price; } else { // end if (tep_db_num_rows($attribute_price_query)) return 0; } } else { // end if (isset($this->contents[$products_id]['attributes'])) return 0; } } // end of function attributes_price, modified for SPPC with attributes function get_products() { global $languages_id; // BOF Separate Pricing Per Customer v4, Price Break 1.11.3 modification if (!is_array($this->contents)) return false; $pf = new PriceFormatter; $products_array = array(); reset($this->contents); while (list($products_id, ) = each($this->contents)) { /* $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); if ($products = tep_db_fetch_array($products_query)) { $prid = $products['products_id']; $products_price = $products['products_price']; $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'"); if (tep_db_num_rows($specials_query)) { $specials = tep_db_fetch_array($specials_query); $products_price = $specials['specials_new_products_price']; } */ if ($products = $pf->loadProduct($products_id, $languages_id)) { $products_price = $pf->computePrice($this->contents[$products_id]['qty']); // EOF Separate Pricing Per Customer v4, Price Break 1.11.3 modification //BOF PHPMOM.COM AAP//hadir $attributes_price = 0; if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list($option, $value) = each($this->contents[$products_id]['attributes'])) { $attribute_price_query = tep_db_query("select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "' and options_id = '" . (int)$option . "' and options_values_id = '" . (int)$value . "'"); $attribute_price = tep_db_fetch_array($attribute_price_query); if ($attribute_price['price_prefix'] == '') { $attributes_price += ($attribute_price['options_values_price']-$products_price); } elseif ($attribute_price['price_prefix'] == '+') { $attributes_price += $attribute_price['options_values_price']; } elseif ($attribute_price['price_prefix'] == '-') { $attributes_price -= $attribute_price['options_values_price']; } } } //eof actual attribute//hadir $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price, 'quantity' => $this->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => ($products_price + $attributes_price), 'attributes_price' => $attributes_price, //phpmom.com//aap 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => (isset($this->contents[$products_id]['attributes']) ? $this->contents[$products_id]['attributes'] : '')); } } return $products_array; } function show_total() { $this->calculate(); return $this->total; } function show_weight() { $this->calculate(); return $this->weight; } function generate_cart_id($length = 5) { return tep_create_random_value($length, 'digits'); } function get_content_type() { $this->content_type = false; if ( (DOWNLOAD_ENABLED == 'true') && ($this->count_contents() > 0) ) { reset($this->contents); while (list($products_id, ) = each($this->contents)) { if (isset($this->contents[$products_id]['attributes'])) { reset($this->contents[$products_id]['attributes']); while (list(, $value) = each($this->contents[$products_id]['attributes'])) { $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$products_id . "' and pa.options_values_id = '" . (int)$value . "' and pa.products_attributes_id = pad.products_attributes_id"); $virtual_check = tep_db_fetch_array($virtual_check_query); if ($virtual_check['total'] > 0) { switch ($this->content_type) { case 'physical': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'virtual'; break; } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } else { switch ($this->content_type) { case 'virtual': $this->content_type = 'mixed'; return $this->content_type; break; default: $this->content_type = 'physical'; break; } } } } else { $this->content_type = 'physical'; } return $this->content_type; } function unserialize($broken) { for(reset($broken);$kv=each($broken);) { $key=$kv['key']; if (gettype($this->$key)!="user function") $this->$key=$kv['value']; } } // added for Separate Pricing Per Customer, returns customer_group_id function get_customer_group_id() { if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') { $_cg_id = $_SESSION['sppc_customer_group_id']; } else { $_cg_id = 0; } return $_cg_id; } } ?> Could you take a look at it and see where I went wrong? Thanks! Joanne Edited November 30, 2007 by reelwild Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted November 30, 2007 Share Posted November 30, 2007 I'm trying to get the Actual Attributes Price to work with it and am having trouble integrating it into the files. I got an error on the shopping_cart.php page Parse error: syntax error, unexpected T_ELSE, expecting T_FUNCTION in /home/infinity/public_html/catalog/includes/classes/shopping_cart.php on line 530 This piece seemed to have braces missing and/or misplaced: } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') // now loop through array $attribute_price to add up/substract attribute prices for ($n = 0; $n < count($attribute_price); $n++) { if ($attribute_price[$n]['price_prefix'] == '+') { $attributes_price += $attribute_price[$n]['options_values_price']; //BOF PHPMOM.COM AAP } elseif ($attribute_price[$n]['price_prefix'] == '-') { $attributes_price -= $attribute_price[$n]['options_values_price']; } else { // this brace seemed missing, there was another one too much later on $attributes_price+= $attribute_price[$n]['options_values_price']; } //EOF PHPMOM.COM AAP } // end for ($n = 0; $n < count($attribute_price); $n++) return $attributes_price; } else { // end if (tep_db_num_rows($attribute_price_query)) return 0; } } else { // end if (isset($this->contents[$products_id]['attributes'])) return 0; } } // end of function attributes_price, modified for SPPC with attributes Quote Link to comment Share on other sites More sharing options...
Guest Posted December 1, 2007 Share Posted December 1, 2007 That was it, thanks! This piece seemed to have braces missing and/or misplaced: Quote Link to comment Share on other sites More sharing options...
Steef Posted December 3, 2007 Share Posted December 3, 2007 Hi, I have been searching the net for hours now, but can't find a solution for this: 1109 - Unknown table 'pd' in where clause select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id) where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ((pd.products_name like '%test%' or p.products_model like '%test%' or m.manufacturers_name like '%test%') ) [TEP STOP] This error showed up at the advanced search result page after installing the SPPC contrib. Hopefully you can help me! Best, Stefan Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted December 3, 2007 Share Posted December 3, 2007 1109 - Unknown table 'pd' in where clause What about downloading 4.2.0 and using the includes/modules/product_listing.php and perhaps advanced_search.php. This doesn't look like a MySQL safe query (actually pd usually refers to products_description but that table is not used in this query, nor is pd declared). Quote Link to comment Share on other sites More sharing options...
Guest Posted December 3, 2007 Share Posted December 3, 2007 Jan, I've got a problem in the admin with the customer and customer groups. No changes are being saved after trying to update any of the fields in either of these areas. This is the same problem I had before when I had Multi Shops installed (which is now gone). What files will I need to look at to see where I went wrong? Thanks, joanne 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.