TracyS Posted February 15, 2007 Share Posted February 15, 2007 yes i have enabled that payment and the credit card... only the credit card is shown in the payment method This may seem like a redundant question - but I've been known to miss admin settings before so figured I'd ask :blush: Did you enable it in both Admin->Modules->Payment AND in Admin->Customers->Customer Groups chose the Use Settings from Configuration option, or if both payment options show there you could choose Set Payment Modules for the Customer Group and then checkbox those two. I would personally test both methods (Use Settings and Set Payment) just to see if one is working and the other isn't. If nothing else it might help debug :blush: Quote ~Tracy Link to comment Share on other sites More sharing options...
TracyS Posted February 16, 2007 Share Posted February 16, 2007 That is in application_top.php (the SPPC update, see the upgrade_instructions.txt). If you look up PriceFormatter.php (the class) you can see how the object is used: IMO you can do something similar, but you have to loop through the part of that array that has as key (categories_id) to get all the products in that category in your menu. Well - I am quite confused, but trying :blush: Does this look like I'm even close to the ballpark with what you recommended doing? :huh: In application_top I put this // products in category for DynaMenu require(DIR_WS_CLASSES . 'ProductsInCategory.php'); $pic = new ProductsInCategory; Then I created a file in includes/classes/ and named it ProductsInCategory.php class ProductsInCategory { function ProductsInCategory($category_id, $language = '', $include_inactive = false) { global $languages_id, $customer_group_id; if (empty($language)) $language = $languages_id; while ($products_query = tep_db_fetch_array($products_query)) { $products_query_array = array(); $products_query_temp_array = explode(",", $products_query); foreach ($product_query_temp_array as $key => $categoriesId) { $categoriesId = $products_query['.$category_id.']; if (tep_not_null($categoriesId)){ $product_query_array[] = $categoriesId; } } unset($product_query); $product_query = implode(",", $product_query_array); if ($include_inactive) { $products_query = tep_db_query("select p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' AND pd.language_id = '" . (int)$language . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and p.products_id = pd.products_id AND p.products_master_status='1' order by p.products_sort_order asc, pd.products_name"); } else { $products_query = tep_db_query("select p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' AND pd.language_id = '" . (int)$language . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and p.products_id = pd.products_id AND p.products_master_status='1' order by p.products_sort_order asc, pd.products_name"); } $products_query = tep_ProductsInCategory($key) while ($ProductsInCategory = tep_db_fetch_array($products_query)) { $product_id_h = 'products_id='.$ProductsInCategory ['product_id']; $product_name_h = $ProductsInCategory ['product']; if ($GLOBALS['products_id'] == $ProductsInCategory ['product_id'] { $that_expanded = '1'; $that_selected = 'dmselected'; } else { $that_expanded = ''; $that_selected = ''; } if ($menu_use_titles) { $that_title = $product_name_h; } else { $that_title = ''; } $output .= str_repeat(".", $level+2).'|'.$product_name_h.'|'.tep_href_link(FILENAME_PRODUCT_INFO, $product_id_h).'|'.$that_title.'|'.$menu_icon_file.'|'.$that_selected.'|'.$that_expanded."\n"; } } But I am thinking I messed it up as now I have no idea what I should put in the includes/boxes/dm_categories.php file in place of this code: $products_in_category_query = tep_products_in_category($key); while ($products_in_category = tep_db_fetch_array($products_in_category_query)) { $product_id_h = 'products_id='.$products_in_category ['product_id']; $product_name_h = $products_in_category ['product']; if ($GLOBALS['products_id'] == $products_in_category ['product_id']) { $that_expanded = '1'; $that_selected = 'dmselected'; } else { $that_expanded = ''; $that_selected = ''; } if ($menu_use_titles) { $that_title = $product_name_h; } else { $that_title = ''; } $output .= str_repeat(".", $level+2).'|'.$product_name_h.'|'.tep_href_link(FILENAME_PRODUCT_INFO, $product_id_h).'|'.$that_title.'|'.$menu_icon_file.'|'.$that_selected.'|'.$that_expanded."\n"; } Does this look like I'm as confused as I feel? :blink: Or am I (hopefully) at least on the right track - LOL :blush: Quote ~Tracy Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 16, 2007 Share Posted February 16, 2007 Well - I am quite confused, but trying :blush: Does this look like I'm even close to the ballpark with what you recommended doing? Far too complicated. The only thing that you need is to get the info that is gotten by querying one by one in one big query and store that info for later use. I guess this might work (have not tried the code) and you can obviously try it out by outputting the contents of it (print_r ($pic)) in a footer or something: <?php class ProductsInCategory { var $pic_data = array(); function ProductsInCategory() { global $languages_id; if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') { $this->cg_id = (int)$_SESSION['sppc_customer_group_id']; } else { $this->cg_id = 0; } $products_query = tep_db_query("select p2c.categories_id, p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id AND pd.language_id = '" . (int)$language . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and p.products_id = pd.products_id AND p.products_master_status='1' order by p2c.categories_id, p.products_sort_order asc, pd.products_name"); while ($product_info = tep_db_fetch_array($products_query)) { $this->addProductsInCategory($product_info['categories_id'], $product_info); } // end while ($product_info = tep_db_fetch_array($products_query)) } // end function ProductsInCategory function addProductsInCategory ($categories_id, $product_info) { $this->pic_data[$categories_id][] = array('products_id' => $product_info['products_id'], 'products_name' => $product_info['product'], // we already know the category but might be handy to have it here too 'products_category' => $categories_id); } } Quote Link to comment Share on other sites More sharing options...
TracyS Posted February 16, 2007 Share Posted February 16, 2007 Far too complicated. The only thing that you need is to get the info that is gotten by querying one by one in one big query and store that info for later use. I guess this might work (have not tried the code) and you can obviously try it out by outputting the contents of it (print_r ($pic)) in a footer or something: Thank you Jan! I can believe I was over-complicating it. I have a tendency to do that - LOL :blush: But I'm still confused as to what I would change the dm_categories.php code to :huh: for example - would $products_in_category_query = tep_products_in_category($key) now become $products_in_category_query - $pic ? Do I still need the ($key) bit? Or do I use the $pic here while ($products_in_category = tep_db_fetch_array($pic)) Since the object $pic is defined in application_top do I don't need to include the new classes/ProductInCategory.php file right? I just need to figure out how to take the data collected from it, through the $pic in application_top, and put it into the bit of code on dm_categories.php right? BTW - How did you learn all of this? Some of it is just mind boggling when trying to learn on the fly :blush: Quote ~Tracy Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 16, 2007 Share Posted February 16, 2007 i tried making the changes you suggested above but the product_listing.php is still showing only 1 product cloned multiple times... i enabled some debug code on the page to echo whats happening and you can see in the output text that the products are different in the array but down the page it still shows the one product multiple times, have a look at this link to see what i mean Actually, you forgot about three $listing's in the code. The trickiest one is the fact that $product_contents is not reset (nulled) so it stays the same all the time. The code that is working for me (starts around line 251, not till the end): $product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing[$x]['products_id'] . "' and language_id = '" . (int)1 . "'"); $product = tep_db_fetch_array($product_query); $new_products['products_description'] = $product['products_description']; echo ' <td valign="top" bgcolor="#E9E6E3"> <table width="100%" cellpadding="0" cellspacing="0"> <tr> <td valign="top"> <table cellpadding="0" border="0" cellspacing="0" width=100%> <tr> <td width="1"></td> <td valign="top"> <table width="100%" border=0 cellpadding="0" cellspacing="0"> <tr><td height=19 valign=top><br><div align="center">'.$product_contents[1].'</div></td></tr> <tr> <td><br><div align="center"> '.$product_contents[0].' </div><div align="left"></div></td> </tr> <tr><td><div align="center"><b>Price:</b></div></td></tr> <tr> <td height=30 valign=middle><div align="center"><span class="ch3">'.$product_contents[2].'</span></div></td> </tr> <tr><td> <table align="center" cellpadding="0" cellspacing="0"> <tr><td height="5"></td></tr> <tr> <td width="100" valign="top"> <table width="120" cellpadding="0" border="0" cellspacing="0"> <tr> <td><div align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('small_view.gif') . '</a></div></td> <td width="4"><div align="center"></div></td> <td><div align="center"><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif') . '</a></div></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> '; $column ++; if ($column >= 2) { $rows ++; $column = 0; echo ' </tr> <tr> '; } else echo ' '; // make sure $product_contents is filled with new stuff: unset($product_contents); } Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 16, 2007 Share Posted February 16, 2007 But I'm still confused as to what I would change the dm_categories.php code to :huh: for example - would $products_in_category_query = tep_products_in_category($key) now become $products_in_category_query - $pic ? Do I still need the ($key) bit? Or do I use the $pic here while ($products_in_category = tep_db_fetch_array($pic)) Since the object $pic is defined in application_top do I don't need to include the new classes/ProductInCategory.php file right? Right. I just need to figure out how to take the data collected from it, through the $pic in application_top, and put it into the bit of code on dm_categories.php right?For good measure you should print_r($pic) to check if it contains all the correct data.Then perhaps the easiest way would be to add a function to ProductsInCategory that returns the same array of products that $products_in_category_query would have given (haven't checked that). So in the class you would have something like: function getProductsInCategory($categories_id) { if (isset($this->pic_data[$categories_id])) { foreach ($this->pic_data[$categories_id] as $key => $_product_data) { $product_data[] = $_product_data; } } else { // do the product query you normally would have done for the category, just in case // get the results, add them to the array $product_data } // add some code that if $product_data is not set or empty return false // at any rate return the info return $product_data; } Then in your menu code instead of the $products_in_category_query you should use something along the line of: $_products_in_category_array = $pic->getProductsInCategory($key); // returns false if no products in the category if ($_products_in_category_array != false) { $products_in_category_array = $_products_in_category_array; You get returned an array if all goes well, so you have to loop through that with a foreach. BTW - How did you learn all of this? Some of it is just mind boggling when trying to learn on the fly Read about a stack of books two feet high, and tried making code work (for a hundreds of hours surely) ;) Quote Link to comment Share on other sites More sharing options...
EspenA Posted February 17, 2007 Share Posted February 17, 2007 A few more questions... - It's not possible to change a user group. No error messages, but it's always set to the default value (1). Any ideas? - I can't figure out how I assign discount up against user groups. Help please? Thanks. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 17, 2007 Share Posted February 17, 2007 - It's not possible to change a user group. No error messages, but it's always set to the default value (1). Any ideas? Perhaps you have a register_globals issue? Use a text editor to do a Find and Replace: HTTP_GET_VARS => _GET HTTP_POST_VARS => _POST That should solve any register globals problems. Otherwise use phpMyAdmin, it only makes changes in one table (customers_groups). - I can't figure out how I assign discount up against user groups. Help please? You can't. It is set for each individual product. You can ofcourse fill the table with customer group prices with a simple sql query in phpMyAdmin (change where appropriate, like factor for discount and customer group): insert into products_groups select '1' AS customers_group_id, (0.8 * p.products_price) AS customers_group_price, p.products_id FROM products p; Make sure there are no entries for that customer group in the table otherwise you will get an error message on the way and only a partly filled table (delete from products_groups where customer_group_id ='1';). Quote Link to comment Share on other sites More sharing options...
1Putts Posted February 17, 2007 Share Posted February 17, 2007 Is it possible to show retail price, special price & wholesale price all at once? For reasons unknown to me, the shop I'm working on has a retail price for all products but they are also all on "special". When a wholesaler looks at pricing, he sees only the "retail" (which is never the actual price since everything is on sale) and his "wholesale" but not the "special" price. Also, is there a way of capturing the customer group id with each order so that it can subsequently be displayed on the Orders page? Thanks in advance and great contribution! Quote Link to comment Share on other sites More sharing options...
EspenA Posted February 17, 2007 Share Posted February 17, 2007 Perhaps you have a register_globals issue? Use a text editor to do a Find and Replace: HTTP_GET_VARS => _GET HTTP_POST_VARS => _POST Still the same problem, but I noticed that the correct customer_group ID is shown on the "confirmation page" right after the form has been submitted, but it is apparently not saved in the database? Quote Link to comment Share on other sites More sharing options...
241 Posted February 17, 2007 Share Posted February 17, 2007 I have gone through the contributions section installing my way through the various files for SPPC I am now receiving this error 1052 - Column 'products_id' in where clause is ambiguous select products_status, options_id, options_values_id, attributes_hide_from_groups, '0' as hide_attr_status from products left join products_attributes using(products_id) where products_id = '923' The query is for the attributes part of catalog/includes/classes/shopping_cart.php if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) { // BOF SPPC attribute hide check, original query expanded to include attributes $check_product_query = tep_db_query("select products_status, options_id, options_values_id, attributes_hide_from_groups, '0' as hide_attr_status from " . TABLE_PRODUCTS . " left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where products_id = '" . (int)$products_id . "'"); The error is from product_listing.php (which uses buy_now) and product_info.php (which uses add_product) when trying to add an item to the cart. The item does not have any attributes. the catalog/includes/application_top.php is using case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) { // BOF price-break-1.11.3 $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['cart_quantity'], $HTTP_POST_VARS['id']); // EOF price-break-1.11.3 } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; // performed by the 'buy now' button in product listings and review page case 'buy_now' : if (isset($HTTP_GET_VARS['products_id'])) { if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) { tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id'])); } else { $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1); } } tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters))); break; Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 17, 2007 Share Posted February 17, 2007 Arther,? I am now receiving this error 1052 - Column 'products_id' in where clause is ambiguous select products_status, options_id, options_values_id, attributes_hide_from_groups, '0' as hide_attr_status from products left join products_attributes using(products_id) where products_id = '923' The query is for the attributes part of catalog/includes/classes/shopping_cart.php if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) { // BOF SPPC attribute hide check, original query expanded to include attributes $check_product_query = tep_db_query("select products_status, options_id, options_values_id, attributes_hide_from_groups, '0' as hide_attr_status from " . TABLE_PRODUCTS . " left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where products_id = '" . (int)$products_id . "'"); For the sql it shouldn't matter which products_id (from which table) it should be because it is a join using products_id. Interestingly, MySQL5 has no problem with it, but MySQL4 does apparently. I have it changed to this in my last version (catalog/includes/classes/shopping_cart.php): if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) { // BOF SPPC attribute hide check, original query expanded to include attributes $check_product_query = tep_db_query("select p.products_status, options_id, options_values_id, IF(find_in_set('" . $this->cg_id . "', attributes_hide_from_groups) = 0, '0', '1') as hide_attr_status from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where p.products_id = '" . (int)$products_id . "'"); There is also a > missing close to the code for the save button in admin/attributes_groups.php. On Safari no problem, most other browsers did have a problem with it (rightly so of course) obscuring the save button. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 17, 2007 Share Posted February 17, 2007 Is it possible to show retail price, special price & wholesale price all at once? For reasons unknown to me, the shop I'm working on has a retail price for all products but they are also all on "special". When a wholesaler looks at pricing, he sees only the "retail" (which is never the actual price since everything is on sale) and his "wholesale" but not the "special" price. Sure, but you will need to rewrite some code on product_info.php. Now it gets the special price for the logged-in customer or visitor with: if ($new_price = tep_get_products_special_price($product_info['products_id'])) { The function tep_get_products_special_price uses the customer group id for the lookup. I think it would be best to get all the special prices and customer_group_id's for the particular products_id and echo'ing the ones you need on the appropriate places. Also, is there a way of capturing the customer group id with each order so that it can subsequently be displayed on the Orders page? Since the customer already belongs to a customer_group it is of little use to separately store it. To display the customer group of the customer in admin/orders.php look at this post on page 128. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 17, 2007 Share Posted February 17, 2007 Still the same problem, but I noticed that the correct customer_group ID is shown on the "confirmation page" right after the form has been submitted, but it is apparently not saved in the database? It looks like I don't understand what the problem is. You can change the name of a customer group (plus shipping, tax, and payment options), you can delete a customer group and you can add a customer group. You cannot change the number of the group (customer group id), the code does that on inserting it in the database. Changing the number has repurcussions on everything. Prices in tables etc. are suddenly without customer group etc. Quote Link to comment Share on other sites More sharing options...
EspenA Posted February 18, 2007 Share Posted February 18, 2007 It looks like I don't understand what the problem is. You can change the name of a customer group (plus shipping, tax, and payment options), you can delete a customer group and you can add a customer group. You cannot change the number of the group (customer group id), the code does that on inserting it in the database. Changing the number has repurcussions on everything. Prices in tables etc. are suddenly without customer group etc. To reproduce: 1) Go to /admin/customers.php?selected_box=customers 2) Select a customer with an assigned customer group and select "Edit" 3) Now, shouldn't it be possible to change the customer group for this customer? Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 18, 2007 Share Posted February 18, 2007 To reproduce: 1) Go to /admin/customers.php?selected_box=customers 2) Select a customer with an assigned customer group and select "Edit" 3) Now, shouldn't it be possible to change the customer group for this customer? Well, of course and it works fine for me. If it is a register_globals thing: change the $HTTP_POST_VARS in the SPPC specific code to $_POST. However, you mentioned a default value of '1'. The default value of any SPPC installation is '0' (retail). The code assumes a visitor to the shop is in that group and will show prices for that group. When someone opens an account he/she is put in that group (because the default value for that column in the database is zero). Quote Link to comment Share on other sites More sharing options...
1Putts Posted February 18, 2007 Share Posted February 18, 2007 Sure, but you will need to rewrite some code on product_info.php. Now it gets the special price for the logged-in customer or visitor with: if ($new_price = tep_get_products_special_price($product_info['products_id'])) { The function tep_get_products_special_price uses the customer group id for the lookup. I think it would be best to get all the special prices and customer_group_id's for the particular products_id and echo'ing the ones you need on the appropriate places. Since the customer already belongs to a customer_group it is of little use to separately store it. To display the customer group of the customer in admin/orders.php look at this post on page 128. Thank you for the helpful response. I see what you're saying about grabbing the pricing for both customer_group_id and the displaying them in the way that I need them. I guess the problem arises in that the "special" prices are linked only to the Retail group and not the Wholesale group. Interestingly, I added a "special" price to the wholesale group just to see what would happen and it did display all 3 prices but, even though the Wholesale price was lower than the Special price, it wanted to charge the Special price instead. I also took a look at the link for showing the customer_group in the admin/orders.php and will give that a try. Thanks again. Quote Link to comment Share on other sites More sharing options...
241 Posted February 18, 2007 Share Posted February 18, 2007 Arther,? For the sql it shouldn't matter which products_id (from which table) it should be because it is a join using products_id. Interestingly, MySQL5 has no problem with it, but MySQL4 does apparently. I have it changed to this in my last version (catalog/includes/classes/shopping_cart.php): if (is_numeric($products_id) && is_numeric($qty) && ($attributes_pass_check == true)) { // BOF SPPC attribute hide check, original query expanded to include attributes $check_product_query = tep_db_query("select p.products_status, options_id, options_values_id, IF(find_in_set('" . $this->cg_id . "', attributes_hide_from_groups) = 0, '0', '1') as hide_attr_status from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where p.products_id = '" . (int)$products_id . "'"); There is also a > missing close to the code for the save button in admin/attributes_groups.php. On Safari no problem, most other browsers did have a problem with it (rightly so of course) obscuring the save button. The code for the last update which was SPPC attributes mod rev.1 is still using the old code. The code that you have posted here works as does the change I made prior to seeing this post. $check_product_query = tep_db_query("select p.products_status, pa.options_id, pa.options_values_id, pa.attributes_hide_from_groups, '0' as hide_attr_status from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " pa on p.products_id = pa.products_id where p.products_id = '" . (int)$products_id . "'"); Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
241 Posted February 18, 2007 Share Posted February 18, 2007 Arther,? There is also a > missing close to the code for the save button in admin/attributes_groups.php. On Safari no problem, most other browsers did have a problem with it (rightly so of course) obscuring the save button. This would be approx line # 202 <?php echo '<p style="margin-top: 20px;"' . tep_image_submit('button_save.gif', IMAGE_SAVE, 'name="submitbutton"') . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL, 'onclick=\'self.close()\'') .'</p>' . "\n"; and is to close the opening paragraph tag just before the tep_image_submit <?php echo '<p style="margin-top: 20px;">' . tep_image_submit('button_save.gif', IMAGE_SAVE, 'name="submitbutton"') . ' ' . tep_image_button('button_cancel.gif', IMAGE_CANCEL, 'onclick=\'self.close()\'') .'</p>' . "\n"; Quote No longer giving free advice. Please place deposit in meter slot provided. Individual: [=] SME: [==] Corporation: [===] If deposit does not fit one of the slots provided then you are asking too much! Is your Osc dated try Phoenix raising oscommerce from the ashes. Link to comment Share on other sites More sharing options...
EspenA Posted February 18, 2007 Share Posted February 18, 2007 (edited) Well, of course and it works fine for me. If it is a register_globals thing: change the $HTTP_POST_VARS in the SPPC specific code to $_POST. However, you mentioned a default value of '1'. The default value of any SPPC installation is '0' (retail). The code assumes a visitor to the shop is in that group and will show prices for that group. When someone opens an account he/she is put in that group (because the default value for that column in the database is zero). I doubt this is related to register_globals as phpinfo(); says it's enabled (just checked). This is how it works for me now: * I've several customer groups, e.g. "Retail" with ID 0 and "Test" with ID 2 * /admin/customers.php says all customers are in the "Retail" group (as you said) * When I e.g. go to /admin/customers.php?cID=4233&action=edit I have a dropdown menu where all the existing groups are listed, but when I select "Test" (ID = 2) and click the submit button, the confirmation page says "Customer group: 2" (which is correct). * ... but the customer group for this user is still 0 (Retail). I don't get this ... it seems the database is not updated properly/at all? BTW: Here's the current source code of customers.php: http://dev.idgbooks.no.nordkapp.net/admin/customers.phps Edited February 18, 2007 by EspenA Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted February 18, 2007 Share Posted February 18, 2007 I doubt this is related to register_globals as phpinfo(); says it's enabled (just checked). This is how it works for me now: * I've several customer groups, e.g. "Retail" with ID 0 and "Test" with ID 2 * /admin/customers.php says all customers are in the "Retail" group (as you said) * When I e.g. go to /admin/customers.php?cID=4233&action=edit I have a dropdown menu where all the existing groups are listed, but when I select "Test" (ID = 2) and click the submit button, the confirmation page says "Customer group: 2" (which is correct). * ... but the customer group for this user is still 0 (Retail). I don't get this ... it seems the database is not updated properly/at all? I copied that page and pasted it in a new file, did a file compare with my files and found out that you failed to mention that you removed all the code for countries and replaced it with a: <input type="hidden" name="country" value="160" /> Now I'm pretty sure that what you see as a "confirmation" page is not the confirmation page at all, it is the error page. Being caused by the fact that the code is looking for entry_country_id and not country causing it to show the error page which doesn't show you an error, because you commented out that code. So indeed nothing will be updated. I bet nothing about a customer will ever be updated (unless you change the name of that hidden field of course). Quote Link to comment Share on other sites More sharing options...
EspenA Posted February 18, 2007 Share Posted February 18, 2007 (edited) Sorry for the lack of information, JanZ. I've just taken over the responsibility for an OsCommerce driven website and haven't really looked deeply into its code before now. It seems you are right about the confirmation page and that the code that has been commented out is causing the problem with updating the customer profile. It seems this has been done on purpose (all customers are from Norway, so the country dropdown menu isn't needed), but not tested properly. I'll see if I can workaround this. Thanks a lot for your help! Edited February 18, 2007 by EspenA Quote Link to comment Share on other sites More sharing options...
1Putts Posted February 19, 2007 Share Posted February 19, 2007 Sure, but you will need to rewrite some code on product_info.php. Now it gets the special price for the logged-in customer or visitor with: if ($new_price = tep_get_products_special_price($product_info['products_id'])) { The function tep_get_products_special_price uses the customer group id for the lookup. I think it would be best to get all the special prices and customer_group_id's for the particular products_id and echo'ing the ones you need on the appropriate places. Since the customer already belongs to a customer_group it is of little use to separately store it. To display the customer group of the customer in admin/orders.php look at this post on page 128. Well, I can report that the code in that link you posted that will show the customer group in the admin/orders.php worked like a champ. Unfortunately, I'm still struggling with showing Retail, Special & Wholesale pricing on the product_info.php page. One other question (and I fully expect the answer to be "no" but I have to ask): How difficult is it to assign order total modules to a customer group, much the same way you can assign payment and shipping modules? The site I'm working on currently offers a few price breaks and coupons to retail customers (applied as order total modules) but doesn't want them offered to wholesalers (since they already get a significant discount). One of the most powerful features of the SPPC contribution (aside from the whole variable pricing thing) is the ability to assign different modules to each group. Just wondering if something like this has already been done. I've searched and searched...reading through 168 pages of posts gets tiring after a while! Quote Link to comment Share on other sites More sharing options...
Guest Posted February 19, 2007 Share Posted February 19, 2007 Hi I posted a message re. some help with SPPC, in hindsight I now realise it should have gone in this thread, but I missed that at the time. http://www.oscommerce.com/forums/index.php?showtopic=251220 I'd be extremely grateful if anyone has ideas on this. Many thanks Kate Quote Link to comment Share on other sites More sharing options...
TracyS Posted February 19, 2007 Share Posted February 19, 2007 For good measure you should print_r($pic) to check if it contains all the correct data.Then perhaps the easiest way would be to add a function to ProductsInCategory that returns the same array of products that $products_in_category_query would have given (haven't checked that). So in the class you would have something like: // do the product query you normally would have done for the category, just in case // get the results, add them to the array $product_data } // add some code that if $product_data is not set or empty return false // at any rate return the info return $product_data; } Thank you for your patience with me :blush: I am trying - but a little confused (as usual - LOL). I'm not sure how to add the results to the array - this is what I have so far - did I do this right? Is the if $product_data == NULL what you were thinking of by "not set or empty" - I'm not sure where to return a false though :huh: class ProductsInCategory { var $pic_data = array(); function ProductsInCategory() { global $languages_id; if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') { $this->cg_id = (int)$_SESSION['sppc_customer_group_id']; } else { $this->cg_id = 0; } $products_query = tep_db_query("select p2c.categories_id, p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id AND pd.language_id = '" . (int)$language . "' AND find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 AND p.products_id = pd.products_id AND p.products_master_status='1' order by p2c.categories_id, p.products_sort_order asc, pd.products_name"); while ($product_info = tep_db_fetch_array($products_query)) { $this->addProductsInCategory($product_info['categories_id'], $product_info); } // end while ($product_info = tep_db_fetch_array($products_query)) } // end function ProductsInCategory function addProductsInCategory ($categories_id, $product_info) { $this->pic_data[$categories_id][] = array('products_id' => $product_info['products_id'], 'products_name' => $product_info['product'], // we already know the category but might be handy to have it here too 'products_category' => $categories_id); } // end function addProductsInCategory ($categories_id, $product_info) function getProductsInCategory($categories_id) { if (isset($this->pic_data[$categories_id])){ foreach ($this->pic_data[$categories_id] as $key => $_product_data) { $product_data[] = $_product_data; } // end foreach }else{ if ($product_data == [NULL]) { $products_query = tep_db_query("select p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' AND pd.language_id = '" . (int)$language . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and p.products_id = pd.products_id AND p.products_master_status='1' order by p.products_sort_order asc, pd.products_name"); }// end if } // end else return $product_data; }// end if (isset($this->pic_data[$categories_id])) } // end function getProductsInCategory($categories_id) } // end Class ProductsInCategory I have commented all my ending } so I can keep track and make sure I've ended everything I've started - LOL :blush: Read about a stack of books two feet high, and tried making code work (for a hundreds of hours surely) ;) Well - then that means there is hope for me yet! ;) I just need to add several more books and several more hours - LOL :blush: Quote ~Tracy 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.