Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • First Name
  • Last Name

Recent Profile Visitors

54 profile views

java2dev's Achievements


Newbie (1/14)




Community Answers

  1. Hi everyone, I have a plugin that a use it to create products with marketplace. Functionality : - create xml feed(including local price currency of your shop, i.e marketplace US your shop in US with USD curency), send it via marketplace API. the issue I have is when the seller is foreigner (from Europe union) and he want to sell in US marketplace, how can send the XML feed with price conversion currency from Euro to USD? Thanks for help.
  2. Hello, I've tried a module in localhost and in different shops 1.6 version and it works fine, but with a specific shop I receive a popup with notice and warning, how it could happen only for one. There's anything to disable in the opciones admin side? Thank in advance, you can find the detail attached.
  3. Hello, I can save order from marketplace using this function public function saveOrder($cart, $order_id) { $order = new Order(); $customer = new Customer($this->linio_user_id); $context = Context::getContext(); $order->product_list = $cart->getProducts(); $order->id_address_delivery = $this->address_id; $order->id_address_invoice = $this->address_id; $order->id_cart = $cart->id; $order->id_currency = $cart->id_currency; $order->id_customer = $cart->id_customer; $order->id_carrier = $cart->id_carrier; $order->payment = 'Pay '; $order->module = 'L-sync'; $order->conversion_rate = 1; $order->secure_key = $customer->secure_key; $order->current_state = _PS_OS_PREPARATION_; $order->reference = $order_id; $order->id_lang = $context->language->id; $order->id_shop = (int) $context->shop->id; $order->id_shop_group = (int) $context->shop->id_shop_group; $order->total_products = $order->total_products_wt = (float) $cart->getOrderTotal( false, Cart::ONLY_PRODUCTS, $order->product_list, $order->id_carrier ); $order->total_paid_real = 0; $order->total_paid_tax_excl = $order->total_paid_tax_incl = (float) Tools::ps_round( (float) $cart->getOrderTotal( false, Cart::BOTH, $order->product_list, $order->id_carrier ), 2 ); $order->total_paid = $order->total_paid_tax_incl; $order->invoice_date = '0000-00-00 00:00:00'; $order->delivery_date = '0000-00-00 00:00:00'; if ($order->add()) { $order_detail = new OrderDetail(); $order_detail->createList($order, $cart, $order->current_state, $order->product_list); $data = array( 'id_order' => $order->id, 'id_linio_order' => $this->id, ); Db::getInstance()->insert('liniosync_orders', $data); return true; } return false; } I saved important order attribute but it miss price , I've tried using this but it doesn't work $order->total_paid_tax_incl = (int) $xml->Body->Orders->Order->OrderId->Price; any idea how I could save the price value in total_paid_tax_incl, always the value saved is 0.
  4. Hi, yes, I have a plugin to sync combinations to a marketplace. sometimes I need to update some data for example stock I can update using the prestashop quantity hook it's ok, but when I want to change description, short description, price, I save the new values(but nothing is happen in the other side (Marketplace)), so what I do is to click editing combination and then save to take in consideration the description and price update. it's look like fine, but the issue if I have for example 50 combinations I have to click one after one to update these data? Thank you.
  5. Hi, I want to know the difference between both hooks, but I find installed only hookActionProductAttributeUpdate even if I declare the other hook. In the other side I need to print id_product but I can print only id_product_attribute using this hook public function hookActionProductUpdate($params) { //a verificar. if ($params['id_product_attribute']) { $idp = $params['id_product']; echo $idp; $ida = $params['id_product_attribute']; echo $ida; $api = new LinioApi(); $pr = new LinioProduct($idp, false, Context::getContext()->language->id); $sku = $pr->getSku($idp); echo $pr->getSku($idp); $xml = simplexml_load_string($api->getProductBySku(array($sku))); $api->updateProduct($pr->getXmlDesc($ida)); } echo "test9"; die; } thanks for the help.
  6. Hi, did You resolve this issue , I have the same issue. I have my function like this. public function hookActionProductAttributeUpdate($params) { echo "test1"; die; if ($params['id_product_attribute']) { $idp = $params['id_product']; $ida = $params['id_product_attribute']; $api = new LinioApi(); $pr = new LinioProduct($idp, false, Context::getContext()->language->id); $sku = $pr->getSku($ida); $xml = simplexml_load_string($api->getProductBySku(array($sku))); $api->updateProduct($pr->getXmlDesc($ida)); } /*ob_start(); p($params); $content = ob_get_contents(); file_put_contents('update-pr.txt', $content, FILE_APPEND); ob_end_clean();*/ } this my function for xml public function getXmlDesc($attribute = null) { $sku = (!$attribute || !$this->attributes) ? $this->reference : $this->attributes[$attribute]['SellerSku']; //$qty = StockAvailable::getQuantityAvailableByProduct($this->id, $attribute); $xml = '<?xml version="1.0" encoding="UTF-8" ?><Request><Product>'; $xml .= $this->getXmlProperty('SellerSku', $sku); $xml .= $this->getXmlProperty('Description', $this->description); $xml .= '</Product></Request>'; return $xml; } I use the hook quantity and it works perfectly , but this one I cannot print echo test
  7. Yep, it's working, the "die" has help me to check the output, know it's working I had a problem in if condition at the top. I have a doubt as mentienned before I don't understand why there is a first hookaction (without loop) only test1 test10 and second time the function enter by the if $param. another question why I can't print id_product in this function (but it works for quantity hook) public function hookActionProductAttributeUpdate($params) { //a verificar. if ($params['id_product_attribute']) { $idp = $params['id_product']; echo $idp; $ida = $params['id_product_attribute']; echo $ida; $api = new LinioApi(); $pr = new LinioProduct($idp, false, Context::getContext()->language->id); $sku = $pr->getSku($ida); $xml = simplexml_load_string($api->getProductBySku(array($sku))); $api->updateProduct($pr->getXmlDesc($ida)); } echo "test9"; die; } I want to update description for combination, upc, price, etc
  8. I've found where is the issue, in the hook function this line has his value always is NULL $sku = $pr->getSku($ida); the getSku function I have like this public function getSku($attrib = 0) { return !$attrib ? $this->reference : $this->attributes[$attrib]['reference']; } for the $ida and $idp they print the value without problem, the dump of $pr print a huge array with many product information and include the sku value I need to have in getSku.
  9. when I added die; and click on save I received a message error as in the picture "parser error: SyntaxError: Unexpected token e in JSON in position 1" but I have put it more at the end public function hookActionUpdateQuantity($params) { echo 'test1'; echo $params; if ($params['id_product_attribute']) { echo 'test2'; $idp = $params['id_product']; echo "el id_product is : $idp"; $ida = $params['id_product_attribute']; echo "el id_product_attribute is : $ida"; $api = new LinioApi(); $pr = new LinioProduct($idp, false, Context::getContext()->language->id); echo 'test3'; $sku = $pr->getSku($ida); $xml = simplexml_load_string($api->getProductBySku(array($sku))); echo 'test4'; $qty = (int) $xml->Body->Products->Product->Quantity; $res = (int) $xml->Body->Products->Product->ReservedStock; $avl = StockAvailable::getQuantityAvailableByProduct($idp, $ida); echo 'test5'; if (($qty - $res) < $avl) { echo 'test6'; $api->updateProduct($pr->getXmlQty($ida)); echo 'test7'; die; echo 'test8'; } echo 'test9'; } echo 'test10'; } but I have printed test1Arraytest10test1Arraytest2el id_product is : 2el id_product_attribute is : 7test3test4test5test6test7
  10. hi, I have the presta hook hookActionUpdateQuantity with some codelines at the first I put an echo to see if the function executes but it doesn't print the echo. any idea? include(dirname(__FILE__).'/sql/install.php'); return parent::install() && Configuration::updateValue('LIN_LAST_SYNC', date('c')) && $this->registerHook('actionProductAttributeUpdate') && $this->registerHook('actionUpdateQuantity'); .... public function hookActionUpdateQuantity($params) { echo 'test'; //My code }
  11. Hola, en los siguientes codigos tengo los hooks de prestashop que ayudan a enviar la actualizacion de un atributo stock de skus, solo que al guardar el cambio nada sucede, la actualizacion no se aplica del otro lado donde he creado sincronizando los productos por el medio del mismo modulo. linsync.php require_once('classes/class.linapi.php'); require_once('classes/class.linproduct.php'); public function hookBackOfficeHeader() { if (Tools::getValue('module_name') == $this->name) { $this->context->controller->addJS($this->_path.'views/js/back.js'); $this->context->controller->addCSS($this->_path.'views/css/back.css'); } } public function hookActionProductAttributeUpdate($params) { ob_start(); p($params); $content = ob_get_contents(); file_put_contents('update-pr.txt', $content, FILE_APPEND); ob_end_clean(); } public function hookActionUpdateQuantity($params) { if ($params['id_product_attribute']) { $idp = $params['id_product']; $ida = $params['id_product_attribute']; $api = new LinApi(); $pr = new LinProduct($idp, false, Context::getContext()->language->id); $sku = $pr->getSku($ida); $xml = simplexml_load_string($api->getProductBySku(array($sku))); $qty = (int) $xml->Body->Products->Product->Quantity; $res = (int) $xml->Body->Products->Product->ReservedStock; $avl = StockAvailable::getQuantityAvailableByProduct($idp, $ida); if (($qty - $res) < $avl) { $api->updateProduct($pr->getXmlQty($ida)); } } } class.linapi.php public function updateProduct($xml) { return $this->makeRequest('ProductUpdate', $xml); } class.linproduct.php public function getXmlQty($attribute = null) { $sku = (!$attribute || !$this->attributes) ? $this->reference : $this->attributes[$attribute]['reference']; $qty = StockAvailable::getQuantityAvailableByProduct($this->id, $attribute); $xml = '<?xml version="1.0" encoding="UTF-8" ?><Request><Product>'; $xml .= $this->getXmlProperty('SellerSku', $sku); $xml .= $this->getXmlProperty('Quantity', $qty); $xml .= '</Product></Request>'; return $xml; } Gracias por su ayuda.
  12. cambie lo siguiente esta liga por //$base_url = Context::getContext()->shop->getBaseURL(); por $base_url = Tools::getHttpHost(true).__PS_BASE_URI__;
  13. j'ai changè //$base_url = Context::getContext()->shop->getBaseURL(); par celle-ci et ca marche $base_url = Tools::getHttpHost(true).__PS_BASE_URI__;
  14. I changed this //$base_url = Context::getContext()->shop->getBaseURL(); by this and it's work $base_url = Tools::getHttpHost(true).__PS_BASE_URI__;
  • Create New...

Important Information

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