
axelmdp
Members-
Posts
24 -
Joined
-
Last visited
Everything posted by axelmdp
-
Understanding advanced stock management
axelmdp replied to absolutic's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
I finally found a solution that solved many of my problems: I developed and added functionality that prevents this situation. Whenever some BO user changing the order's status to "shipped", it checks if there is enough stock on ALL products in the current order. If so, it continues as normal. But if not, it prevents the order's status change, and additionally shows an error message saying which product(s) is(are) out of stock, specifying how many units miss. It's great, because it force you to do the things as you must: you CAN'T ship items that you hasn't in stock. Regards, Axel -
Hola Oscar, muy buenas. Muchas gracias por tu consulta. Mi solución está publicada aquí: http://www.prestashop.com/forums/topic/221265-module-cart-details-on-checkout-errors-axel-ps15-ps14/ Puedo garantizarte que funcionará perfectamente; además, he adaptado el módulo para que funcione no sólo con PS1.5.x, sino también con PS1.4.x. Cualquier duda, pueden contactarme por mensaje privado, siempre respondo. Desde ya, muchas gracias. Un saludo Axel
-
Understanding advanced stock management
axelmdp replied to absolutic's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
Hello everyone. I just wanted to know if there is a bug on the advanced stock management or if this is a normal behavior (I'm using PS1.5.3.1, but I noticed that PS1.5.4.0 works in the same way). The current behavior is this: When the advanced stock management is enabled and the configuration for any product is like this: I want to use the advanced stock management system for this product -> checked Available quantities for current product and its combinations are based on stock in the warehouses -> selected When out of stock: -> Allow orders If there are 5 units of an element, and the client creates an order with more than the units available (i.e. 8), when the order's status of this order is changed to "shipped", the stock is not decreased (this happen whenever the resultant stock would be negative). The stock keeps being 5, so it doesn't even become zero. So, is this a bug, or is this the expected behavior? Why the stock isn't discounted? I look forward for your reply. Thanks! Axel -
Change the "Blocknewsletter" name? :)
axelmdp replied to Danielmedvec's topic in Ecommerce x PrestaShop [ARCHIVE BOARD]
Hello Daniel. The solution is quite easy: You should go to "Localization/Translations" on BO. Select "Installed module translations", select your theme and click on the desired language. On the page shown, seek the "Module: blocknewsletter". There, you will be able to define the name for each translation of that block. That's all! Best Regards Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details MultiTabsForProducts -
Hola fiti80. Estuve viendo tu tienda, el principal problema que tienes es la compatibilidad del tema: dentro de tus archivos TPL se referencian a las imágenes SIN el sufijo "_default" (típico de PS 1.4.x); pero tus imágenes están generadas con la definición de PS1.5.x, que agregaron ese sufijo. Para que se entienda, por ejemplo tienes la referencia a la imagen así: http__://vidriosdelevante.com/img/p/1/5/15-home.jpg y la imagen que realmente existe en el servidor es esta: http__://vidriosdelevante.com/img/p/1/5/15-home_default.jpg Ese fue el diagnóstico. Ahora para solucionarlo, hay varias alternativas. Entre ellas: Puedes editar tu archivo .htaccess y agregarle expresiones regulares para que transforme las URL de las imágenes agregándoles el sufijo _default (esta solución sería rápida y directa, pero te la recomiendo sólamente si tienes mucha experiencia en el tema de expresiones regulares; cualquier cosa, me preguntas) En el BO puedes ir a la parte de "Preferencias/Imágenes"; luego edita todos los tamaños quitándole el "_default" del nombre. Una vez que lo hayas hecho con todos, deberías (en la misma sección) ir a la parte de "Regenerar Miniaturas", borrando las anteriores (en realidad no estoy seguro de que borrará las que tienen sufijo "_default"; en caso de que queden, podrías borrarlas manualmente). Lo importante es que te genere las nuevas imágenes sin el sufijo; de esta manera existirán en la url buscada, y solucionarás tu problema. Pero ten en cuenta que el proceso de regeneración de miniaturas puede tardar un tiempo considerable y algunos servicios de hosting pueden cortarte el proceso. Por eso te recomendaría que lo hicieras en tu entorno local (si es que tienes) y luego copies la carpeta con las imágenes generadas. Espero te sirva de ayuda Cualquier cosa, me preguntas. Un saludo! Axel ------------------
-
Ok, I see. So, if I were you I would contact with the hosting support and I'd tell them about what has happened. Thanks! Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details MultiTabsForProducts
-
Hello PascalVG. Thank you for your contribution You're right with all that you say. I just want to add that it's necessary take care with the use of the absolute path ("'/' jumps directly to your root folder"), because the following: If your prestashop is not on the root url, you will have to add the proper path (i.e., "/myshop/"). Also if you have it in the root folder and later you decide to move your shop inside another folder, you will have to update all the references inside all the css files that are using absolute references. So, I'd recommend the use of the relative path instead the absolute, because you won't have to worry about these things. Regards, Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details MultiTabsForProducts
-
Hello Seog. You need to write the route relative to the path in which the CSS file relies on. If your css file is located in themes/THEME_NAME/css/modules/MODULE_NAME/MODULE_NAME.css then you should put /* five times "../" in order to refer to the root url, and then the img folder */ background:url('../../../../../img/imagename.jpg') If your css file is located in modules/MODULE_NAME/MODULE_NAME.css then you should put /* tree times "../" in order to refer to the root url, and then the img folder */ background:url('../../../img/imagename.jpg') I hope this help you. If so, then change the topic title adding the [sOLVED] prefix Best Regards, Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details MultiTabsForProducts
-
I see. It's strange. I noticed that you've done the remove procedure on your local desktop. Were the files downloaded from the site? Or they were infected on your computer. Since you said that you have had to remove it again, I suspect that there is a virus present on the host. If your files are in a host server, you should contact the service support in order to inform about this situation. If it is on your computer, it should be analyzed in order to remove for good the virus. Regards, Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details MultiTabsForProducts
-
Hello Daxidov. I think you should check mainly your modules and other folders in order to detect where the malicious code is. It could be in any php or tpl file, and it maybe would be hard to find it because it's likely that the text was not stored in the same way that you see (i.e., if you searched "a59dc4" and you found it inside a file, you'd be lucky. But it's likely that it would be put in other random way, in order to confuse (i.e. echo "a".'59'."d".'c'.'4'; ). Anyway, try to find it by the string a59dc4. Start with the simpler way first. So, I'd recommend you to make a copy of the whole site and configure it for running on your local environment. In this way you could check if the virus on your site code, or it could be something with your hosting server. And another additional test would be trying to access from another browsers and another machines, because it could be a virus on your local computer (but in this case, you would see the code in other different sites as well). I wish you luck, and I'm willing to help you, so any news please post it here on the public topic. Regards, Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details MultiTabsForProducts
-
You're welcome Pedro. Well, some considerations about the mentioned hook: 1 - You can get all parameters that you have put into the tab as "input" in this way: $myVar = Tools::getValue('INPUT_NAME'); 2 - You can get the product object in this way: $product = $params['return']; 3 - You should check if the save operation was sucessfull during the request processing. To do that, you could put your code inside this condition: if ($product AND Tools::getValue('MY_TAB_WAS_LOADED') == '1' AND $product->id) { //Put your code here } Where "MY_TAB_WAS_LOADED" it would be a field that you also should had added as input on the tab html code: <input name="MY_TAB_WAS_LOADED" type="hidden" value="1"> I'd recommend this strategy in order to ensure that your tab was properly loaded. Take in account that the loading tabs process is done via ajax, and it is possible that the user presses the save button when your tab has not even been loaded. I hope this was useful for you and the developers community. If you like it, click on the button. If you love it, make me a donation. I'd really appreciate it. Best Regards, Axel ------------------ Check this cool modules (must have) : MultiTabsForProducts LoginAsCustomer for PS1.5 Cart Details
- 11 replies
-
- tab
- backoffice
-
(and 1 more)
Tagged with:
-
Hello Pedro, how are you? You can use the hook "actionAdminProductsControllerSaveAfter" public function hookActionAdminProductsControllerSaveAfter($params) { //Your code... } Of course, don't forget to register and unregister the hook inside the install and uninstall methods, respectively. Bests Regards, Axel ------------------ Check this cool modules (must have) : MultiTabsForProducts LoginAsCustomer for PS1.5 Cart Details
- 11 replies
-
- tab
- backoffice
-
(and 1 more)
Tagged with:
-
Importing customer passwords from 1.4 to 1.5.4
axelmdp replied to DenisDenis's topic in Core developers
Great Denis! I'm glad you've found the solution. BTW,when you said "imported" on your first post, I had thought you meant that you had made a DB sql script for table export/import, and that was the way through I had guided you; that's why I did that suggestion. Have a nice day! Regards, Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details MultiTabsForProducts -
Importing customer passwords from 1.4 to 1.5.4
axelmdp replied to DenisDenis's topic in Core developers
Hello Denis. The key for encryption is on _COOKIE_KEY_ . Take a look at Tools.php, it uses explicity on this method: public static function encrypt($passwd) { return md5(_COOKIE_KEY_.$passwd); } As you should know, the password is stored encrypted. So you have made a right step copying the value from the old settings.inc.php to the new one. But I think maybe you haven't had into account that are some slight (but important) differences on the new table structure. This is a summary of the changes introduced from PS1.4.8 to 1.5.4 (PREFIX is related with your configuration, default is "ps"; this is only illustrative, don't run this script on your DB) ALTER TABLE `PREFIX_customer` ADD `id_shop_group` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_customer` , ADD `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1' AFTER `id_group_shop`, ADD INDEX `id_shop_group` (`id_shop_group`), ADD INDEX `id_shop` (`id_shop`), ADD `id_lang` INT UNSIGNED NULL AFTER `id_default_group`; UPDATE `PREFIX_customer` SET id_lang = (SELECT `value` FROM `PREFIX_configuration` WHERE name = 'PS_LANG_DEFAULT' LIMIT 1); UPDATE `PREFIX_customer` c, `PREFIX_orders` o SET c.id_lang = o.id_lang WHERE c.id_customer = o.id_customer; You must ensure that all the new columns has the proper value. Could you check this out? I'm willing to help you, so I hope this would be helpful for you. If this is ok and you still cannot access properly with your old password, then I could guide you to do some debug tasks. Don't worry, your problem will be solved. Best Regards, Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details MultiTabsForProducts -
Hello sginfoocio. Since you have added a new field, this is not automatically updated on prestashop. So, you have to add code in order to process it. I tried to guide you through this process. Please take a look to the code that I've put on post #2. You should use that code as base. However, it is incomplete, because I don't know where have you added the new field, and I'm not sure if the name of the input field that you use for editing is "applied". Also, please have in mind that there are three actions that the user is allowed to do with any order detail: add, edit and delete. That's why I've added the "if" for processing. Inside each block, you will be sure about what action is beeing performed. So you will have to add the code for updating/adding or delete any row with the proper value. For example, if you've added the new field on the same table "ps_order_detail", you could add this line inside the "if" block if($action == 'editProductOnOrder') : Db::getInstance()->Execute( 'UPDATE `'._DB_PREFIX_.'order_detail` SET `applied` = '.(int)$applied. ' WHERE `id_order_detail` = '.(int)$product_id_order_detail ); Regarding to change the admin_order.js file, I think you would have to change it. On my post #2 I mean you won't have to change the EDIT function, but I think you will have to change the ADD function (the function associated to "submitAddProduct" button), because it doesn't consider new fields in a general way. I hope this would be helpful for you. Best Regards, Axel
-
Hello sginfoocio. I'd suggest you that you try to do it implementing a module, whenever is possible. However, we know that it's not always possible. Analysing your situation, I infered that you are using PS 1.5.x (because _product_line.tpl is not present on PS 1.4), and also that you are talking about Order Edit within Order Details on BO. It is important that you add this information on your post in order to put in context to all users that are willing to help you. Assuming that, I followed the code, and when the user press the Update button, there is a Javascript function that is reached (if you want to trace it, look into admin_order.js, on line 651 approx at "$('input[name=submitProductChange]').click(function() {"). If you added the "applied" field to be editable and it is a visible input or select, you won't need to modify nothing on this javascript function, because the function will include it (this is regarding edit an order line) However, when the user adds a new order detail, the procedure is different, and maybe you will have to modify the JS funtion in order to include your new field (look near line 425, "$('#submitAddProduct').click(function(e) {"; the url params are built using id instead element selectors) After that, and after the ajax invocation to the AdminOrdersController.php file, the methods finally reached are these three (depending on the action that the user has performed): ajaxProcessAddProductOnOrder ajaxProcessEditProductOnOrder ajaxProcessDeleteProductLine Please notice that all these three methods ends with a "die" php sentence, so when you include your saving functionality, you won't be able to do nothing after the methods finish. You must do it before. I'm not sure if it is the best approach, but I'd suggest you to override the sendChangedNotification method, that is is called just before the die sentence from all the three methods. My suggestion is based on keeping the override functionality to the minimum (if not zero) and I wouldn't suggest the approach of overriding the three methods, because inside of each one there are some validations that could prevent the proper processing. When the sendChangedNotification method is called, every validation was properly passed and there weren't errors, so there is a good point for you to add your add/update/delete functionality. You could do something like this on override/controllers/admin/AdminOrdersController.php: public function sendChangedNotification(Order $order = null) { //calling to the parent method parent::sendChangedNotification($order); //Your code here: $action = Tools::getValue('action'); if($action == 'addProductOnOrder') { //Add the value of your field $applied = Tools::getValue('applied'); $product_id = $_POST['add_product']['product_id']; //... } else if($action == 'editProductOnOrder') { //Update your field value $product_id_order_detail = Tools::getValue('product_id_order_detail'); $applied = Tools::getValue('applied'); //... } else if($action == 'delete_product_line') { //Delete your field $id_order_detail = Tools::getValue('id_order_detail'); //... } } I hope this will help you I look forward for your comments. Kind Regards, Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details
-
Hello ziq. I know what your problem is. The fact is that it's not feasible to access to a cookie with the admin path from a different path. So, all possible solutions will be "workarounds". And I can suggest you one: I'd use a strategy like this: On your admin-hook module or tab content generation function, include an encrypted token, along with an employee ID, and send both parameters to your ajax php file. For example: //inside the tab content generator global $cookie; $idEmployee = (int)$cookie->id_employee_logged; $timeGenerated = time(); $cryptToken = md5($idEmployee . _COOKIE_KEY_ . $timeGenerated); //this is a sample, it has to be located inside a <script> tag, it performs an ajax call using jQuery $html .= '$.ajax({ type: "POST", url: "'._MODULE_DIR_.'/mymodule/ajax.php", data: "cryptToken=' . $cryptToken . '" + "&idEmployee=' . $idEmployee . '"+ "&timeGenerated='.$timeGenerated.'" //and other data parameters //other ajax parameters... }); '; On your ajax php file, check that you are receiving the expected data as is shown below: //settings.inc.php has the define for _COOKIE_KEY_ ... it has only around 20 defines sentences, so it won't take too much time to load. require(dirname(__FILE__). '/../../config/settings.inc.php'); //you can define this value as you whish. $MAX_TIME = 60*10; //GET THE PARAMETERS $idEmployee = (int)$_POST['idEmployee']; $timeGenerated = (int)$_POST['timeGenerated ']; //Generate the expected token $cryptToken = md5($idEmployee . _COOKIE_KEY_ . $timeGenerated); //validate that the token is correct and the time has passed less than MAX_TIME if($_POST['cryptToken'] == $cryptToken AND ((time()-$timeGenerated)<$MAX_TIME) ) { //do your ajax stuff here :-) } Of course, this approach can't verify that the employee is still logged... but at least you can limit the max_time to allow the request since the orginal page was loaded. It's suppossed to work ok most of the times. So I hope it help you to do what you want. If this has answered to your question, you can edit the post and mark it as solved. Best Regards, Axel ------------------ Check this cool modules (must have) : LoginAsCustomer for PS1.5 Cart Details
-
[SOLVED] More info with "An item in your cart is no longer available"
axelmdp replied to pmikhey's topic in Core developers
Hello pmikhey. I've developed a very cool module that will solve your problem. And because it is implemented as a module, it won't require any modification on your PS core (as you surely know, when less modifications/overrides on the core classes you do, the upgrade is easier). The module also has an "Automatic adjustment" button. You can find it here: Cart Details I hope you find it useful. Best Regards, Axel ------------------ Check also this cool module (must have) : LoginAsCustomer for PS1.5 -
Hello skorupa. I hope is not too late for you. I have a solution for you: public function hookDisplayAdminProductsExtra($params) { $id_product = Tools::getValue('id_product'); $product = new Product($id_product); //.. return 'output'; } I hope this would be helpful for you (or anyone else reading this topic ) Best Regards, Axel ------------------ Check this cool modules (must have) : MultiTabsForProducts LoginAsCustomer for PS1.5 Cart Details
- 11 replies
-
- 3
-
-
- tab
- backoffice
-
(and 1 more)
Tagged with:
-
Me alegro mucho Aspardo Un cordial saludo!
- 3 replies
-
- url amigables
- error acentos
-
(and 1 more)
Tagged with:
-
Hola Aspardo. Intenté reproducir el error en mi versión Prestashop PS1.5.3.1, pero no pude reproducirlo (pude reproducir el mensaje, pero forzando la generación para que permita "ñ", ya que en su comportamiento normal no me lo permitió). No obstante, si quieres solucionar el problema, te recomiendo que primero hagas un backup de la base de datos, y luego ejecutes estos dos script de SQL: UPDATE `ps_cms_lang` SET `link_rewrite` = REPLACE(REPLACE(`link_rewrite`, 'ñ','n'),'Ñ','N'); UPDATE `ps_product_lang` SET `link_rewrite` = REPLACE(REPLACE(`link_rewrite`, 'ñ','n'),'Ñ','N'); Como verás, reemplazará toddas las "ñ" por "n" y todas las "Ñ" por "N" en las url amigables, tanto de los CMS como de los productos. Si hay otros caracteres inválidos además de las "ñ", puedes agregar un remplazo para cada simbolo por uno válido. Si tienes dudas, me consultas. Espero esto te ayude a resolver el problema. Luego por favor avisame cómo te fue. Saludos! Axel
- 3 replies
-
- 1
-
-
- url amigables
- error acentos
-
(and 1 more)
Tagged with:
-
Hola Aspardo. He desarrollado una solución al respecto. De esta manera, se muestra un mensaje de error más descriptivo que el actual, y además se resaltan cuáles son los productos que tienen errores. Puedes observar el resultado en la imagen que está al final de este mensaje. Esta solución funciona perfectamente en PS 1.5.x. Si tienes PS 1.4.x, dime y la adaptaría para que te funcione. A cambio, te pediría una donación. Puedes contactarme por mensaje privado y me comentas. Muchas gracias. Saludos! Axel
-
Hola, alg12. Quizás ya lo resolviste, pero si te pone ese error, podría sugerirte que revises en la parte de Empleados/Permisos, y te fijes si el rol con el usuario que estás ingresando tiene chequeados los permisos de "ver", "editar" "añadir" y "suprimir". ¿Te ha servido de ayuda? Por cierto, ¿dónde has descargado la versión 2.82? Si puedes, por favor, adjúntala al foro. Gracias! Saludos.