Jump to content

Somepub

Members
  • Posts

    9
  • Joined

  • Last visited

Profile Information

  • First Name
    Mallor
  • Last Name
    Kingsepp

Recent Profile Visitors

82 profile views

Somepub's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. I recently bought a One Step Checkout / One Page Checkout module. And testing with register account, checkout worked out fine! But here is the weird behavior.. when trying to check out without logged in(as guest), it puts all page elements to display:none So first I thought It could be an error, but when enableing DEVMODE it didn't show any errors, no php nor js errors. It just hides all elements. What could be the issue?
  2. @stweet Hello, Please look at this post: link
  3. Hello @compleus, I did found a solution for this! class PDF extends PDFCore { public function render($display = true) { if($this->template == PDF::TEMPLATE_INVOICE && Tools::getValue('printer') == 1) { // Output PDF to local file parent::render('F'); //echo "<script>window.close();</script>"; // added javascript for automatic closure after link print clicked } else { return parent::render($display); // Saving manually } } } The link for downloading pdf: http://www.example.com/admin/index.php?controller=AdminPdf&submitAction=generateInvoicePDF&id_order=3230&print=1
  4. I have solution for saving invoices to my server I override the pdf files Here is my code: PDF.PHP <?php class PDF extends PDFCore { public function render($display = true) { if($this->template == PDF::TEMPLATE_INVOICE) parent::render('F', true); //This renders to automatic save return parent::render($display); } } ?> PDFGenerator.PHP <?php class PDFGenerator extends PDFGeneratorCore { public function render($filename, $display = true) { if (empty($filename)) { throw new PrestaShopException('Missing filename.'); } $this->lastPage(); if ($display === true) { $output = 'D'; } elseif ($display === false) { $output = 'S'; } elseif ($display == 'D') { $output = 'D'; } elseif ($display == 'S') { $output = 'S'; } elseif ($display == 'F') { $output = 'F'; $filename = '/place/folder/invoices/print_it/'.str_replace("#", "", $filename); //file name starts with #, replacing for printing } else { $output = 'I'; } return $this->output($filename, $output); } } ?> All is working fine with my automatic invoice save, but when I'm downloading invoice manually(clicking view invoice in adminpanel), I'm getting an error or just a blank pdf file. So I can understand that this problem occurs with PDF.PHP file.. I tried to render both, but that dident help: PDF.PHP <?php class PDF extends PDFCore { public function render($display = true) { if($this->template == PDF::TEMPLATE_INVOICE) parent::render('F', true); parent::render('I', true); return parent::render($display); } } ?> It only renders the first of the parent::render, if parent::render('I', true) was first, I could download invoices manually, but automatic invoice save would be blank Soo.. is there any solution to this?
  5. Hello! I would like to know how can I use python or wget script to loggin to admin panel. My problem states on formdata, and I'm not sure how prestashop admin panel login works. I'm using python script like this: import requests url = 'http://www.example.ee/admin/index.php?controller=AdminLogin&token=1a02dc4d606bca6c26e95ddea92d3d15' payload = {'email': 'example', 'passwd': 'example'} with requests.Session() as s: p = s.post(url, data=payload) # print the html returned or something more intelligent to see if it's a successful login page. print p.text # An authorised request. r = s.get('A protected web page url') print r.text But I get an error: Traceback (most recent call last): File "downlaods.py", line 12, in <module> r = s.get('A protected web page url') File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 480, in get return self.request('GET', url, **kwargs) File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 454, in request prep = self.prepare_request(req) File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 388, in prepare_request hooks=merge_hooks(request.hooks, self.hooks), File "/usr/lib/python2.7/dist-packages/requests/models.py", line 293, in prepare self.prepare_url(url, params) File "/usr/lib/python2.7/dist-packages/requests/models.py", line 353, in prepare_url raise MissingSchema(error) requests.exceptions.MissingSchema: Invalid URL 'A protected web page url': No schema supplied. Perhaps you meant http://A protected web page url? Same for wget, Im using cookies to login, but I get an error: Removing www.example.ee/admin/index.php?controller=AdminPdf, since it should be rejected Is it even possible to use script to login to admin panel?
  6. @tuk66 Hmm.. yeah I forgot to login, but still no success, maybe I'm writing the code wrong: wget -x --load-cookies cookies.txt -e robots=off -A pdf -r -l1 http://www.example.ee/admin1111/index.php?controller=AdminPdf&token=44q236505aa6f5eb516737a8d534eb66&submitAction=generateInvoicePDF&id_order=3194
  7. @tuk66 Well... I tried using wget but still stuck, because the downloaded pdf rejects. The error:"Removing www.example.ee/admin111/index.php?controller=AdminPdf, since it should be rejected". Terminal: PS in other lang example@server64:~$ wget -e robots=off -A pdf -r -l1 http://www.example.ee/admin1111/index.php?controller=AdminPdf'>http://www.example.ee/admin1111/index.php?controller=AdminPdf&token=37b476c0666f5eb588837a8f7774eb66&submitAction=generateInvoicePDF&id_order=3188'>http://www.example.ee/admin1111/index.php?controller=AdminPdf'>http://www.example.ee/admin1111/index.php?controller=AdminPdf&token=37b476c0666f5eb588837a8f7774eb66&submitAction=generateInvoicePDF&id_order=3188 [1] 14337 [2] 14338 [3] 14339 example@server64:~$ --2017-04-17 14:52:13-- http://www.example.ee/admin1111/index.php?controller=AdminPdf'>http://www.example.ee/admin1111/index.php?controller=AdminPdf Lahendan http://www.example.ee (www.example.ee)... 111.11.111.111 Loon ühendust serveriga www.example.ee (www.example.ee)|111.11.111.111|:80... ühendus loodud. HTTP päring saadetud, ootan vastust... 302 Found Asukoht: index.php?controller=AdminLogin&token=37b476c0666f5eb588837a8f7774eb66&redirect=AdminPdf [järgnev] --2017-04-17 14:52:13-- http://www.example.ee/admin1111/index.php?controller=AdminPdf'>http://www.example.ee/admin1111/index.php?controller=AdminPdf&token=37b476c0666f5eb588837a8f7774eb66&redirect=AdminPdf Kasutan ühendust serveriga www.example.ee:80. HTTP päring saadetud, ootan vastust... 200 OK Pikkus: 6283 (6,1K) [text/html] Salvestan: `http://www.example.ee/admin1111/index.php?controller=AdminPdf'>http://www.example.ee/admin1111/index.php?controller=AdminPdf' 100%[======================================>] 6 283 --.-K/s aeg 0s 2017-04-17 14:52:13 (12,6 MB/s) - `http://www.example.ee/admin1111/index.php?controller=AdminPdf'>http://www.example.ee/admin1111/index.php?controller=AdminPdf' salvestatud [6283/6283] Kustutan http://www.example.ee/admin1111/index.php?controller=AdminPdf'>http://www.example.ee/admin1111/index.php?controller=AdminPdf, kuna see peaks olema tagasi lükatud. LÕPETATUD --2017-04-17 14:52:13-- Täielik aeg: 0,3s Alla laetud: 1 faili, 6,1K aeg 0s (12,6 MB/s)
  8. How can I do that? I tried wget the URL and I got only html page not generated pdf
  9. Hello, So I'm looking for a solution to save invoice automatically into my server folder, when I press view invoice as the generated URL occurs (http://domainurl/index.php?controller=AdminPdf&token=token&submitAction=generateInvoicePDF&id_order=id). I also did research on google, but this solution, somehow didnt work for me: https://www.prestashop.com/forums/topic/465729-automatically-generate-invoices-in-a-folder/ protected function sendOutputData($data, $length) { if (!isset($_SERVER['HTTP_ACCEPT_ENCODING']) OR empty($_SERVER['HTTP_ACCEPT_ENCODING'])) { // the content length may vary if the server is using compression header('Content-Length: '.$length); } //save to disk if it is a PDF about an order $id_order = Tools::getValue('id_order'); if ($id_order) file_put_contents(_PS_ROOT_DIR_."your/path/to/pdfs/order-{$id_order}.pdf", $data); echo $data; } I'm using prestashop 1.6.1, when I tried this code, it dident save anything to savedir and I got an internal server error when I opened the generated URL
×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More