noesac Posted July 6, 2011 Share Posted July 6, 2011 I want to retrieve the location from the database so I can add the following bit of code to my shopping cart: IF location = "xx" PO box addresses are not accepted, please enter a standard mailing address ELSE regular text How can I retrieve this location data? Link to comment Share on other sites More sharing options...
MrBaseball34 Posted July 7, 2011 Share Posted July 7, 2011 Location of what? Link to comment Share on other sites More sharing options...
noesac Posted July 7, 2011 Author Share Posted July 7, 2011 sorry the product location field. So ps_product.location Link to comment Share on other sites More sharing options...
MrBaseball34 Posted July 7, 2011 Share Posted July 7, 2011 Where is the code you show above located? In what file? It is important because you may need to include some units to get what you need. Link to comment Share on other sites More sharing options...
noesac Posted July 7, 2011 Author Share Posted July 7, 2011 I'm using a module called One Page CheckOut, it's Step 1, file opc-order.tplHere's a copy of the file I uploaded:http://www.2shared.com/file/w8Jo1Np9/opc-order.html Link to comment Share on other sites More sharing options...
MrBaseball34 Posted July 8, 2011 Share Posted July 8, 2011 I think you may be a little confused by the ps_product.location value. This is not the location of the customer. It is supposed to be used for locating the product in a warehouse.I think what you are needing is the customer's location, correct? If so, you can access that through the variables $smarty.post.address1, $smarty.post.address2, $smarty.post.postcode, and $smarty.post.city. Link to comment Share on other sites More sharing options...
noesac Posted July 8, 2011 Author Share Posted July 8, 2011 No I'm after the location of the product:)We have two suppliers, and one of them does not deliver to PO Boxes so if any product in the order (e.g. order contains 3 products, but 1 is from this supplier) then we need to show a message that says "Please do not enter a PO Box address!" Link to comment Share on other sites More sharing options...
MrBaseball34 Posted July 8, 2011 Share Posted July 8, 2011 Then that would be as easy as getting it from the $product.location.You already have the product in the $products array. Link to comment Share on other sites More sharing options...
noesac Posted July 8, 2011 Author Share Posted July 8, 2011 I just tried the following code but it doesn't work: {if $product.location = 'supplier1'} text {/if} but that didn't work Link to comment Share on other sites More sharing options...
MrBaseball34 Posted July 8, 2011 Share Posted July 8, 2011 {if $product.location == 'supplier1'}or{if $product.location eq 'supplier1'} Link to comment Share on other sites More sharing options...
noesac Posted July 8, 2011 Author Share Posted July 8, 2011 Hum I just tried that, and it doesn't error anymore which means I'm on the right track...but it doesn't actually display the text!I looked in my database and I can 100% confirm that there is data in the location field, and the spelling is definitely 'supplier1'. Do I need to specifically retrieve the location field data first? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now