mirkos90
Members-
Posts
32 -
Joined
-
Last visited
Profile Information
-
Location
Italy, Latina
-
Activity
Web development agency
mirkos90's Achievements
Newbie (1/14)
0
Reputation
-
Create an order and INCREASE the quantity of the selected product
mirkos90 replied to mirkos90's topic in Core developers
Hi Pascal! Thanks for your answer! I've tried with your solution, now my code is: $context = Context::getContext(); $id_cart = $context->cookie->__get('id_cart'); $cart = new Cart($id_cart); $cart->id_currency = $context->cookie->id_currency; $cart->id_carrier = 1; $cart->recyclable = 0; $cart->gift = 0; $cart->id_customer = 92; $cart->id_lang = $context->cookie->id_lang; $cart->add(); $cart->updateQty(1,$id_product,null,false,'down'); $total = (float)($cart->getOrderTotal(true, Cart::BOTH)); $currency = $this->context->currency; $customer = new Customer($cart->id_customer); $prodotti = $cart->getProducts(); PaymentModule::validateOrder($cart->id,'2',$total); If I set the id of the status to 7 nothing happens, no order is created and no quantity is increased. But if i go to set the status to 2, prestashop give me an exception: [PrestaShop] Fatal error in module PaymentModule: Call to a member function addOrderPayment() on a non-object Why there is this error? Thanks! -
Hi to all! I've a little problem, i've writed this class for decrease the quantity of a product and make an order in prestashop: $context = Context::getContext(); $id_cart = $context->cookie->__get('id_cart'); $cart = new Cart($id_cart); $cart->id_currency = $context->cookie->id_currency; $cart->id_carrier = 1; $cart->recyclable = 0; $cart->gift = 0; $cart->id_customer = 92; $cart->id_lang = $context->cookie->id_lang; $cart->add(); $cart->updateQty(1,$id_product); $total = (float)($cart->getOrderTotal(true, Cart::BOTH)); $currency = $this->context->currency; $customer = new Customer($cart->id_customer); //($cart->id, Configuration::get('PS_OS_BANKWIRE'), $total, $this->module->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key); $prodotti = $cart->getProducts(); PaymentModule::validateOrder($cart->id,'7',$total); Now I need to write a similar function for make an order and increase the quantity of the selected product, how I can do it? I tried to change the sign of the quantity in the function updateQty, but it did not work. How I can do it? Thank you!
-
Prestashop 1.5 validateOrder and Error "Can't Save Error"
mirkos90 replied to mirkos90's topic in Core developers
Thanks Vekia! That's worked, but now i've another problem, my module class extends PaymentModule class, like an normal payment module like the bankwire module, but when I go to make an order, I've an error: [PrestaShop] Fatal error in module PaymentModule: Call to a member function addOrderPayment() on a non-object If I'm not too disturbing: could you help me? Thank you again!- 5 replies
-
- php
- prestashop 1.5
-
(and 2 more)
Tagged with:
-
Prestashop 1.5 validateOrder and Error "Can't Save Error"
mirkos90 replied to mirkos90's topic in Core developers
Please help me guys! What are usually the cause of this error?- 5 replies
-
- php
- prestashop 1.5
-
(and 2 more)
Tagged with:
-
Prestashop 1.5 validateOrder and Error "Can't Save Error"
mirkos90 posted a topic in Core developers
Hi guys, as usual i'm here for ask for some support I expose my problem quickly: I'm creating an module for make an order by putting an barcode (ean13) in a input, but i've an problem in the order validation function, here is my snippet of code $ean = Tools::getValue('barcode'); $id_product = $this->getProductByEAN($ean); if($id_product){ $context = Context::getContext(); $id_cart = $context->cookie->__get('id_cart'); $cart = new Cart($id_cart); $cart->id_currency = $context->cookie->id_currency; $cart->id_carrier = 1; $cart->recyclable = 0; $cart->gift = 0; $cart->id_customer = 1; $cart->id_lang = $context->cookie->id_lang; $cart->add(); $cart->updateQty(1,$id_product); $total = (float)($cart->getOrderTotal(true, Cart::BOTH)); $currency = $this->context->currency; $customer = new Customer($cart->id_customer); var_dump(PaymentModule::validateOrder($cart->id,'2',$total)); } Here is my print_r() of my Cart Object: Cart Object ( [id] => 293 [id_shop_group] => [id_shop] => 1 [id_address_delivery] => [id_address_invoice] => [id_currency] => 1 [id_customer] => 1 [id_guest] => [id_lang] => 1 [recyclable] => 0 [gift] => 0 [gift_message] => [mobile_theme] => [date_add] => 2014-07-03 17:22:58 [secure_key] => [id_carrier] => 1 [date_upd] => 2014-07-03 17:22:58 [checkedTos] => [pictures] => [textFields] => [delivery_option] => [allow_seperated_package] => [_products:protected] => Array ( [0] => Array ( [id_product_attribute] => 0 [id_product] => 132 [cart_quantity] => 1 [id_shop] => 1 [name] => Noch - NH07088 - Field grass, golden-yellow (5mm - 30gr.) [is_virtual] => 0 [description_short] => - NOME DEL PRODOTTO: Erba di campo alta, giallo oro (5mm) - AZIENDA: Noch - MISURE ALTEZZA: 5 mm - DESCRIZIONE: 30gr - CODICE: NH07088 [available_now] => [available_later] => [id_category_default] => 199 [id_supplier] => 0 [id_manufacturer] => 4 [on_sale] => 0 [ecotax] => 0.000000 [additional_shipping_cost] => 0.00 [available_for_order] => 1 [price] => 6.56 [active] => 1 [unity] => [unit_price_ratio] => 0.000000 [quantity_available] => 2 [width] => 0.000000 [height] => 0.000000 [depth] => 0.000000 [out_of_stock] => 2 [weight] => 0.000000 [date_add] => 2013-08-05 18:50:48 [date_upd] => 2014-06-09 17:36:42 [quantity] => 1 [link_rewrite] => erba-di-campo-alta-giallo-oro [category] => vegetazione [unique_id] => 13200 [id_address_delivery] => 0 [wholesale_price] => 0.000000 [advanced_stock_management] => 0 [supplier_reference] => [customization_quantity] => [id_customization] => [price_attribute] => [ecotax_attr] => [reference] => NH07088 [weight_attribute] => [ean13] => 4007246070886 [upc] => [pai_id_image] => [pai_legend] => [minimal_quantity] => 1 [stock_quantity] => 2 [price_wt] => 8 [total_wt] => 8 [total] => 6.56 [id_image] => 132-142 [legend] => [reduction_applies] => [quantity_discount_applies] => [allow_oosp] => 0 [features] => Array ( ) [rate] => 22 [tax_name] => IVA IT 22% ) ) [_taxCalculationMethod:protected] => 0 [webserviceParameters:protected] => Array ( [fields] => Array ( [id_address_delivery] => Array ( [xlink_resource] => addresses ) [id_address_invoice] => Array ( [xlink_resource] => addresses ) [id_currency] => Array ( [xlink_resource] => currencies ) [id_customer] => Array ( [xlink_resource] => customers ) [id_guest] => Array ( [xlink_resource] => guests ) [id_lang] => Array ( [xlink_resource] => languages ) ) [associations] => Array ( [cart_rows] => Array ( [resource] => cart_row [virtual_entity] => 1 [fields] => Array ( [id_product] => Array ( [required] => 1 [xlink_resource] => products ) [id_product_attribute] => Array ( [required] => 1 [xlink_resource] => combinations ) [id_address_delivery] => Array ( [required] => 1 [xlink_resource] => addresses ) [quantity] => Array ( [required] => 1 ) ) ) ) ) [id_shop_list] => [get_shop_from_context:protected] => 1 [table:protected] => cart [identifier:protected] => id_cart [fieldsRequired:protected] => Array ( [0] => id_currency [1] => id_lang ) [fieldsSize:protected] => Array ( [secure_key] => 32 ) [fieldsValidate:protected] => Array ( [id_shop_group] => isUnsignedId [id_shop] => isUnsignedId [id_address_delivery] => isUnsignedId [id_address_invoice] => isUnsignedId [id_carrier] => isUnsignedId [id_currency] => isUnsignedId [id_customer] => isUnsignedId [id_guest] => isUnsignedId [id_lang] => isUnsignedId [recyclable] => isBool [gift] => isBool [gift_message] => isMessage [mobile_theme] => isBool [allow_seperated_package] => isBool [date_add] => isDateFormat [date_upd] => isDateFormat ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [tables:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg [def:protected] => Array ( [table] => cart [primary] => id_cart [fields] => Array ( [id_shop_group] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_shop] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_address_delivery] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_address_invoice] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_carrier] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_currency] => Array ( [type] => 1 [validate] => isUnsignedId [required] => 1 ) [id_customer] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_guest] => Array ( [type] => 1 [validate] => isUnsignedId ) [id_lang] => Array ( [type] => 1 [validate] => isUnsignedId [required] => 1 ) [recyclable] => Array ( [type] => 2 [validate] => isBool ) [gift] => Array ( [type] => 2 [validate] => isBool ) [gift_message] => Array ( [type] => 3 [validate] => isMessage ) [mobile_theme] => Array ( [type] => 2 [validate] => isBool ) [delivery_option] => Array ( [type] => 3 ) [secure_key] => Array ( [type] => 3 [size] => 32 ) [allow_seperated_package] => Array ( [type] => 2 [validate] => isBool ) [date_add] => Array ( [type] => 5 [validate] => isDateFormat ) [date_upd] => Array ( [type] => 5 [validate] => isDateFormat ) ) [classname] => Cart ) [update_fields:protected] => ) The error that i have, is this: [PrestaShopException] Can't save Order at line 266 in file classes/PaymentModule.php Why i've this error? i've followed the structure of the module Bankwire for make this. Thank you!- 5 replies
-
- php
- prestashop 1.5
-
(and 2 more)
Tagged with:
-
[SOLVED] How I can direct purchase from my custom module?
mirkos90 replied to mirkos90's topic in Core developers
Perfect! Thank you very much guys! Mirko -
[SOLVED] How I can direct purchase from my custom module?
mirkos90 replied to mirkos90's topic in Core developers
Help?? -
[SOLVED] How I can direct purchase from my custom module?
mirkos90 posted a topic in Core developers
Hello, my question is simple and i hope that anyone can help me : can I make an purchase with a Prestashop class in my custom module? Considering that I have 2 variables: $product_id and $selected_quantity, I would then be able to enter a sale in prestashop. How I can do it? Thank you! -
Done Thank you again Mirko
-
Thank you! It's work fine! Mirko
-
Hi vekia and thank you for your answer, i've added this to my module class, why this didn't work? public function hookActionOrderStatusUpdate($params){ $h = fopen("log.txt","a+"); fwrite($h,print_r($params,true)); fclose($h); } I've tried also this: public function hookActionOrderStatusUpdate($params){ print_r($params);exit(); } Thank you! Mirko
-
Hi, I'm writing a module to synchronize a warehouse software with prestashop, but now I've a trouble: how I can write a function (in the module) that is executed when an customer purchase for an item in prestashop? Can anyone write an example of this? Prestashop version: 1.5 Thank you Mirko
-
Qui trovi tutto quello che ti interessa: http://www.prestashop.com/forums/topic/81348-module-snow-effect/ Ciao! Mirko