Jump to content

redrum

Members
  • Posts

    47
  • Joined

  • Last visited

  • Days Won

    1

redrum last won the day on November 16 2021

redrum had the most liked content!

Profile Information

  • Activity
    Agency

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

redrum's Achievements

Contributor

Contributor (5/14)

  • Reacting Well Rare
  • Conversation Starter Rare
  • Dedicated Rare
  • First Post Rare
  • Collaborator Rare

Recent Badges

6

Reputation

  1. I'm about to finish a small script that could do some cleanup in the database. I'm hoping for some thoughts about the scenario below. Have I missed something? Will it mess up anything so something wont work properly? Here we go; 1. If a product is out of stock you might want to delete it from the tables `ps_cart_product`. 2. This will result in some rows in `ps_cart` doesn't have any corresponding product in `ps_cart_product`, so then we remove these rows in the table `ps_cart`. 3. Lastly we clean up the table `ps_guest`. It is done in the following order with the following conditions: Conditions for cleaning table `ps_cart_product`: - Product quantity is set to 0. - Row is not related to an order. Conditions for cleaning table `ps_cart`: - Row does not exist in the table `ps_cart_product`. - Row does not exist in the table `orders`. Conditions for cleaning table `ps_guest`: - Row does not exist in the table `ps_cart`. - Row does not exist in the table `pf_connections`. - `id_customer` is 0.
  2. I suggest you change the behavior of the script, so it don't delete, edit or replace files automatically. A better approach would be to display all the errors and let the user decide if he want to delete, edit or replace each error.
  3. The output for this became https://www.url.com/img/p/99-1234.jpg ( https://www.url.com/img/p/ [product id] - [id image] .jpg ) But I managed to get folder location with this code: {Image::getImgFolderStatic($product.cover.id_image)}{$product.cover.id_image}.jpg Thanks for pointing me in the right direction.
  4. How can I get the real image path/folder location for the product images in a smarty .tpl-file? Product images are stored with the following structure: Product image id: 1234 Location: www.url.com/img/p/1/2/3/4/1234.jpg 'www.url.com/img/p/1/2/3/4/1234.jpg' is want I want to output in the .tpl-file. I managed to get the folder structure and file name (ie: 1/2/3/4/1234.jpg) in smarty with the following code: {$product.id_image|regex_replace:'/.*-/':''|spacify:'/'}/{$product.id_image|regex_replace:'/.*-/':''}.jpg But I believe regex_replace is a bad practice to use in template files.
  5. As of at least 1.7.7.7 this function is built in. Under the tab "Quantities" you have a field with the name "Stock location".
  6. If someone stumbles in here and need total weight that at least work for 1.7 you can use this $weight = sprintf("%.3f", (float)$order->getTotalWeight()); It fetch the total weight for an order with 3 decimals.
  7. I have looking around for information about empty unnecessary database tables to optimize the database. Some people say that it is safe to empty the table ps_guest, and some people say that it probably should be left untouched. Since I don't know every function, feature and process that grabs data from the ps_guest-table, I'm hoping for some inputs here. Will there be any loss of functions if I run the query below? $query = 'DELETE FROM ps_guest WHERE id_customer = 0 AND id_guest NOT IN (SELECT id_guest FROM ps_cart) AND id_customer NOT IN (SELECT id_customer FROM ps_customer)';
  8. Thanks for the tip. I will look into Prestools.
  9. I need to be able to edit an order regardless what kind of order status it has, and regardless what settings there are in the different order order statuses. I tried the following; in "Shop Parameters > Order Settings > Statuses" I created a new status that I called "Edit". None of the checkboxes were selected. When I change order status for an order to "Edit" it will not be editable. If it is editable also depends on the settings for the previous order statuses for that order. In short; Prestashop block the possibility to edit order depending on order statuses and their settings. How can I bypass that blocking? What files need to be changed and would an override be possible?
  10. Thanks for your reply, I appreciate it. As far as I can see the only payment module that I have that corresponding to PS_OS_PAYMENT is Klarna Checkout, so I guess it doesn't do any harem to set the value to one in configuration table, or could I be wrong here? Another approach would be to rearrange the names of my order statuses. At this time status 1 have the name "Arrived" and status 2 is "Processing/packing".
  11. Did you resolved this issue?
  12. I have installed the Klarna Checkout payment module. When I get a new order thru Klarna Checkout the order status id is set to 2. Klarna Checkout looking for PS_OS_PAYMENT in the database, check its value and then set the order status id to the same value. It seems like PS_OS_PAYMENT is set to value 2 by default when installing Prestashop. So to my question, is it anywhere in admin where I can change the value of PS_OS_PAYMENT?
  13. I did some dirty hard coded stuff to test it on my sandbox environment. To be able to share it I would have to extract it and make a proper module of it. Unfortunately my time is extremely limited right now. But when I find some time I will see if I can complete it and upload a module.
  14. This might be a stupid question, but I want to make sure of how how a proper internal href link should look like. I come from osCommerce, and if you inserted a regular href link like <a href="product-25.html">Check this product</a> the session might be lost, with the result of the customers cart would be emptied and logged out if he was logged in. Instead a href link like this should be used in osCommerce <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=25', SSL, true) . '">Check this product</a> So to my question; When adding a link in categories and product description in Prestashop BO, is it fine to use regular href link?
  15. Thanks for the input @Pandal. I did some digging, searching and merging and this seems fine to attach both invoice and delivery slip in a mail; $context = Context::getContext(); $pdf_inv = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_INVOICE, $context->smarty); $attachment_invoice['content'] = $pdf_inv->render(false); $attachment_invoice['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->invoice_number).'.pdf'; $attachment_invoice['mime'] = 'application/pdf'; $pdf_del = new PDF($order->getInvoicesCollection(), PDF::TEMPLATE_DELIVERY_SLIP, $context->smarty); $attachement_delivery['content'] = $pdf_del->render(false); $attachement_delivery['name'] = Configuration::get('PS_DELIVERY_PREFIX', (int)$order->id_lang, null, $order->id_shop).sprintf('%06d', $order->delivery_number).'.pdf'; $attachement_delivery['mime'] = 'application/pdf'; $attachement_inv_del = array($attachment_invoice, $attachement_delivery); $templateVars = array( '{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{id_order}' => $order->id, '{order_name}' => $order->getUniqReference(), '{invoice_number}' => Configuration::get('PS_INVOICE_PREFIX', (int) $order->id_lang, null, $order->id_shop) . sprintf('%06d', $order->invoice_number), '{delivery_number}' => Configuration::get('PS_DELIVERY_PREFIX', (int) $order->id_lang, null, $order->id_shop) . sprintf('%06d', $order->delivery_number), ); if (Tools::isSubmit('submitSendInvoice')) { Mail::Send( (int)$order->id_lang, 'order_conf', Mail::l('Invoice for your order', (int)$order->id_lang), $templateVars, $customer->email, $customer->firstname.' '.$customer->lastname, null, null, $attachement_inv_del, null, _PS_MAIL_DIR_, true, (int)$order->id_shop ); }
×
×
  • Create New...