Jump to content

1Putts

Members
  • Content count

    216
  • Joined

  • Last visited

Everything posted by 1Putts

  1. 1Putts

    Help merging these two statements

    Thanks again, Jan. Mystery solved...there was in fact another similar query that needed to be modified as well. It's the one that "clones" product attributes...so here's the new one in case anyone is doing something similar: tep_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " ( products_id, options_id, options_values_id, options_values_price, price_prefix, attribute_sort, attributes_hide_from_groups) VALUES (".$clone_product_id_to.", ".$attributes_values['options_id'].", ".$attributes_values['options_values_id'].", ".$attributes_values['options_values_price'].", '".$attributes_values['price_prefix']."' , ".$attributes_values['attribute_sort'].", '@')");
  2. This shouldn't be too difficult but for some reason I can't get the syntax quite right. I'm trying to merge these two statements together into one so that it adds both the sort order (attributes_sort) and hide from groups (@) to the database. Here are the two statements: tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "', '@')"); tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "', '" . (int)$attributes_sort . "')"); I need the "@" to be the last item inserted. My efforts have resulted in it just adding "NULL" instead of the "@" and, as a result, the product attributes don't show up. Thanks in advance for any help.
  3. 1Putts

    Help merging these two statements

    Thanks again, Jan. Mystery solved...there was in fact another similar query that needed to be modified as well. It's the one that "clones" product attributes...so here's the new one in case anyone is doing something similar: tep_db_query("INSERT INTO " . TABLE_PRODUCTS_ATTRIBUTES . " ( products_id, options_id, options_values_id, options_values_price, price_prefix, attribute_sort, attributes_hide_from_groups) VALUES (".$clone_product_id_to.", ".$attributes_values['options_id'].", ".$attributes_values['options_values_id'].", ".$attributes_values['options_values_price'].", '".$attributes_values['price_prefix']."' , ".$attributes_values['attribute_sort'].", '@')");
  4. 1Putts

    Help merging these two statements

    OK, here's my latest attempt but still no luck: tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "', '" . (int)$attributes_sort . "', '@')"); Is it necessary to have the (null, at the beginning of the statement? Maybe that's what is throwing if off...
  5. 1Putts

    Help merging these two statements

    Thanks Jan. I have the the right number of fields all set up and in the correct order. I've tried merging those two statements together and I'm probably just not getting the syntax just right. Everything is right except the last field which ends up being "NULL" instead of "@". So I'm just looking for the correct syntax. For example, this is what I have now and it's apparently not right: tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "', '" . (int)$attributes_sort . "' '@')");
  6. I'm getting the following error when I try to use the order editor contrib and edit an order on a live server which is running PHP 5.2.6: Fatal error: Call to a member function show_total() on a non-object in /osc/includes/modules/shipping/mzmt.php on line 137 mzmt.php is a multi-zone, mult-table shipping rate calculator. Line 137 is part of a function that reads as follows: 131 function determineTableMethod($geozone_mode) { 132 global $total_count, $shipping_weight; 133 134 $this->geozone_mode = $geozone_mode; 135 136 if ($this->geozone_mode == 'price') { 137 $this->order_total = $_SESSION['cart']->show_total(); 138 } elseif ($this->geozone_mode == 'count') { 139 $this->order_total = $total_count; 140 } else { 141 $this->order_total = $shipping_weight; 142 } 143 144 return true; 145 } It all works on my local machine where I'm running PHP 4.3.11 so I'm guessing it's a PHP issue. I've looked high and low and I can't find any solutions that will work. Thanks in advance for any ideas you can offer.
  7. Fix has been posted on the contribution and support thread with full credit given. Thanks again to you both for your help.
  8. I was getting an error when trying to use the Order Editor Contribution v5.0.6.6 (http://addons.oscommerce.com/info/1435) with the MultiZone MultiTable Shipping Module. When I tried edit an order on a server which was running PHP 5.2.6, I got the following error: Fatal error: Call to a member function show_total() on a non-object in /catalog/includes/modules/shipping/mzmt.php on line 137 Both Jim Keebaugh and Robert Fisher were kind enough to help me solve this problem, so thank you to both. All it involves is editing this file: catalog/includes/modules/shipping/mzmt.php And REPLACING the function determineShipping($table_cost) So REPLACE the entire function to this: function determineShipping($table_cost) { global $shipping_num_boxes; for ($i=0, $n=sizeof($table_cost); $i<$n; $i+=2) { if ($this->order_total >= $table_cost[$i]) { $shipping_factor = $table_cost[$i+1]; } } if (substr_count($shipping_factor, '%') > 0) { $shipping = ((($this->order_total*10)/10)*((str_replace('%', '', $shipping_factor))/100)); } else { $shipping = str_replace('$', '', $shipping_factor); } if ($this->geozone_mode == 'weight') { $shipping = $shipping * $shipping_num_boxes; } return $shipping; } Thank you again for your help. Fix also posted as v1.21 on the contribution page.
  9. I double checked and all the files were there. However, I replaced the function as you instructed above and...IT WORKED! Thank you Jim and also thank you Robert for you assistance. I never would have gotten this on my own...I Googled my brains out all day and couldn't find anything nearly as useful as you two. Thank you so much...I love ending the day with at least one thing accomplished. Now how to add this info to the shipping contribution so that others can benefit from your expertise? This is the shipping contribution: http://addons.oscommerce.com/info/2571 and, of course, the infamous order editor: http://addons.oscommerce.com/info/1435
  10. ADDENDUM for Kymation: Here is what is returned...for some reason I didn't get all this the first time around: Session: Array ( [language] => english [languages_id] => 1 [selected_box] => customers [admin] => Array ( [id] => 1 [username] => admin ) [cart] => manualcart Object ( [contents] => Array ( [2] => Array ( [qty] => 1 ) [1] => Array ( [qty] => 2 ) ) [total] => 199.9 [weight] => 3 ) )
  11. Thank you both for your help. Robert, I tried your suggestion first and it appeared to work. That is, I didn't get the same error when I hit "Edit" on the order. But then when I attempted to change a value in the shipping, I received a bunch of errors (which I'll post below). Kymation, your suggestion returns the following...so what exactly am I looking for here? Session: Array ( [language] => english [languages_id] => 1 [selected_box] => customers [admin] => Array ( [id] => 1 [username] => admin ) ) And Robert, here are the error messages (there's quite a bit): Warning: order_total::include(includes/languages/english/modules/order_total/ot_subtotal.php) [order-total.include]: failed to open stream: No such file or directory in /catalog/admin/order_editor/order_total.php on line 30 Warning: order_total::include(includes/languages/english/modules/order_total/ot_subtotal.php) [order-total.include]: failed to open stream: No such file or directory in /catalog/admin/order_editor/order_total.php on line 30 Warning: order_total::include() [function.include]: Failed opening 'includes/languages/english/modules/order_total/ot_subtotal.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/share/pear/') in /catalog/admin/order_editor/order_total.php on line 30 Warning: order_total::include(includes/modules/order_total/ot_subtotal.php) [order-total.include]: failed to open stream: No such file or directory in /catalog/admin/order_editor/order_total.php on line 31 Warning: order_total::include(includes/modules/order_total/ot_subtotal.php) [order-total.include]: failed to open stream: No such file or directory in /catalog/admin/order_editor/order_total.php on line 31 Warning: order_total::include() [function.include]: Failed opening 'includes/modules/order_total/ot_subtotal.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php:/usr/share/pear/') in /catalog/admin/order_editor/order_total.php on line 31 Fatal error: Class 'ot_subtotal' not found in /catalog/admin/order_editor/order_total.php on line 34 And here is the relevant function code from the order_total.php file from the order editor: 18 class order_total { 19 var $modules; 20 21 // class constructor 22 function order_total() { 23 global $language; 24 25 if (defined('MODULE_ORDER_TOTAL_INSTALLED') && tep_not_null(MODULE_ORDER_TOTAL_INSTALLED)) { 26 $this->modules = explode(';', MODULE_ORDER_TOTAL_INSTALLED); 27 28 reset($this->modules); 29 while (list(, $value) = each($this->modules)) { 30 include(DIR_WS_LANGUAGES . $language . '/modules/order_total/' . $value); 31 include(DIR_WS_MODULES . 'order_total/' . $value); 32 33 $class = substr($value, 0, strrpos($value, '.')); 34 $GLOBALS[$class] = new $class; 35 } 36 } 37 } Again, thank you both so much for your assistance. I appreciate it very much.
  12. 1Putts

    Seperate Pricing Per Customer v3.5

    Never mind "something like" - that's was it exactly. Thanks again for your wonderful help. Turns out I didn't even need to change the customer group pricing at all since they are linked to the customer group number. So changing the group number, in effect, changes the pricing for that group. And then to set the customer group 0 pricing to 0, all I did was follow your example: update products set products_price = '0'; And it's done. Very nice!
  13. 1Putts

    Seperate Pricing Per Customer v3.5

    Thanks, that certainly has me on the right track. There's also modifying the customers table to assign the customers to their new group number. The big problem I see right now is how to assign all the pricing from customer group 0 to customer group 1 since they are actually contained in different tables. Changing pricing for groups 1 and 2 is easy enough (same idea as you already gave me) but how would I get the pricing from products -> products_price into products_groups -> customers_group_price and assign the customer_group_id to "1"? Then I'll need to set all the products -> products_price to 0. Thanks.
  14. 1Putts

    Seperate Pricing Per Customer v3.5

    I need to add a new customer group into position 0 and essentially shift all the others up one slot. So right now customer group 0 is "retail", group 1 is "wholesale level 1" etc. I want to make group 0 something like "pending", group 1 would be "retail", group 2 "wholesale level 1" etc. What would be the appropriate SQL statement to insert this new group while maintaining all the current pricing on the other groups. Oh yeah, the pricing for all the products for the new default group 0 will also be 0 (so I can not show pricing until they are assigned a group). Thanks in advance.
  15. I want to add a new customer group called "Uncatagorized" which would be the new default (0). All the prices for this group would will be "$0.00". So the way it is now: Retail & Default (customer group 0) Wholesale Level 1 (customer group 1) Wholesale Level 2 (customer group 2) Would end up like this: Uncategorized (customer group 0) Retail (customer group 1) Wholesale Level 1 (customer group 2) Wholesale Level 2 (customer group 3) So what I need to do is shift all the customer groups and associated product pricing up one and insert the new group at the bottom without screwing up the current pricing table or the current customer groups that exist right now. I realize this will take some kind of fancy SQL statement (or a series of them) but right now I can't get my head around the logic. If anyone has any suggestions, I'd appreciate it. Thanks. Edit: I thought I was posting this in the SPPC thread but apparently I wasn't. So this question only pertains to SPPC.
  16. After having some more time to think about this, I'm wondering if I might use the customer database to generate the list of resellers. So, for example, a customer in the customer database is listed as a "Reseller" (using SPPC of course), I could add a check box that says something like "include in Authorized Resellers". Then the list could actually be generated from that. I'm wondering if there are any potential security risks by having a query that's generated from the catalog side interact with the customer database. Would it be better to, say, upon checking the "include in Authorized Resellers", copy just the pertinent data (company name, address, etc) to another table in the database and generate the list from that? Just some thoughts before I attempt to put something together (since there doesn't appear to be anything out there)...
  17. I've scoured the contribution database but can't seem to find what I'm looking for. But before I go ahead and try to knock it together myself: Is there a contribution that allows someone from the Admin to add/edit/delete a list of Authorized Resellers for the site that can be displayed in the Catalog? Obviously this would be applicable to a OsC site that is a wholesaler or distributor. Thanks in advance.
  18. 1Putts

    Seperate Pricing Per Customer v3.5

    Ah, I see how it works now. I was so close yet so far. Many thanks. BTW, you may be interested in this since I'm trying to add a bunch of stuff that makes OsC2.2 R2 work a bit better with SPPC. In this case, it's just adding the Customer Groups in the main Admin index page where it shows recent customers and recent orders (catalog/admin/includes/modules/index/customers.php).
  19. 1Putts

    Seperate Pricing Per Customer v3.5

    I've looked at both admin/orders.php and admin/customers.php but I think it's confusing me even further. My problem is I don't quite get how the query selects the data from each table (where multiple tables are concerned) and puts them all together. Here's where I'm at right now but it's still not right. It's listing each customer repeatedly depending on how many different customer groups there are. I know I need to join something somewhere but I don't know where. <?php $customers_query = tep_db_query("select c.customers_id, c.customers_lastname, c.customers_firstname, c.customers_group_id, cg.customers_group_name, ci.customers_info_date_account_created from " . TABLE_CUSTOMERS . " c, " . TABLE_CUSTOMERS_GROUPS . " cg, " . TABLE_CUSTOMERS_INFO . " ci where c.customers_id = ci.customers_info_id order by ci.customers_info_date_account_created desc limit 6"); while ($customers = tep_db_fetch_array($customers_query)) { echo ' <tr class="dataTableRow">' . ' <td class="dataTableContent"><a href="' . tep_href_link(FILENAME_CUSTOMERS, 'cID=' . (int)$customers['customers_id'] . '&action=edit') . '">' . tep_output_string_protected($customers['customers_firstname'] . ' ' . $customers['customers_lastname']) . '</td>' . ' <td class="dataTableContent">' . $customers['customers_group_name'] . '</td>' . ' <td class="dataTableContent">' . $customers['customers_info_date_account_created'] . '</td>' . ' </tr>'; } ?>
  20. 1Putts

    [Contribution] STS v4

    I'm not sure what the root of the problem is, but I can safely say it's not due to a template malfunction or another contribution. The reason I say this is because I'm having the problem on my localhost, but when I uploaded everything to my production host, the problem went away. So it's more likely due to a server compatibility issue. Since I discovered it worked fine in production, I didn't have the wherewithall to compare every server config option between my local and production to see what might be causing it. Or maybe it's a config setting in the OsC admin - I really don't know. All I can say is, if you're testing on your localhost and haven't tried uploading it to your production server, might be worth a shot.
  21. 1Putts

    Seperate Pricing Per Customer v3.5

    I hope this doesn't seem like a dumb question but... What's the easiest way to associate the customers_group_id with the appropriate customers_group_name? I know that you need to grab the customers_group_id first but I always seem to fall down when it comes to associating the _id with the _name. There are lots of places in both the catalog and admin where I'd like to also include the customer's group name but I can never seem to get past showing the _id. Thanks in advance.
  22. 1Putts

    [Contribution] STS v4

    I don't think it's a STS issue. The way you can check for certain is to login to your Admin, turn OFF STS in the Modules, reload a SSL encrypted page and see if the problem persists. If it does persist, then you know it's not related to STS. I was having the same issue and here's what I did to fix it (now, this is assuming your configure.php files are all correct): My "production" server is on a shared hosting platform with a shared SSL cert. The domain for the SSL server is different from my domain. This creates some problems when flipping over to SSL mode. In your catalog/includes/application_top.php file, there is a line like so: $request_type = (getenv('HTTPS') == 'on') ? 'SSL' : 'NONSSL'; Try changing it to something like this: $request_type = (stristr(getenv('HTTP_X_FORWARDED_HOST'), ".nameofyourssldomain.com")) ? 'SSL' : 'NONSSL'; ...where nameofyourssldomain.com is the actual name of your SSL domain. It should match the one in your catalog/includes/configure.php file where it says this: define('HTTPS_SERVER', 'https://yourdomain.nameofyourssldomain.com'); Give it a try and see what happens. PS. I got this from the most excellent (and should be required reading for any OsC developer) "The SSL In OsCommerce Guide For The Innocent" as found here: http://forums.oscommerce.com/index.php?showtopic=151162
  23. 1Putts

    [Contribution] STS v4

    Added my "Quick Horizontal Search" to the mix as well. I have a few more to add but it'll have to wait until later. Thanks again for STS - it really is a nice tool to work with.
  24. 1Putts

    [Contribution] STS v4

    Sure thing, I've added it to the list of goodies. I have a few more that I'll package together and upload as well.
  25. 1Putts

    [Contribution] STS v4

    I was looking for a way to hide empty Categories and Sub-Categories in the $catmenu to avoid having the user click on a Category only for it to say "No products found". I ran across this contrib: http://addons.oscommerce.com/info/5475 and just "borrowed" the if-statement and it seems to work just fine. So here it is: In the sts_user_code.php file, in the Category Menu Code: Find: while ($categories = tep_db_fetch_array($categories_query)) { ...and ADD this below it: // Begin Hide Empty Categories and Sub Categories if (tep_count_products_in_category($categories['categories_id']) > 0) { // End Hide Empty Categories and Sub Categories Then you need to close out the if-statement so find: $category_tree_array = tep_get_category_tree($categories['categories_id'], $spacing . ' ', $exclude, $category_tree_array); And just ADD this below it: // Begin Hide Empty Categories and Sub Categories } // End Hide Empty Categories and Sub Categories Again, I totally snatched the code from the above mentioned, very fine contribution. This is just how you apply it to the sts_user_code.php file.
×