Jump to content

safius

Members
  • Posts

    16
  • Joined

  • Last visited

Profile Information

  • First Name
    Alex
  • Last Name
    Giannakakos

safius's Achievements

Newbie

Newbie (1/14)

0

Reputation

1

Community Answers

  1. Edit: I have found the root of the problem. The "base price" is pulled not from the class property, but directly from the database table `ps_product_shop`, which has a base price calculated for every product associated with that store (which is every product in my catalog). Now, this is what exactly went on. I had uploaded my catalog from the CSV Import tab, and at the time I set my price column in the CSV as 'Price (tax excl.)'. Some time afterwards, I was told that the prices were after tax, so I ran a query in the DB to change all the prices in `ps_product`. I was not aware that I had to run the query on `ps_product_shop` as well.
  2. For example, I have a product that costs ~1.02 pre-tax and is associated with a 13% tax rule. From the back-office, it says that the base price is ~1.16 (which is 1.03 plus 13% tax), and that the final price after tax is 13% more applied to the base price, which becomes 1.31. I looked into the `Product` class, and it seems to be setting the `base_price` property directly from the `price` property, which in turn has been directly pulled from the database via the `fields` definition array. The `price` property is then recalculated, which should not affect `base_price` since the assignment was by value, not by reference. I could not find any other line of code anywhere within PrestaShop where `base_price` is recalculated, and I can't find any evidence of the tax rate being hardcoded in the associated classes. The attached screenshots are of another product, but the same problem arises. This time, however, the tax rate for the product has changed. The base price is after-tax, but calculated with the old tax rate, which prevents me from using the base price as the final price, as is.
  3. I have created my own module to calculate delivery costs based on the distance between the store and the customer's address and to then store it in the database for future reference. My problem now is that I want to replace the way PS handles shipping in a way that will integrate with PS's other features, say, coupons and the email system. I want my custom-calculated shipping cost to be available wherever a shipping cost is needed without manually replacing it. Is there a way to achieve this or do I have to change everything by hand?
  4. Thanks for pointing that out, I had already worked around my issue but I forgot to come by and edit the question (BTW, yes, I replaced country with id_country and state with id_state). With that said, I couldn't get PS to do exactly what I intended. Instead, I created the address with "-" as the address1 field, which I replace with an empty string in the AddressFormat::getFormattedAddressFieldsValues method so it can be delivered to the calling controller as if it was empty. It works, but if anyone can figure out a proper solution, I'm still curious to know.
  5. I am trying to create a temporary default address manually and giving it certain specific property values (specific city, country, etc). I expect customers to edit it eventually during checkout with a non-empty address, which should work out given how PS handles address editing. (It deletes the previous address and creates a new one which is validated from scratch.) The code below seems to have no effect whatsoever. No new address can be found in the back-office. $address = new Address(); $address->firstname = $this->context->customer->firstname; $address->lastname = $this->context->customer->lastname; $address->address1 = ""; $address->postcode = <postcode>; $address->city = <city>; $address->country = <country>; $address->state = <state>; $address->phone = $phone; $address->phone_mobile = $phone; $address->alias = "My address"; $address->save();
  6. No, I just checked. Multistore is disabled and there is only one id_shop in the database.
  7. That one category seems to fetch no products from the database, while all other categories fetch all their products as intended. When I check from the back-office, I come across this weird behavior: If I look up a product that should be in that category and go to the Associations tab, I can see that it indeed belongs to the category in question. If, however, I look up the category from the Catalog>Categories page, it brings up no products associated with it. I checked the database directly and I see nothing obviously off. This is a record that DOES NOT show up (top), versus one that DOES show up (from a different category): (cont'd) (cont'd) (cont'd) (cont'd) (cont'd) (cont'd) I tried to output the sql query executed in Category::getProducts() and run it independently in my database console, and it fetches 1 product, as there is a "LIMIT 0,1" statement appended at the end of the query. Three issues with that: 1. "LIMIT 0,1" appears in the query for every category, even the working ones that fetch more than 1 products. 2. "LIMIT 0,1" should still return 1 product (and it does when run directly in the console), which is never displayed. 3. If I remove the LIMIT statement, I get 29 results in the query result, but still nothing is displayed in the category page.
  8. I want to use a different phone validation regex, since the built-in one allows even single-digit numbers. I marked my input with `data-validate="isPhoneNumber"` and modified the `isPhoneNumber` function in validate.js, but the [X] or [tick] sign on the input field is still assigned according to the original regex. Is this functionality overridden somewhere else? Is it validated on the back-end via AJAX?
  9. This is weird because I don't have that. Could it be a version issue? I'm on 1.6 SORRY! Just noticed /classes/order/ subdir.... Stupid mistake, big thanks!
  10. I cannot find a class corresponding to the concept of an order. Is there another name for it, or am I going about this the wrong way?
  11. I am developing a store that needs a different order processing flow than the PrestaShop default. Specifically, it is supposed to allow users to put in their order regardless of whether they have yet logged in or not. The resulting page for the order submission assumes that all fields required for both the user account and the order submission are always present. If the user is logged in and they have an address set up, the fields are populated from the server data. If the user is not logged in, the fields are blank, so the user proceeds to fill them in, then they are processed accordingly by the server before the order goes through the system. Same thing happens with the address, if the user has not yet provided an address. I am using the one-step process checkout option. On submission, all (10 or so fields in total) are passed as arguments to the server. Then I want to follow these steps in order: if user is not logged in { If user account params belong to an existing user { log in } else { create user } } if address does not exist { register address } submit order Validation is assumed but left out for simplicity. 1) What is the most frictionless approach to implement this? 2) How do I "submit an order"? Which controller does the functionality belong to?
  12. I have this snippet inside order-address.tpl {capture}<h3 class="page-subheading">{l s='Your billing address' js=1}</h3>{/capture} {addJsDefL name=titleInvoice}{$smarty.capture.default|@addcslashes:'\''}{/addJsDefL} The thing is, if I change the captured html and console.log the titleInvoice variable, it retains the default value, rather than the updated one. I have disabled all cache options from the back office "Performance" panel, cleared the cache manually, and have forced templates to always recompile. My last hope is that I have not understood how addJsDefL works, but there is no mention of it in the PrestaShop and Smarty docs. So, I'm lost at this point.
  13. I have completed the steps described in the docs, as far as setting up a physical URL for a new store. The problem now is that the new path is not automatically created in my PrestaShop directory, hence the 404 problem when I try to access the URL. The docs seem to imply that whatever files are necessary, they are generated automatically by the back office. Do I have to create the directory and copy the necessary files manually instead?
  14. Appreciate the help, this seems promising. Will I have trouble building modules to combine information from different shops? For instance, I want the user's profile to display the order history across all shops, yet the docs say that order history and invoices are not shared. Is that just the default behaviour or can it not be done at all?
  15. Hello, everyone. I want my shop to support multiple "soft" stores, meaning that (a) a user should only be able to order products from a single store they have selected, and (b ) products should have different inventory codes for each store they are associated with. Should I attempt to adapt the "Suppliers" functionality to implement this feature? Is there another way or is it entirely impossible to do? Thank you all.
×
×
  • Create New...