user1725 من مجهول عضو منذ ديسمبر -0001 user1725 8 مارس 2016 17:07 We'd like to sell a magazine - and subscriptions for it, too. As there is no subscription module yet, I have the following idea: Customers order a 1-year-subscription (2 issues) When the 3rd issue comes out, we don't want them to reorder manually (as we do in our current shop, which is quite a headache) I'd like to have a cronjob which copies orders from #1 when #3 comes out, from #2 when #4 comes out, ... and so on. How to realize? a cronjob copies the orders and writes new (updated) orders to the database the customer gets the new Order Copy via mail. Part 1 (cronjob) should be possible. How can we realize Part 2? As I understand, http://[shop_url]/printable_order_copy?order_id=2&checksum=b2a59bbbd3b49f5d13864f73df8e0300&media=print runs the creation of the order copy. How is the checksum generated (can be discussed via mail, of course g)? And how/where is the Order Copy delivered to the customer? (didn't get it, yet)
tim Founder من Sweden عضو منذ مايو 2013 tim 8 مارس 2016 20:26 I'm a bit confused in what is a question and what is not. Perhaps you want to provide some clear questions? To email an order copy: $order = new ctrl_order('load', $order_id); $order->email_order_copy('recipient@email.com'); To duplicate an order: $order = new ctrl_order('load', $order_id); $order->data['id'] = null; $order->save();
user1725 من مجهول عضو منذ ديسمبر -0001 user1725 8 مارس 2016 20:32 Sorry, my fault. The core question was: How to send out a printable order copy? What you provided (for both tasks) looks very, very, very easier than what I would have created. Thank you very much!
tim Founder من Sweden عضو منذ مايو 2013 tim 8 مارس 2016 21:04 Welcome to LiteCart, where simplicity is key ;)
candypalace Merchant من United Kingdom عضو منذ أبريل 2023 candypalace 15 يوليو 2023 09:20 Hi, Which file do I make these changes in please: $order = new ctrl_order('load', $order_id); $order->email_order_copy('recipient@email.com'); Thanks
tim Founder من Sweden عضو منذ مايو 2013 tim 15 يوليو 2023 11:23 Anyone. Depending on when you want to send the email. $order = new ent_order('load', $order_id); $order->email_order_copy('recipient@email.com');
candypalace Merchant من United Kingdom عضو منذ أبريل 2023 candypalace 15 يوليو 2023 13:07 I see, Well i'd like to send it to the customer and admin Immediately the checkout process. I'm using litecart 2.5.
candypalace Merchant من United Kingdom عضو منذ أبريل 2023 candypalace 15 يوليو 2023 17:57 I cant get this to work. I thought putting it in ent_order.inc.php in the public function send_email_notification would work but that does not work. $order = new ent_order('load', $order_id); $order->email_order_copy('recipient@email.com');
tim Founder من Sweden عضو منذ مايو 2013 tim 15 يوليو 2023 21:54 send_email_notification() is triggered when there is a new order comment added that is flagged for notifying the customer. At what event would you like to send the email? You said "Immediately the checkout process". We are already doing that: https://github.com/litecart/litecart/blob/2.5.4/public_html/pages/order_process.inc.php#L170-L180
candypalace Merchant من United Kingdom عضو منذ أبريل 2023 candypalace 15 يوليو 2023 23:24 My Apologies. I got my wires crossed. What I am looking for is a way to send the printable order copy to the customers and admins mailbox
tim Founder من Sweden عضو منذ مايو 2013 tim 16 يوليو 2023 10:03 Like I said we are already doing that. The email copy to admins can be set under Admin -> Settings -> Checkout.
candypalace Merchant من United Kingdom عضو منذ أبريل 2023 candypalace 16 يوليو 2023 22:27 Yes I understand you can send the email that contains the order details and the link back to the printable order copy. But I am trying to find a way to send the actual html printable order copy.
tim Founder من Sweden عضو منذ مايو 2013 tim 16 يوليو 2023 23:16 Ooh.. to send HTML emails you must change the add_body($message) to add_body($message, [b]true[/b]). This second parameter indicates if the message content is HTML or not. When omitted it defaults to false. https://github.com/litecart/litecart/blob/2.5.4/public_html/includes/entities/ent_order.inc.php#L779 Here is one example. $printable_order_copy->snippets['order'] = $this->data; $printable_order_copy->snippets['text_direction'] = !empty(language::$languages[$this->data['language_code']]['direction']) ? language::$languages[$this->data['language_code']]['direction'] : 'ltr'; $message = $printable_order_copy->stitch('pages/printable_order_copy'); $email = new ent_email(); $email->add_recipient(...) ->set_subject(...) ->add_body($message, true) ->send();``` But it's not that easy in practical life. E-mail clients have several limitations. See https://caniuse.email/ I recommend something like this instead. https://www.litecart.net/en/addons/317/order-copy-pdf-attachment
candypalace Merchant من United Kingdom عضو منذ أبريل 2023 candypalace 17 يوليو 2023 07:02 Thanks Tim. I tried your solution and it works but the printable order copy looses most it's original html formatting. I understand the reasons for that and See what you mean when you say E-mail clients have several limitations. I also tried the PDF vmod, but https://www.prerender.cloud/ is not working.
tim Founder من Sweden عضو منذ مايو 2013 tim 17 يوليو 2023 10:12 I see Prerender moved the site to prerender.io but I think the API remains on .cloud. I have future plans of making an official PDF API by LiteCart.
candypalace Merchant من United Kingdom عضو منذ أبريل 2023 candypalace 18 يوليو 2023 05:44 Thanks Tim. PDF API is definitely a mod i'd purchase.