Jump to content

thijsvk

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by thijsvk

  1. Hmm, I'm still inclined to think that it might have something to do with the permissions, that echo doesn't work because the php file is not actually executed. Unfortunately, I'm rather limited in my knowledge. Might be an idea to ask someone like Vekia or ElPatron to have a look.
  2. Are the products set to have the quantities entered manually? Also, what are the chmod settings on the files? It could be that they don't have the right permissions to be executed
  3. Have you tested it with the path set in the script? $remote_csv_file = './scriptsActualizacion/uno.csv'; In theory you shouldn't have to if they're in the same location, but theory...
  4. Did you actually set a path to your CSV file, or is it set exactly as you posted?
  5. Hi all, sorry for the delay in replying, holidays and all that. Happy Holidays!!! Only just got back to the office, and really shouldn't be here, damn holiday flu. Glad everything is working out for you TACS, in my experience it usually is a bit of a pain to figure out and adjust someone else's code, or that might just be me. Yes, I use comma separation, but you can use any delimiter really, as long as you change it in line 32. thrillmetoo I will upload the macro files as soon as I have time to sanitize them, I have some end of year dead lines, so it will probably be next week before I get around to it. Again, I can't really take credit for this, other than finding it and sharing it here, but it is nice to see it being beneficial to others
  6. Hi ken-bcn, you have a few options if I understand you correctly. Correct me if I'm wrong, but you have different suppliers, and you don't want the quantities to be set to zero. Well, if the script works for you as is, without having to reset to zero, then you can just comment it out, so it doesn't run, just put // in front of each line from '//RESET CYCLE' to '//END'. Do you have stock information from all of your suppliers? If so, you can just use the solution above. Make a master excel stock file, put all the products from all of your suppliers in the first sheet, and then create separate sheets for each of your suppliers and populate them using the import function. Create/record a macro that updates all the different sheets and again with Vlookup, the quantities on the first sheet will automatically update as well. If you want you can put a button on that first sheet so that if you click it, it will call the macro and run the updates. You can then export the first sheet using the stockupdatemacro.xls (make sure you incorporate running the update macro in your stock workbook. That should do it, everything will run as it should in one go. Alternatively, you can take the original process and use it to set up individual cronjobs for each of your suppliers. Each cronjob will then update an individual supplier and its products. Good luck!!!
  7. Hi TACS, thanks for the comments, I know, Notepad++ is awesome, it never occurred to me to use it for this exercise though, I'll have to look into that. with regards to the excess products, If I remember correctly, it will add them, but they won't show up on the front end. However, I prefer to keep the DB clean. For me, the simplest solution is to have all your products in an excel sheet (product column and quantity column, in the same workbook, start another sheet, and import the csv file from your supplier in that sheet. Using Vlookup, you can then have the first sheet check the available quantities for just your products. When you create the (new) macro template, you can record it to update the quantities, and then export the first sheet as the stock csv which will be uploaded.
  8. Hey TACS, it's not that hard really, just follow these steps: Prepare your csv upload, if you are lucky, then you can just use the information as provided by your supplier, otherwise you will need do some more work. Assuming your supplier does not send you a csv file with just 'product_reference' and 'quantity', you will need to create an excel file with a macro that will extract that information and copy it to a new file, and save that file as a csv. Basically, open a new excel file > record macro > while recording, open the supplier file, select the columns you need, copy them, open a new excel file, paste the columns, save as something like 'stockinfo.csv' in a location of your choice > go back to the first excel file and click 'stop recording to finish the macro. Save this file as stockupdatemacro.xls(x). Add a job to Windows System Scheduler to run that macro file as often as you need, to regenerate the CSV file. You will need a program like AutoFTP to automatically (scheduled) upload the CSV file to your webhost, in a location of your choice. Copy the php cron job above and save it as something like cronstockupdate.php and upload this to a location of your choice on your webhost (remember where you upload the files). The cron task manager doesn't really work, so your best bet is to use a site like easycron.com and set it to run the cronjob that you created (you need the location of the cron job for this) and then set it to run as often as needed. And that's it really. If you are able to download the supplier stock info through ftp, you can automate that as well, so it downloads it when you tell it to, and then have the macro job run a few minutes afterwards, followed by the AutoFTP upload a few minutes after that, and then the cronjob a few minutes after that.
  9. Yay Aftership support!! They sorted out my issue. Before I gave them (limited) access to the BO and FTP, I reverted all my changes, so they could start with a clean slate. We had some issues with sending the credentials, but once they had those, they fixed it within a few days.
  10. I wish it was that easy . No "Move JavaScript" is not active, and the situation is the same on both Chrome and FF on multiple devices on multiple networks. I might just have to look into the tracking url.
  11. Somehow adding the iframe made the tracking button appear. Not sure how or what, but of course that means that I don't need the iframe anymore. Unfortunately, removing it, makes the button dissapear again so I've set the width of the iframe to 100% and the height to 1px, giving me a nice line. Confused. Edit: For !"£$%^&*()_ sake, the button is displayed now but in FireFox only! AAAARRRRGGGHHH!!!!! Edit (again); it seems it's not browser related, the button has once again dissapeared. Edit (yes, again): I'm starting to think that it has something to do with Aftership's site/back end. After more mesing around, I managed to get the button back, both in Chrome and FF, only for it to disappear again. I decided not to make any changes to the code, and just refresh the page, a lot, a lot lot. And all of a sudden the button appears again.
  12. Same problem here. Moving the literal tags inside the script didn't help either. Aftership have asked for store admin access, which I'm rather reluctant to give. it seems rather pointless to me anyway, since you need to edit the tpl files on the server, so having a look in the BO would make no difference, right? Unless I'm missing something of course (not unlikely frankly). So yes, still looking for a solution. And the information is actually present on the page, just not displayed <td class="footable-last-column"> <span class="shipping_number_show"> <div id="as-root"></div><script>/* <![CDATA[ */;(function(e,t,n){var r,i=e.getElementsByTagName(t)[0];if(e.getElementById(n))return;r=e.createElement(t);r.id=n;r.src="//button.aftership.com/all.js";i.parentNode.insertBefore(r,i)})(document,"script","aftership-jssdk");/* ]]> */</script> <div data-tracking-number="1Z31Y1Y90496427607" data-size="large" data-domain="track.aftership.com" class="as-track-button"></div> </span></td> Edit: After pointing out that BO access would be of no use, they have now asked for FTP access as well.
  13. This is my solution on 1.6.1.1 (cross post). My knowledge is limited, so the more people look at it, and give input the better.
  14. SORTED!!!! The problem was that the reset to zero code didn't execute properly / at all. Whether this had to do with the location within the rest of the code, I have no idea. This resulted in the quantities in the csv file being added to the quantities present in the DB, rather than overwriting them (only for product combination quantities) So after messing with it for several hours, I managed to correct the code, well to execute as intended with the desired result. Not by writing code or anything, don't have the knowledge (not enough time to learn really, and yes, it is rather essential, but tell it to my boss). Below is the entire cron job php code, for use with a csv file consisting of two columns: 'reference' and 'quantity'. The code resets all the quantities in the DB to zero first, and then updates the DB with the quantities from the DB. Of course, the csv needs to be uploaded to the defined location, we use Auto FTP Manager for that. So, if you get a daily csv file with product quantities from your supplier, this would be the way to have 'live' stock information on your site (depending on the frequency with which you receive the information from your supplier(s)). <?php // PRESTASHOP SETTINGS FILE require_once ('../config/settings.inc.php'); // REMOTE CSV FILE (CUSTOMIZE YOURCSVFILEPATH, CAN BE AN URL OR A LOCAL PATH) $remote_csv_file = '../upload/stock/XXXXXX.csv'; //MY PATH; CHANGE TO YOUR NEED, SAME FOR THE FILE NAME // DB CONNECTION (CUSTOMIZE YOURDBHOSTNAME AND YOURDBPORT) $db = new PDO("mysql:host=localhost;port=3306;dbname="._DB_NAME_."", _DB_USER_, _DB_PASSWD_); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); set_time_limit(600); // RESET CYCLE //START $default_qta = 0; $updateAll = $db->prepare("update "._DB_PREFIX_."product SET quantity = :default_qta"); $updateAll->execute(array(':default_qta'=>$default_qta)); $updateAll = $db->prepare("update "._DB_PREFIX_."product_attribute SET quantity = :default_qta"); $updateAll->execute(array(':default_qta'=>$default_qta)); $updateAll = $db->prepare("update "._DB_PREFIX_."stock_available SET quantity = :default_qta"); $updateAll->execute(array(':default_qta'=>$default_qta)); // END // MAIN CYCLE $row_num = 0; if (($handle = fopen($remote_csv_file, "r")) !== false) { while (($data = fgetcsv($handle, 1000, ",")) !== false) { $row_num++; if ($row_num == 1) { // SKIP FIRST LINE (HEADER) continue; } if ($data[0] == '' || !is_numeric($data[1])) { // SKIP EMPTY VALUES continue; } // INPUT SANITIZATION //$reference =':reference'; //$quantity =':quantity'; $reference = trim($data[0]); $quantity = ($data[1] >= 0) ? $data[1] : 0; try { $res4 = $db->prepare("SELECT id_product, id_product_attribute from "._DB_PREFIX_."product_attribute WHERE reference = :reference"); $res4->execute(array(':reference'=>$reference)); if ($res4->rowCount() > 0) { // IT'S A PRODUCT COMBINATION $row4 = $res4->fetch(); $res = $db->prepare("update "._DB_PREFIX_."stock_available set quantity = :q where id_product_attribute = :id_product_attribute"); $res->execute(array(':q'=>$quantity, ':id_product_attribute'=>$row4['id_product_attribute'])); $res = $db->prepare("update "._DB_PREFIX_."product_attribute set quantity = :q where id_product_attribute = :id_product_attribute"); $res->execute(array(':q'=>$quantity, ':id_product_attribute'=>$row4['id_product_attribute'])); $res = $db->prepare("update "._DB_PREFIX_."stock_available set quantity = quantity + :q where id_product = :id_product and id_product_attribute = 0"); $res->execute(array(':q'=>$quantity, ':id_product'=>$row4['id_product'])); $res = $db->prepare("update "._DB_PREFIX_."product set quantity = quantity + :q where id_product = :id_product"); $res->execute(array(':q'=>$quantity, ':id_product'=>$row4['id_product'])); } else { // IT'S A SIMPLE PRODUCT $res4 = $db->prepare("SELECT id_product from "._DB_PREFIX_."product WHERE reference = :reference"); $res4->execute(array(':reference'=>$reference)); if ($res4->rowCount() > 0) { $row4 = $res4->fetch(); $res = $db->prepare("update "._DB_PREFIX_."stock_available set quantity = :q where id_product = :id_product and id_product_attribute = 0"); $res->execute(array(':q'=>$quantity, ':id_product'=>$row4['id_product'])); $res = $db->prepare("update "._DB_PREFIX_."product set quantity = :q where id_product = :id_product"); $res->execute(array(':q'=>$quantity, ':id_product'=>$row4['id_product'])); } } } catch (PDOException $e) { echo 'Sql Error: '. $e->getMessage() .'<br /><br />'; } } fclose($handle); } ?> It's impossible for me to take real credit for this, since I can't code, if it hadn't been for the original solution and comments here I would still be stuck
  15. I hate to bump, but BUMP. Does anyone have any ideas, thoughts or suggestions? Our new site has gone from developing to production two days ago, and today I looked into this issue again. The stock movements from our order system, are dumped into a csv file, this file is automatically uploaded to the website, and a cron job runs to update the stock levels on the site. As mentioned previously, that all works flawlessly, the issue is still the random stock amounts. The original source has some comments about issues with combinations, and that the quantities need to be set to zero first. AT line 26 //START $default_qta = 0; $updateAll = $db->prepare(“UPDATE “._DB_PREFIX_.”product SET quantity = :default_qta”); $updateAll->execute(array(‘:default_qta’=>$default_qta)); $updateAll = $db->prepare(“UPDATE “._DB_PREFIX_.”product_attribute SET quantity = :default_qta”); $updateAll->execute(array(‘:default_qta’=>$default_qta)); $updateAll = $db->prepare(“UPDATE “._DB_PREFIX_.”stock_available SET quantity = :default_qta”); $updateAll->execute(array(‘:default_qta’=>$default_qta)); // END That code has not worked for me, yet, I'm now considering setting up a separate cron job to reset the quantities to zero (with the above code) and then have the original cron run to update the stock levels. If anyone has any suggestions while I'm testing, please don't hold back
  16. Tom just place it all the way at the bottom of header.tpl. I placed it in the correct position, but ended up with a white bar at the top of my page, which I obviously didn't want. I moved it to the end in header.tpl (which is after <body>) and it seems to work fine. The <body> tag as such is not present, there's a lot more code included in the tag: <body{if isset($page_name)} id="{$page_name|escape:'html':'UTF-8'}"{/if} class="{if isset($page_name)} {$page_name|escape:'html':'UTF-8'}{/if}{if isset($body_classes) && $body_classes|@count} {implode value=$body_classes separator=' '} {/if}{if $hide_left_column} hide-left-column{/if}{if $hide_right_column} hide-right-column{/if}{if isset($content_only) && $content_only} content_only{/if} lang_{$lang_iso} {if !$content_only}{if $columns == 2} two-columns{elseif $columns == 3} three-columns{else} one-column {/if}{/if}"> {if !isset($content_only) || !$content_only} <!--[if IE 8]> as you can see, it starts with <body but ends quite a bit later with > (just before the second to last line in the snippet above). Good luck.
  17. Would this work to hide a cms category? I've tried it with the following: {if $smarty.get.id_cms_category==4} {if $logged} {$cms->content} {else} {l s='access forbidden, please log in first to view this page'} {/if} {else} {$cms->content} {/if} However, I have not yet managed to get it to work, basically, nothing happens, nothing gets 'hidden/blocked'. Individual pages work fine. Any suggestions, would it be possible to use this code to block multiple pages? If so, how? I really need to properly start learning php
  18. I've just made a test purchase using this module (payment by invoice). The order went through fine, payment accepted in BO, but if I go into the order, the following is displayed in messages: Refund operation result:REFUNDTRANSACTIONID: 5DC09XXXXXXXX852KFEEREFUNDAMT: 0.02GROSSREFUNDAMT: 1.25NETREFUNDAMT: 1.23CURRENCYCODE: GBPTOTALREFUNDEDAMOUNT: 1.25TIMESTAMP: 2014-08-26T13:45:23ZCORRELATIONID: 1adXXXXXXXXc3ACK: SuccessVERSION: 106.0BUILD: 12XXXXX3REFUNDSTATUS: InstantPENDINGREASON: NonePayPal refund successful! (XXXXXXs my obfuscation; since I don't know what the data relates to, I don't want to accidentally publicise possible payment data) Can anyone shed some light on this, particularly the PayPal bit at the end? Additionally, the time / date stamps are completely wrong?
  19. I know it's a bit of an old topic to kick back into life, but what changes do I need to make to this solution to make it work on 1.6.1.1? Currently I'm working on a new website for our trade customers and I need to add certain files for download (trade price list, image, other information that we don't want to release to consumers) which can only be visible to customers, and I'll be the one creating the accounts. Right now, if I implement the solution as posted by Vekia, the [spam-filter] himself, I get the following error: Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "C:\xampp\htdocs\prestashop\themes\theme1133\cms.tpl" on line 70 "{else}" unclosed {else} tag <-- thrown in C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatecompilerbase.php on line 70 When I check that line it is a commented out or blank line. If I remove the {else} at the end of the posted solution, it throws a variation of the error, claiming there's an unclosed {if} tag. So add another {/if} and the page loads again as normal, but with errors displayed on the page (cms category page): Notice: Undefined index: cms in C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatebase.php(157) : eval()'d codeon line 124 Notice: Trying to get property of non-object in C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatebase.php(157) : eval()'d code on line 124 Notice: Trying to get property of non-object in C:\xampp\htdocs\prestashop\tools\smarty\sysplugins\smarty_internal_templatebase.php(157) : eval()'d code on line 124 ] When I click the actual page (CMS ID 10), I can actually proceed to the page, even though I'm a visitor, i.e. not logged in. Can someone help me out?
  20. I'm trying to adapt this solution to my needs (allow access to several CMS pages to visitors, all others need login first), however, I don't even get that far. When I put in the override and remove class_index.php I get a 'Fatal error: Allowed memory size of "X" (tried to allocate "X" bytes) exhausted' on line XXX' Could this be because it is a local installation on XAMPP (PHP.ini has a memory limit of 128M) or could it have something to do with the actual override?
  21. Hi spazbot, have you been able to get this working with the code you posted?
  22. Hi Sors, thanks for this great module, does exactly what I needed. Have not had any issues on 1.6.1.1 and version 2.1. I do have a question/request (don't we all): in the FO when I hover the mouse over the payment option the bottom of the screen the following appears: javascript:;//Подробности Is there a way to change the Russian language? I believe it translates to 'Details'. I had a look in the module folder (and everywhere else as well actually) but I haven't been able to find the javascript to make some changes. Can you point me in the right direction? The only reason I wan to change it is to not freak out our customers, thinking the site (UK) might be 'hacked' because there is something Russian on there. No offence to you of course, but people are stupid, especially customers Oh and one other thing that will probably only apply to me; right now the default width for the row is col-xs-12, however my other payment modules are all col-xs-12 col-md-6. Any idea where to change this since there is no module specific css? Again, thank you for a great module.
  23. I like the look of this module, pretty much exactly what we need, but I do have some questions. Is there a way to amalgamate the orders and then create/send an invoice for all of them, say once a week or once a month? (adding individual orders and their order amounts to an invoice, haven't seen an option for it in your demo) Also, if you set the order amount limit, will it reduce when an order is placed by the order amount? Thanks.
  24. In that case you are going to have to modify the BlockBanner module. Unfortunately I don't have the skills to show you how. Good luck.
×
×
  • Create New...

Important Information

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