storeweb88 Posted June 10, 2015 Share Posted June 10, 2015 how would I run a query for the customers default address and products on the usps.php module? I tried adding it in but I keep getting a error. I have some of the code I just can't seem to get to work $shipping_find_country_query=tep_db_query("select address_book_id,entry_country_id from " . TABLE_ADDRESS_BOOK . " where address_book_id = '" .$sendto. "'"); $shipping_find_country = tep_db_fetch_array($shipping_find_country_query); // echo'here'; $shipping_country_customer=$shipping_find_country['entry_country_id']; and..... this.......................... $products = $cart->get_products(); Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 10, 2015 Share Posted June 10, 2015 I'm not clear about what you are trying to do but the customers main email address is in the customers table. If you are looking for orders by that customer, then you need to be checking the orders tables. There are addons that already report such things so unless you need something they don't provide or you just want to know, it would be easier to use one of those. If this doesn't help, please provide more detail about what you want to accomplish. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
storeweb88 Posted June 13, 2015 Author Share Posted June 13, 2015 I want to run a query in the usps.php so it subrtacts the amount of shipping. Alot of ther addons where built in such a crazy way. That this would be the most simple way if I just run that one query. I want to subrtact the amount of shipping that its adding on for certain other countires. Thats my goal. thank you Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 13, 2015 Share Posted June 13, 2015 In the usps module, there should be a shipping zone setting. If you setup the zone for just the countries you want it to apply to, it won't work for any of the others. If that won't work for you, just add a global variable for $order in the first function of the usps module and check the address there. You don't need to load it again from the database. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
storeweb88 Posted June 13, 2015 Author Share Posted June 13, 2015 That wouldn't work in that case. Because some products to some countires we charge a flat fee on certain items. Then other products we charge whatever the shipping cost is. Then other items we charge a flat fee plus a shipping cost. Everything is already setup for all the other stuff. And then some areas and some countries its free shipping on items over a certain amount but on certain items. I just need to subtract the calucation when it comes to those countries and those products. All the other stuff is built I just need to do this and I am done.... One simple query. I did a quick and dirty test, but I kept getting other errors saying it wasn't attached correctly. Thats why I was wondering how to include it in correctly. I can program I just thought maybe I could get a quick answer so it would save me time from going through a bunch of files. (In other words all I have to do is run a query of what country its going to echo it out along with the product number and subtract the diffrence.) Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 13, 2015 Share Posted June 13, 2015 As mentioned, the $order variable should already have that. Depending on your version of usps, you may have this function usps() { global $order; Below that, add this ?> <pre> <?php print_r($order); ?> </pre> <?php Then refresh the page and all of the available items will be shown. Be sure to do this on a test shop or add code to only allow you to see it. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
storeweb88 Posted June 16, 2015 Author Share Posted June 16, 2015 Thank you that did help some. . I was able to echo some out the stuff But when I try to run this in the loop I get a error $order->get_products(); mod_fcgid: stderr: PHP Fatal error: Call to undefined method order::get_products() What am I do wrong? Link to comment Share on other sites More sharing options...
Jack_mcs Posted June 16, 2015 Share Posted June 16, 2015 Two problems: 1 - That is not a valid function in the order class. You need to use $order->products, which is an array, and loop through it. 2 - You shouldn't run that command (the correct one) in a loop. See the checkout_confirmation.php file for an example of how to use it. Support Links: For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc. All of My Addons Get the latest versions of my addons Recommended SEO Addons Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.