Jump to content

lordignus

Members
  • Posts

    77
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by lordignus

  1. Add the function to /override/classes/Link.php If that file doesn't exist yet, just create it exactly as follows: <?php class Link extends LinkCore { public function getCategoryName( $id_category ){ $idLang = Context::getContext()->language->id; $categoryObject = $this->getCategoryObject($id_category, $idLang); return $categoryObject->name; } } Also, if you need to create the override file, you'll need to regenerate the class index. To do that, just delete /var/cache/prod/class_index.php and /var/cache/dev/class_index.php
  2. It's not a pretty solution but it works... You could create a variable inside the invoice template (bad practice but I'm lazy) like: {$customer_messages = CustomerMessage::getMessagesByOrderId($order->id)} {$my_message = ''} {if $customer_messages} {foreach from=$customer_messages item=customer_message} {if $customer_message.id_employee} {$my_message = $customer_message.message} {break} {/if} {/foreach} {/if} This will get the newest note that you have entered onto the order, but will not display messages left by the customer. Then wherever you want the message to display, just call the variable... {$my_message} Like I said it's a sloppy way to do it but that's how I roll 🤣
  3. I personally use this module for achieving what you describe.
  4. The one you receive as the seller is part of the Email Alerts module and can be found in: /modules/ps_emailalerts/mails/{lang}/new_order.html If you're looking for the original HTML for order_conf, just redownload Presta and grab the file
  5. Might not be much help, but I use a module that achieves this with an override of Cart->getPackageShippingCost() Good luck
  6. Have you contacted the developer of the module?
  7. This calculates average time between ALL orders (not just the last 3) for all customers who've placed 3 or more orders. Hope you find it useful. SELECT c.id_customer, c.email, COUNT(o.id_order) AS total_orders, ROUND(AVG(DATEDIFF(o.date_add, o2.date_add)),0) AS avg_days_between_orders FROM ps_customer c LEFT JOIN ps_orders o ON c.id_customer = o.id_customer LEFT JOIN ps_orders o2 ON c.id_customer = o2.id_customer WHERE o.id_order > o2.id_order GROUP BY c.id_customer HAVING total_orders > 2 ORDER BY avg_days_between_orders asc
  8. You've got a quote in the wrong place there... $this->_where .= ' AND os.id_order_state = 2' AND (a.`city` LIKE "Janniehaven%"); Should be: $this->_where .= ' AND os.id_order_state = 2 AND (a.`city` LIKE "Janniehaven%")';
  9. First you need to add it into the getHeader method of the HTMLTemplateInvoice class (classes/pdf/HTMLTemplateInvoice.pdf) public function getHeader() { $this->assignCommonHeaderData(); $this->smarty->assign(['header' => Context::getContext()->getTranslator()->trans('Invoice', [], 'Shop.Pdf')]); $this->smarty->assign(['order_reference' => $this->order->reference]); /* add this line! */ return $this->smarty->fetch($this->getTemplate('header')); } Then you can use {$order_reference} in header.tpl
  10. Firstly, make sure you've got "Fuzzy Search" enabled in Shop Parameters -> Search. By default, a search for "children" will NOT match a category called "child", for example, but you've got a better chance with Fuzzy Search enabled. On this page you can also increase the impact (weight) that the category name has on your search results. Try a few different settings and find the sweet spot. You might also want to emply the use of product tags which can be found in the Options tab of the Admin Product page - tags are also considered in search results.
  11. On the odd occasion I've had to do this for a customer, I've just typed their email address into the password recovery form on the frontend 🤷‍♀️
  12. Have you deleted/regenerated the class index?
  13. The code in my previous post works for the intended purpose of showing the lowest priced product in a category on that particlar category's page. What you're trying to do is something different.
  14. Try manually clearing the cache. In FTP, go to /your_site/var/cache In there, is a folder called "dev". Delete or rename it, see if that helps.
  15. You should be on the "browse" tab instead of "structure". In the browse tab you'll see a list of employees (back office users). Find the correct line (in the email column it will show whatever email address you're using to log in). On that line, change the value of "id_profile" from whatever it is to 1. Just double-click the value to edit it. See the attached image for clarification.
  16. ps_employee is a table in the database, not a file/folder. In your hosting control panel, there will be a databases section. In the database for your site, there will be a list of these tables. One of them will be ps_employee. To be honest, whoever you took over from should have given you the login details for an admin account so this wouldn't be necessary. Also, this means they potentially still have control over/access to the admin end of your shop. Whether that's a problem or not I don't know.
  17. Add this function to the OrderHistory class. public function getTrackingNumber($id_order){ $order = new Order($id_order); $order_carrier = new OrderCarrier($order->getIdOrderCarrier()); $tracking_number = $order_carrier->tracking_number; return $tracking_number; } Then, in the sendEmail method of the same class, you'll find an array called $data which contains the email variables. Add to the array: '{tracking_number}' => $this->getTrackingNumber($this->id_order), Finally, add to your shipped email template something like "Your tracking number is {tracking_number}" or whatever you want it to say.
  18. Looks as though the username you're logged in with doesn't have the correct permissions. If you don't have access to a SuperAdmin account, you can change the employee permissions profile in the database. It's in ps_employee and the column you're looking for is id_profile - change that to 1 for the user and that should apply SuperAdmin privileges and show all menu options.
  19. That wouldn't work as the carrier reference is part of the Carrier object which isn't part of the Context. My favourite quick solution for situations like this is that I have an override of the Tools class with whatever custom functions I need. For example you could add the following function to your Tools class override: public static function getCartCarrierReference($id_cart) : int { $cart = new Cart($id_cart); if(!$cart->id_carrier){ return -1; } $carrier = new Carrier($cart->id_carrier); $id_carrier_reference = $carrier->id_reference; return $id_carrier_reference; } And then call it in your template like: {if Tools::getCartCarrierReference(Context::getContext()->cart->id) == 123} {* do your thing *} {/if} The php function returns an integer which is either the carrier reference, or -1 if the cart is invalid or doesn't have a carrier selected, so you can use that for debugging/obtaining the correct carrier reference if necessary.
  20. That's really strange, can't imagine why it would work for your other carriers but not the one with id 86. Just something to consider - if you make any changes to the carrier in the backend, it gets assigned a new id which could break your code if you do it this way.
  21. Where/at which point in the checkout process do you need this to be?
  22. Disclaimer: Before anyone mentions it, I know smarty isn't intended to be used for calculations etc. This could be done in a much better way with some overrides or a module, but for the sake of a quick and easy solution.... I tried this in templates/catalog/listing/category.tpl and also in templates/catalog/_partials/category-header.tpl and it works 🤷‍♀️ {assign var="lowest_price_formatted" value=""} {assign var="lowest_price_amount" value=-1} {foreach from=$listing.products item=product} {if $product.price_amount < $lowest_price_amount || $lowest_price_amount == -1} {$lowest_price_amount = $product.price_amount} {$lowest_price_formatted = $product.price} {/if} {/foreach} <p>Prices starting from {$lowest_price_formatted}</p>
  23. Better to do this with an override instead of modifying the core class, but for the sake of a short answer... in classes/Category.php, in the getProducts function, look for this line: $sql .= ' ORDER BY ' . (!empty($orderByPrefix) ? $orderByPrefix . '.' : '') . '`' . bqSQL($orderBy) . '` ' . pSQL($orderWay) . ' LIMIT ' . (((int) $pageNumber - 1) * (int) $productPerPage) . ',' . (int) $productPerPage; and replace it with this one: $sql .= ' ORDER BY stock.quantity = 0 ASC,' . (!empty($orderByPrefix) ? $orderByPrefix . '.' : '') . '`' . bqSQL($orderBy) . '` ' . pSQL($orderWay) . ' LIMIT ' . (((int) $pageNumber - 1) * (int) $productPerPage) . ',' . (int) $productPerPage; That's in 1.7.8.0, so will depend on your version but the concept is the same, we're just adding stock.quantity = 0 ASC into the ORDER BY clause in the sql query that fetches category products.
×
×
  • Create New...