Jump to content

Problem with Cash-on-delivery-with-fee and 1.3.x version


qdssoftware

Recommended Posts

Hi to all,

I have installed "Cashondeliverywithfee" with PrestaShop 1.3.x but I have detected a important bug...

clients cannot finish their orders because it stops with message "HACK (Order -> total_products_wt is empty)"

anybody has solved this problem ?

thanks!

regards

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...
  • 5 weeks later...

I modified two modules :

-Cash on delivery with fee aural (see serfer2 post under)
-Cash on delivery /deposit


I modified in the file cashondelivery.php( and cashondeliverywithfeeaural.php) the "// Copying data from cart" section. I copied the section from /classes/PaymentModules.php then i add the fee modification.

I changed a little the Cashondeliverywithfeeaural tpl files.

Maybe these modules need more modifications but i'm not a professional. But for now both of them are working with the 1.3.1.1 .

cashondelivery-deposit.zip

Link to comment
Share on other sites

  • 1 month later...

Warning !!!

this cashondeliverywithfeeaural-1.3.zip module has important bugs:

MonDeveloper's modification has a bug in function validateOrderCOD().
When new order is complete, order_detail DataBase insertions are incorrect.
Product quantity value, in order details, has the value of product stock in place of the customer's product quantity selection.

Maybe a Mistake between:
$product['quantity'] ---> the current product stock.
and:
$product['cart_quantity'] ---> number of units of a product that the customer wants to buy

Please, take a look to the attached file code, see the fix comments and report any suggestion.

regards ;)

cashondeliverywithfeeaural.php

Link to comment
Share on other sites

Sorry but I didn't get a “date invalide” error.

Please check your Prestashop version. This file/module is only compatible with 1.3.x versions

By the way, whenever you ask for help, you must provide most data as you can. “Date invalide” is not enough info, don't you think so?
You have to provide us info like:

- Which version of Prestashop are you using?
- Did you modified anything more?
- Can you attach your "cashondeliverywithfeeaural.php" source code file?
...

Link to comment
Share on other sites

I have ver 1.3 recently installed and on testing I realized that module "cashondeliverywith fee" will not work,

I therefore tried module Cash on delivery with fee aural (see serfer2 post under), and modified file cashondeliverywithfeeaural.php

Still on last step of payment I confirm and get this french message (my shop is in french) "date invalide". But order is validated.

I have not (yet) modified any other files except translations as I have lang EN, DE and FR in my shop.

Link to comment
Share on other sites

  • 4 weeks later...
  • 3 weeks later...
  • 1 month later...

i tried the cashondelivery-deposit proposed by eltito. it works fine but i have a little problem. i would like to allow my customers to pay yhe account (30%) by credit cart (paypal)
and when you click on "confirm the order" the customer go directly to the summary of all orders. and the command has the status "the commend is preparing" (don't know the translation in english)

i would like it to be in attempt of account

don't know if you see what i mean.

Link to comment
Share on other sites

Brutally you could comment out the offending validation lines:

in classes/Tools.php around line 284, change

if (!Validate::isDate($date) OR !Validate::isBool($full))
die (self::displayError('Invalid date'));

into:

//if (!Validate::isDate($date) OR !Validate::isBool($full))
// die (self::displayError('Invalid date'));

Please note that it's not a very good idea to comment out validation lines for security reasons.

HTH,
--
Giulio - http://pilv.it/

Link to comment
Share on other sites

  • 1 month later...

I have installed Aural COD w fee on 1.3.2.3 and i have one question.
Normal COD and other payment methods after validation of order (/modules/payment-method/validation.php) jump to page order-confirmation.php. But Aural COD w fee after validation jump to history.php. Is that normal or something is wrong ???

Link to comment
Share on other sites

  • 5 months later...
  • 3 months later...
  • 2 months later...

hi everyone. I'm sorry I wrote this post in spanish but i don't have time to translated. I made few changes in the original module which i were ussing in 1.3. and is running in 1.4.

 

here are the changes. Regards,

 

 

 

Yo he conseguido que el cashondeliverywithfeeaural funcione en 1.4.5 haciendo lo siguiente:

 

En primer lugar fue el problema con la ruta en el fichero validation.php que envia a validation.tpl y daba un error de que no encontraba la pagina. Modifique en validation.php

 

echo Module::display(__FILE__, 'validation.tpl');

 

por

 

echo Module::display(__PS_BASE_URI__.'modules/cashondeliverywithfeeaural', 'validation.tpl');

 

 

Yo lo tengo en el raiz, pero si lo tengo montado en la carpeta tienda lo pondria antes de modules.

 

echo Module::display(__PS_BASE_URI__.'tienda/modules/cashondeliverywithfeeaural', 'validation.tpl');

 

 

En segundo lugar copie de classes/paymentmodule.php la parte de //copying data from cart en el fichero de

 

cashondelivery...php y modifiqué algunas partes. El codigo final es:

 

/* Copying data from cart */

 

$order = new Order();

$order->id_carrier = (int)($cart->id_carrier);

$order->id_customer = (int)($cart->id_customer);

$order->id_address_invoice = (int)($cart->id_address_invoice);

$order->id_address_delivery = (int)($cart->id_address_delivery);

$vat_address = new Address((int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));

$order->id_currency = ($currency_special ? (int)($currency_special) : (int)($cart-

 

>id_currency));

$order->id_lang = (int)($cart->id_lang);

$order->id_cart = (int)($cart->id);

$customer = new Customer((int)($order->id_customer));

$order->secure_key = ($secure_key ? pSQL($secure_key) : pSQL($customer->secure_key));

$order->payment = Tools::substr($paymentMethod, 0, 32);

if (isset($this->name))

$order->module = $this->name;

$order->recyclable = $cart->recyclable;

$order->gift = (int)($cart->gift);

$order->gift_message = $cart->gift_message. "BLA:".$CODfee;

$currency = new Currency($order->id_currency);

$order->conversion_rate = $currency->conversion_rate;

$amountPaid = !$dont_touch_amount ? Tools::ps_round((float)($amountPaid)+$CODfee, 2) :

 

$amountPaid;

$order->total_paid_real = $amountPaid;

$order->total_products = (float)($cart->getOrderTotal(false, Cart::ONLY_PRODUCTS));

$order->total_products_wt = (float)($cart->getOrderTotal(true, Cart::ONLY_PRODUCTS));

$order->total_discounts = (float)(abs($cart->getOrderTotal(true,

 

Cart::ONLY_DISCOUNTS)));

$order->total_shipping = (float)($cart->getOrderShippingCost()+$CODfee);

$order->carrier_tax_rate = (float)Tax::getCarrierTaxRate($cart->id_carrier, (int)$cart

 

->{Configuration::get('PS_TAX_ADDRESS_TYPE')});

$order->total_wrapping = (float)(abs($cart->getOrderTotal(true, Cart::ONLY_WRAPPING)));

$order->total_paid = (float)(Tools::ps_round((float)($cart->getOrderTotal(true,

 

Cart::BOTH)), 2)+$CODfee);

$order->invoice_date = '0000-00-00 00:00:00';

$order->delivery_date = '0000-00-00 00:00:00';

 

 

 

 

 

El codigo Original

 

 

 

/* Copying data from cart */

 

 

$order = new Order();

$order->id_carrier = intval($cart->id_carrier);

$order->id_customer = intval($cart->id_customer);

$order->id_address_invoice = intval($cart->id_address_invoice);

$order->id_address_delivery = intval($cart->id_address_delivery);

$vat_address = new Address(intval($order->id_address_delivery));

$id_zone = Address::getZoneById(intval($vat_address->id));

$order->id_currency = ($currency_special ? intval($currency_special) : intval($cart-

 

>id_currency));

$order->id_lang = intval($cart->id_lang);

$order->id_cart = intval($cart->id);

$customer = new Customer(intval($order->id_customer));

$order->secure_key = pSQL($customer->secure_key);

$order->payment = Tools::substr($paymentMethod, 0, 32);

if (isset($this->name))

$order->module = $this->name;

$order->recyclable = $cart->recyclable;

$order->gift = intval($cart->gift);

$order->gift_message = $cart->gift_message. "BLA:".$CODfee;

$currency = new Currency($order->id_currency);

$amountPaid = !$dont_touch_amount ? Tools::ps_round(floatval($amountPaid)+$CODfee, 2) :

 

$amountPaid;

$order->total_paid_real = $amountPaid;

$order->total_products = floatval($cart->getOrderTotal(false, 1));

$order->total_products_wt = floatval($cart->getOrderTotal(true, 1));

$order->total_discounts = floatval(abs($cart->getOrderTotal(true, 2)));

$order->total_shipping = floatval($cart->getOrderShippingCost()+$CODfee);

$order->total_wrapping = floatval(abs($cart->getOrderTotal(true, 6)));

$order->total_paid = floatval(Tools::ps_round(floatval($cart->getOrderTotal(true, 3)

 

+$CODfee), 2));

$order->invoice_date = '0000-00-00 00:00:00';

$order->delivery_date = '0000-00-00 00:00:00';

Link to comment
Share on other sites

  • 3 months later...

Hola!!

 

Probe el modulo cashondeliverywithfeeaural, con la modificacion de E_MuNcH, pero no me funcionó.

Tengo prestashop 1.4.7 y al seleccionar esta forma de pago me sale el error:

No hay se encuentra plantilla para el módulo validation

 

 

I tested the module cashondeliverywithfeeaural with E_MuNcH modification, butdid not work.

I have prestashop 1.4.7 and selecting this payment method I get the error: There isa template for the validation module

Link to comment
Share on other sites

Pepocero:

 

there may be problem with validation.php module:

 

this is mine (updated to pass this problem):

 

 

<?php

 

include(dirname(__FILE__).'/../../config/config.inc.php');

include(dirname(__FILE__).'/../../header.php');

include(dirname(__FILE__).'/cashondelivery.php');

 

 

 

 

$cashOnDelivery = new CashOnDelivery();

if ($cart->id_customer == 0 OR $cart->id_address_delivery == 0 OR $cart->id_address_invoice == 0 OR !$cashOnDelivery->active)

Tools::redirectLink(__PS_BASE_URI__.'order.php?step=1');

 

/* Validate order */

if (Tools::getValue('confirm'))

{

$customer = new Customer((int)($cart->id_customer));

$total = floatval(number_format($cart->getOrderTotal(true, 3), 2, '.', ''));

$cashOnDelivery->validateOrderCOD((int)($cart->id), _PS_OS_PREPARATION_, $total, $cashOnDelivery->displayName);

$order = new Order((int)($cashOnDelivery->currentOrder));

Tools::redirectLink(__PS_BASE_URI__.'order-confirmation.php?key='.$customer->secure_key.'&id_cart='.(int)($cart->id).'&id_module='.(int)($cashOnDelivery->id).'&id_order='.(int)($cashOnDelivery->currentOrder));

}

else

{

/* or ask for confirmation */

 

$CODfee = $cashOnDelivery->getCostValidated($cart);

$CODdeposit = $cashOnDelivery->getDepositValidated($cart);

$cartcost = $cart->getOrderTotal(true, 3);

$deposit = $CODdeposit;

$total = $CODfee + $cartcost;

 

$smarty->assign(array(

'currency' => new Currency((int)($cart->id_currency)),

'deposit' => number_format((float)( $deposit ), 2, '.', ''),

'total' => number_format((float)( $total ), 2, '.', ''),

'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://').htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/cashondelivery/'

));

 

$smarty->assign('this_path', __PS_BASE_URI__.'modules/cashondelivery/');

 

$template = 'validation.tpl';

echo Module::display('cashondelivery', $template);

}

 

include(dirname(__FILE__).'/../../footer.php');

?>

Link to comment
Share on other sites

but the problem is that when confirming the order, I am redirected to history page, where I can track orders... Is there way how to redirect to correct page? In my case, it would be the page, where customer could select method to pay deposit.

(my settings are 50% on delivery, 50% of price as deposit - this should be possible to pay by credit card or bank wire transfer)

 

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...