Jump to content

sergifri

Members
  • Posts

    11
  • Joined

  • Last visited

Profile Information

  • First Name
    sergi
  • Last Name
    fri

Recent Profile Visitors

282 profile views

sergifri's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. Hi Yohanes, Unfortunately, I was in a hurry at the time and I decided to set up a cron job that checked the orders already completed and selected the ones I wanted to change and then just update the order status as I needed. I never got to finish the proper method to do it. The problem is that, in the order_confirmation template, the Order confirmation hook is set before the payment return hook. Whe we use the order confirmation hook, we change the order status and then the payment return hook is called, this will validate the order, and this one is waiting for the original order status. And as I remember, depending on the payment method it could be a status or another: Bankwire Cash on delivery It could help to modify the payment modules or to create a new hook from scratch, but as I said, I never got to it Sorry, hope it helps you.
  2. Hola Roja45, Gracias por contestarme, sospechaba algo parecido y me lo has confirmado. En el momento de validar el pedido, la función encargada de ello intenta recibir como parámetro el estado correspondiente. Bankwire (transferencia): Cash on delivery (codfee, pago contra reembolso): El error se producirá por haber cambiado el estado del pedido antes de validar el pago (aunque el pago si que se ha producido correctamente). Estoy probando a utilizar el hook paymentReturn o displayPaymentReturn y ver si puedo ejecutar el código para cambiar el estado del pedido, pero no parece funcionar. ¿debería modificar las funciones que validan los pagos de los pedidos? Parece arriesgado. No tengo claro si existe un hook que actúe realmente cuando un pedido ha sido creado, validado y confirmado, es decir, cuando todos los cambios sobre el pedido entrante han finalizado. He hecho la prueba con hookActionObjectOrderHistoryAddAfter para cambiar el estado cuando el estado acaba de ser cambiado, es decir, cuando un pedido cambia su estado a por ejemplo Pago Aceptado, pero si ejecuto el cambio en OrderHistory en ese momento de la creación del pedido, añade el nuevo estado correctamente, pero en la tabla orders, el campo current_state sigue figurando como Pago Aceptado, como si en esa tabla se generara el estado después de en la tabla OrderHistory. Esto hace que desde la vista del controlador de pedidos, por fuera se vea todavía como Pago Aceptado y dentro del pedido se vea el nuevo estado, lo cual sería un error. Otra opción es utilizar una tarea cron que haga todos estos cambios cada x minutos sobre los pedidos que ya están creados y confirmados. Ahí no se produce ningún error pero no parece la forma correcta de programar. Seguro que se me escapa alguna tontería, ¿alguna forma sencilla de hacerlo? Supongo que tendré que estudiar el funcionamiento de otros módulos que modifiquen el estado del pedido entrante. Saludos!
  3. Hi Bossf3, As far as I know, Prestashop does not allow gif animations in the product images by default (at least until 1.6 version). If you upload a gif image it will probably show a static image, but there are modules that can do that for you. Regards.
  4. Good night everyone, I am programming a module that must change an order status just after it's finished, paid or not (bankwire, cash on delivery, paid with credit card etc). For that I am using hookOrderConfirmation. When a customer finishes an order he should see a confirmation page with the payment and order details for each payment method, but instead he always gets the error "We noticed a problem with your order. If you think this is an error, feel free to contact our expert customer support team." <?php public function hookOrderConfirmation($params) { if ($params) { $objOrder = $params['objOrder']; if (Validate::isLoadedObject($objOrder)) { $id_order = (int)$objOrder->id; $order = new Order($id_order); if (!Validate::isLoadedObject($order)) { return; } /// some code here, new status id will be 50 /// $history = new OrderHistory(); $history->id_order = $id_order; $history->id_employee = 44; $history->changeIdOrderState(50, $id_order); $history->add(true); $history->save(); //should I assign some template here? } } } ?> Order status is succesfully changed, and everything seems ok, but the warning alert is allways shown. I understand that the confirmation template for each payment method is not receiving the $status = 'ok' or whatever it needs to properly show the orders resume and confirmation, but I am a bit lost as how to achieve it. Should I add some code after changing the status, somehow calling another template from my module? Is it not the best hook for my needs? I am using Prestashop 1.6. Any help would be welcome, thanks in advance, Regards!
  5. Buenas noches, Estoy programando un módulo que cambie el estado de un pedido una vez finalizado, independientemente del modo de pago o si es un pago confirmado o una transferencia bancaria. Para ello estoy utilizando el hook orderConfirmation. Al realizar un pedido y finalizarlo el cliente debería mostrarse la página de confirmación del pedido, en el caso de la transferencia se mostrarían los datos bancarios, etc, en el pago contra reembolso la cantidad que será pagada, etc, pero sin embargo lo que muestra es el error genérico "Hay un problema con su pedido, póngase en contacto con el servicio de atención al cliente. servicio de atención al cliente" <?php public function hookOrderConfirmation($params) { if ($params) { $objOrder = $params['objOrder']; if (Validate::isLoadedObject($objOrder)) { $id_order = (int)$objOrder->id; $order = new Order($id_order); if (!Validate::isLoadedObject($order)) { return; } /// código por aquí, el nuevo id de estado para el pedido será 50 /// $history = new OrderHistory(); $history->id_order = $id_order; $history->id_employee = 44; $history->changeIdOrderState(50, $id_order); $history->add(true); $history->save(); //¿debería asignar aquí una plantilla? } } } ?> El pedido cambia correctamente de estado y aparentemente todo es correcto, pero siempre muestra el warning. Entiendo que a la plantilla de confirmación del tipo de pago que sea no le está llegando $status = 'ok' o lo que necesite que le llegue y por eso muestra el error, pero estoy un poco perdido a la hora de como corregir eso. ¿Debo añadir algún código al finalizar el cambio de estado del pedido? ¿Quizás no es este el hook ideal para lo que quiero hacer? El pedido debería cambiar de estado cuando está completamente finalizado y ya ha entrado para ser procesado. Estoy usando Prestashop 1.6 ,Gracias por cualquier ayuda que me podáis prestar, Saludos!
  6. Hello, I am developing a module which only function is to change the carrier from A to B when total amount paid is over a designated quantity. I tried hook ActionValidateOrder but it seems to me that it "starts" working before the order is fully complete and all the tables in the DB have been inserted with the order's data. I hace tried to change the carrier "offline" with a simple php script (no hooks, just setting the order's id manually) and it works but in real time it does not. What I am looking for is a hook that activates when an order has entered the system, payment accepted or not, and everything is already set, like if it was made 5 minutes ago, but in the moment it's made. I hope I am explaining myself. I am using Prestashop 1.6. I would say actionOrderStatusPostUpdate didn't work either. Thanks for any help!
  7. Hello, This may be a noob question but I am wondering if, when using an action hook like, for example, ActionUpdateQuantity, we have to return something in the function hookActionUpdateQuantity. I mean, when the hook is executed and the public function in the module is called, it processes the code we put inside the function and that's it. I am working on a module on P 1.6 that everytime a product's available stock comes down to 0, it will check the product in a table where I have previously stored an up to date list of our suppliers' products and availability, and, if this product is available for one of these suppliers, the module will set out_of_stock to 1 and allow selling it on the front. If, for example, the product with the stock coming down to 0 has got attributes, I don't want to continue with the process and I want to stop the function working for this product, should I just write something like this?: if (Product::getProductAttributesIds($params['id_product'])){ return; } Or maybe return true; Is the way of stopping the function what bothers me, and also, what happens if I check everything and finally I set out_of_stock=1 ? Should I finish the function execution with something like return or leave it like that? I am worried about what happens with the rest of the processes that are functioning at the same time besides my module when it is called. If we check Stockavailable.php we can see that, after Hook::exec('actionUpdateQuantity...) there is still some more code to execute and if this happens during a sale, there will be a lot more things to happen like the order process, updating the customer, etc I guess these are all parallel processes and this is not that important. Sorry if I am not explaining myself very well and thanks for any answer.
  8. Ok, I'll answer myself. After finding DBQuery.php in classes/db in the server, I realize that there is no option to use tables with other prefixes, not for LeftJoin or for any other: public function leftJoin($table, $alias = null, $on = null) { return $this->join('LEFT JOIN `'._DB_PREFIX_.bqSQL($table).'`'.($alias ? ' `'.pSQL($alias).'`' : '').($on ? ' ON '.$on : '')); } One could override this and create a new leftJoin function that allows you to use a different prefix or just change the name of the table. I wonder if there is any other way to do this while using DbQuery() but I guess not.
  9. Hello! I'm trying to create a query using DbQuery() and it seems that this class automatically sets the table prefix 'ps_' or whichever you have so you don't have to set it. For example: $query = new DbQuery(); $query->select(' whatever '); $query->from('product', 'p'); $query->innerJoin('product_lang', 'pl', 'pl.id_product = p.id_product'); $query->innerJoin('category_product', 'cp', 'cp.id_product = p.id_product'); As you can see, you don't need to write $query->from('ps_product', 'p'); It knows already the prefix to the tables. My problem is that I am trying to make a Left Join to a table I created with a different prefix, or not using the preset prefix at all. Having done that maybe a mistake, I don't know, but usually, the tables I create in my Prestashop database, have a different prefix to indicate to myself those are my tables. I know that there is something like '$addprefix = false' for DbQuery() but I can't find the documentation about it and where to set that false, and how to write the code about the table then. I am sure this has an easy solution. I have tried something like this: $query->leftJoin('frik_location', 'fl', 'fl.id_product = p.id_product AND fl.id_product_attribute = IFNULL(pa.id_product_attribute, 0)' , false); With that false at the end, but it does not work. So my table is called fik_location instead of ps_location (if i were to use the default prefix), anyone could help me with this? Thanks a lot in advance!
  10. Hola a todos, Esta es la primera duda que planteo en el foro y como suele suceder no estoy 100% seguro de si este es el lugar adecuado para ello, tampoco he conseguido encontrar respuesta a mi pregunta pero quizás haya sido planteada antes. Mi problema es que estoy configurando prestashop (1.6.1.4) para que acepte compras desde determinados países latinoaméricanos. La moneda por defecto en mi página es el euro, pero me gustaría que cuando un cliente se haya dado de alta desde uno de esos países o introduzca en el checkout (utilizo el módulo supercheckout que te permite ver todos los pasos del checkout en un mismo paso) su país de procedencia, por ejemplo Argentina, los precios cambien en el carrito automáticamente a dolares. He conseguido que quite el IVA pero no logro que pase a dolares. Actualmente tengo una pestaña que permite cambiar de Euro a Dolar (módulo Bloque de Divisa). Ahora mismo, esos países están configurados con su moneda por defecto dolar. Gracias por cualquier ayuda!
  11. Hola! Estoy empezando con esto de Prestashop y cada día aprendo cosas nuevas, pero también aparecen mil dudas nuevas. Espero poder resolver algunas de ellas gracias a este foro y quizás ayudar yo también a resolverselas a otros. Saludos y gracias!
×
×
  • Create New...