Jump to content

Problema en mail con bankwire plus (ayuda urgente)


Recommended Posts

Hola el modulo aplica descuento y todo inclusive desde cuenta se ve bien, el problema que el mail de order confirmation sale asi

 

captura4ir.jpg

 

desde la cuenta se ve bien los datos miren

captura5i.jpg

 

usando otros modulos llegan perfecto los mails alguna idea de por que sale ese array array?

Link to comment
Share on other sites

Hola el modulo aplica descuento y todo inclusive desde cuenta se ve bien, el problema que el mail de order confirmation sale asi

 

captura4ir.jpg

 

desde la cuenta se ve bien los datos miren

captura5i.jpg

 

usando otros modulos llegan perfecto los mails alguna idea de por que sale ese array array?

Revisa la function validation que seguramente este sobreescrita en dicho modulo. (tienes que retocarla)

Link to comment
Share on other sites

donde hay guia para ver eso Nadie sos un groso por como ayudas, pero recorda 0 de programacion yo:(

 

mira amigo me dice esto el validation dle modulo

 

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

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

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

 

$bankwire = new BankWire_plus();

 

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

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

 

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

 

if (!Validate::isLoadedObject($customer))

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

 

 

 

y el

 

php de bankwire es este

 

if (!defined('_CAN_LOAD_FILES_'))

exit;

 

class BankWire_plus extends PaymentModule

{

private $_html = '';

private $_postErrors = array();

 

public $details;

public $owner;

public $address;

public $dto;

 

public function __construct()

{

$this->name = 'bankwire_plus';

$this->tab = 'payments_gateways';

$this->version = '0.5';

$this->author = 'PrestaShop';

 

$this->currencies = true;

$this->currencies_mode = 'checkbox';

 

$config = Configuration::getMultiple(array('BANK_WIRE_DETAILS', 'BANK_WIRE_OWNER', 'BANK_WIRE_ADDRESS', 'ORDER_DISCOUNT'));

if (isset($config['BANK_WIRE_OWNER']))

$this->owner = $config['BANK_WIRE_OWNER'];

if (isset($config['BANK_WIRE_DETAILS']))

$this->details = $config['BANK_WIRE_DETAILS'];

if (isset($config['BANK_WIRE_ADDRESS']))

$this->address = $config['BANK_WIRE_ADDRESS'];

if (isset($config['ORDER_DISCOUNT']))

$this->dto = $config['ORDER_DISCOUNT'];

 

parent::__construct();

 

$this->displayName = $this->l('Bankwire with discount');

$this->description = $this->l('Accepts bankwire payments and applies a discount');

$this->confirmUninstall = $this->l('Are you sure you want to delete your details?');

if (!isset($this->owner) OR !isset($this->details) OR !isset($this->address))

$this->warning = $this->l('Account owner and details must be configured in order to use this module correctly.');

if (!sizeof(Currency::checkPaymentCurrencies($this->id)))

$this->warning = $this->l('No currency set for this module');

}

 

public function install()

{

if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn'))

return false;

return true;

}

 

public function uninstall()

{

if (!Configuration::deleteByName('BANK_WIRE_DETAILS')

OR !Configuration::deleteByName('BANK_WIRE_OWNER')

OR !Configuration::deleteByName('BANK_WIRE_ADDRESS')

OR !Configuration::deleteByName('ORDER_DISCOUNT')

OR !parent::uninstall())

return false;

return true;

}

 

private function _postValidation()

{

if (isset($_POST['btnSubmit']))

{

if (empty($_POST['details']))

$this->_postErrors[] = $this->l('Account details are required.');

elseif (empty($_POST['owner']))

$this->_postErrors[] = $this->l('Account owner is required.');

}

}

 

private function _postProcess()

{

if (isset($_POST['btnSubmit']))

{

Configuration::updateValue('BANK_WIRE_DETAILS', $_POST['details']);

Configuration::updateValue('BANK_WIRE_OWNER', $_POST['owner']);

Configuration::updateValue('BANK_WIRE_ADDRESS', $_POST['address']);

Configuration::updateValue('ORDER_DISCOUNT', $_POST['dto']);

}

$this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('ok').'" /> '.$this->l('Settings updated').'</div>';

}

 

private function _displayBankWire()

{

$this->_html .= '<img src="../modules/bankwire_plus/bankwire.jpg" style="float:left; margin-right:15px;"><b>'.$this->l('This module allows you to accept payments by bank wire and applies a discount.').'</b><br /><br />

'.$this->l('If the client chooses this payment mode, the order will change its status into a \'Waiting for payment\' status.').'<br />

'.$this->l('Therefore, you must manually confirm the order as soon as you receive the wire.').'<br /><br /><br />';

}

 

private function _displayForm()

{

$this->_html .=

'<form action="'.$_SERVER['REQUEST_URI'].'" method="post">

<fieldset>

<legend><img src="../img/admin/contact.gif" />'.$this->l('Contact details').'</legend>

<table border="0" width="500" cellpadding="0" cellspacing="0" id="form">

<tr><td colspan="2">'.$this->l('Please specify the bank wire account details for customers').'.<br /><br /></td></tr>

<tr><td width="130" style="height: 35px;">'.$this->l('Account owner').'</td><td><input type="text" name="owner" value="'.htmlentities(Tools::getValue('owner', $this->owner), ENT_COMPAT, 'UTF-8').'" style="width: 300px;" /></td></tr>

<tr>

<td width="130" style="vertical-align: top;">'.$this->l('Details').'</td>

<td style="padding-bottom:15px;">

<textarea name="details" rows="4" cols="53">'.htmlentities(Tools::getValue('details', $this->details), ENT_COMPAT, 'UTF-8').'</textarea>

<p>'.$this->l('Such as bank branch, IBAN number, BIC, etc.').'</p>

</td>

</tr>

<tr>

<td width="130" style="vertical-align: top;">'.$this->l('Bank address').'</td>

<td style="padding-bottom:15px;">

<textarea name="address" rows="4" cols="53">'.htmlentities(Tools::getValue('address', $this->address), ENT_COMPAT, 'UTF-8').'</textarea>

</td>

</tr>

<tr>

<td width="130" style="vertical-align: top;">'.$this->l('Discount (in %)').'</td>

<td style="padding-bottom:15px;">

<input type="text" name="dto" size="4" value="'.Tools::getValue('dto', $this->dto).'">

</td>

</tr>

<tr><td colspan="2" align="center"><input class="button" name="btnSubmit" value="'.$this->l('Update settings').'" type="submit" /></td></tr>

</table>

</fieldset>

</form>

<table>

<tr>

<td align="center">

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">

<input type="hidden" name="cmd" value="_s-xclick">

<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHVwYJKoZIhvcNAQcEoIIHSDCCB0QCAQExggEwMIIBLAIBADCBlDCB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KBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTExMDYwODIwMDM1NlowIwYJKoZIhvcNAQkEMRYEFMvvJazimhULFhegcLRj6ZF84F7tMA0GCSqGSIb3DQEBAQUABIGADxPdN75t1OIAdgNUuLn1K9awzbjfeAfhTcjUe1BsvLLLXgMLnmNzu96jjeOXKx/ilnQupP+BSvXqSpymafQ0BT8Ke/DpQlmfqqVdrj08FSRNqfur+ldSRhK1IglDYslQI2vMgdgtwleo2e9mCxbACkmTLDE06+5I73w0FRIa8Dk=-----END PKCS7-----">

<br>Módulo Bankwire_plus - Desarrollado por Ricardo Collazo ([email protected])<br><br>

<input type="image" src="https://www.paypalobjects.com/es_ES/ES/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal. La forma rápida y segura de pagar en Internet.">

<img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1"><br> 

</form>

</td>

</tr>

</table>';

}

 

public function getContent()

{

$this->_html = '<h2>'.$this->displayName.'</h2>';

 

if (!empty($_POST))

{

$this->_postValidation();

if (!sizeof($this->_postErrors))

$this->_postProcess();

else

foreach ($this->_postErrors AS $err)

$this->_html .= '<div class="alert error">'. $err .'</div>';

}

else

$this->_html .= '<br />';

 

$this->_displayBankWire();

$this->_displayForm();

 

return $this->_html;

}

 

public function execPayment($cart)

{

if (!$this->active)

return ;

if (!$this->_checkCurrency($cart))

Tools::redirectLink(__PS_BASE_URI__.'order.php');

 

global $cookie, $smarty;

 

$rebaja = $cart->getOrderTotal(true, Cart::BOTH);

$rebaja -= number_format($cart->getOrderTotal(false, Cart::ONLY_PRODUCTS)*($this->dto/100),2);

 

$smarty->assign(array(

'nbProducts' => $cart->nbProducts(),

'cust_currency' => $cart->id_currency,

'currencies' => $this->getCurrency((int)$cart->id_currency),

'total' => $rebaja,

'this_path' => $this->_path,

'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'

));

 

return $this->display(__FILE__, 'payment_execution.tpl');

}

 

public function hookPayment($params)

{

if (!$this->active)

return ;

if (!$this->_checkCurrency($params['cart']))

return ;

 

global $smarty;

 

$smarty->assign(array(

'this_path' => $this->_path,

'rebaja' => number_format($params['cart']->getOrderTotal(false, Cart::ONLY_PRODUCTS)*($this->dto/100),2),

'dto' => $this->dto,

'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'

));

return $this->display(__FILE__, 'payment.tpl');

}

 

public function hookPaymentReturn($params)

{

if (!$this->active)

return ;

 

global $smarty;

$state = $params['objOrder']->getCurrentState();

if ($state == _PS_OS_BANKWIRE_ OR $state == _PS_OS_OUTOFSTOCK_)

$smarty->assign(array(

'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),

'bankwireDetails' => nl2br2($this->details),

'bankwireAddress' => nl2br2($this->address),

'bankwireOwner' => $this->owner,

'status' => 'ok',

'id_order' => $params['objOrder']->id

));

else

$smarty->assign('status', 'failed');

return $this->display(__FILE__, 'payment_return.tpl');

}

 

private function _checkCurrency($cart)

{

$currency_order = new Currency((int)($cart->id_currency));

$currencies_module = $this->getCurrency((int)$cart->id_currency);

$currency_default = Configuration::get('PS_CURRENCY_DEFAULT');

 

if (is_array($currencies_module))

foreach ($currencies_module AS $currency_module)

if ($currency_order->id == $currency_module['id_currency'])

return true;

}

 

/**

* Validate an order in database

* Function called from a payment module

*

* @param integer $id_cart Value

* @param integer $id_order_state Value

* @param float $amountPaid Amount really paid by customer (in the default currency)

* @param string $paymentMethod Payment method (eg. 'Credit card')

* @param string $message Message to attach to order

*/

public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)

{

global $cart;

 

$cart = new Cart((int)($id_cart));

// Does order already exists ?

if (Validate::isLoadedObject($cart) AND $cart->OrderExists() == false)

{

if ($secure_key !== false AND $secure_key != $cart->secure_key)

die(Tools::displayError());

 

// 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->id_address_delivery));

$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;

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

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

$amountPaid = !$dont_touch_amount ? Tools::ps_round((float)($amountPaid), 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());

$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)));

 

// esto es lo que cambio

$order->total_paid = $amountPaid; // not from cart, but from params

 

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

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

 

// Creating order

if ($cart->OrderExists() == false)

$result = $order->add();

else

{

$errorMessage = Tools::displayError('An order has already been placed using this cart.');

Logger::addLog($errorMessage, 4, '0000001', 'Cart', intval($order->id_cart));

die($errorMessage);

}

 

// Next !

if ($result AND isset($order->id))

{

if (!$secure_key)

$message .= $this->l('Warning : the secure key is empty, check your payment account before validation');

// Optional message to attach to this order

if (isset($message) AND !empty($message))

{

$msg = new Message();

$message = strip_tags($message, '<br>');

if (Validate::isCleanHtml($message))

{

$msg->message = $message;

$msg->id_order = intval($order->id);

$msg->private = 1;

$msg->add();

}

}

 

// Insert products from cart into order_detail table

$products = $cart->getProducts();

$productsList = '';

$db = Db::getInstance();

$query = 'INSERT INTO `'._DB_PREFIX_.'order_detail`

(`id_order`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_in_stock`, `product_price`, `reduction_percent`, `reduction_amount`, `group_reduction`, `product_quantity_discount`, `product_ean13`, `product_upc`, `product_reference`, `product_supplier_reference`, `product_weight`, `tax_name`, `tax_rate`, `ecotax`, `ecotax_tax_rate`, `discount_quantity_applied`, `download_deadline`, `download_hash`)

VALUES ';

 

$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));

Product::addCustomizationPrice($products, $customizedDatas);

$outOfStock = false;

foreach ($products AS $key => $product)

{

$productQuantity = (int)(Product::getQuantity((int)($product['id_product']), ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL)));

$quantityInStock = ($productQuantity - (int)($product['cart_quantity']) < 0) ? $productQuantity : (int)($product['cart_quantity']);

if ($id_order_state != _PS_OS_CANCELED_ AND $id_order_state != _PS_OS_ERROR_)

{

if (Product::updateQuantity($product, (int)$order->id))

$product['stock_quantity'] -= $product['cart_quantity'];

if ($product['stock_quantity'] < 0 && Configuration::get('PS_STOCK_MANAGEMENT'))

$outOfStock = true;

 

Product::updateDefaultAttribute($product['id_product']);

}

$price = Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), 6, NULL, false, true, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));

$price_wt = Product::getPriceStatic((int)($product['id_product']), true, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), 2, NULL, false, true, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));

// Add some informations for virtual products

$deadline = '0000-00-00 00:00:00';

$download_hash = NULL;

if ($id_product_download = ProductDownload::getIdFromIdProduct((int)($product['id_product'])))

{

$productDownload = new ProductDownload((int)($id_product_download));

$deadline = $productDownload->getDeadLine();

$download_hash = $productDownload->getHash();

}

 

// Exclude VAT

if (Tax::excludeTaxeOption())

{

$product['tax'] = 0;

$product['rate'] = 0;

$tax_rate = 0;

}

else

$tax_rate = Tax::getProductTaxRate((int)($product['id_product']), $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});

 

$ecotaxTaxRate = 0;

if (!empty($product['ecotax']))

$ecotaxTaxRate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});

 

$quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], Shop::getCurrentShop(), (int)$cart->id_currency, (int)$vat_address->id_country, (int)$customer->id_default_group, (int)$product['cart_quantity']);

$unitPrice = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL), 2, NULL, false, true, 1, false, (int)$order->id_customer, NULL, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});

$quantityDiscountValue = $quantityDiscount ? ((Product::getTaxCalculationMethod((int)$order->id_customer) == PS_TAX_EXC ? Tools::ps_round($unitPrice, 2) : $unitPrice) - $quantityDiscount['price'] * (1 + $tax_rate / 100)) : 0.00;

$query .= '('.(int)($order->id).',

'.(int)($product['id_product']).',

'.(isset($product['id_product_attribute']) ? (int)($product['id_product_attribute']) : 'NULL').',

\''.pSQL($product['name'].((isset($product['attributes']) AND $product['attributes'] != NULL) ? ' - '.$product['attributes'] : '')).'\',

'.(int)($product['cart_quantity']).',

'.$quantityInStock.',

'.(float)(Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, FALSE)).',

'.(float)(($specificPrice AND $specificPrice['reduction_type'] == 'percentage') ? $specificPrice['reduction'] * 100 : 0.00).',

'.(float)(($specificPrice AND $specificPrice['reduction_type'] == 'amount') ? (!$specificPrice['id_currency'] ? Tools::convertPrice($specificPrice['reduction'], $order->id_currency) : $specificPrice['reduction']) : 0.00).',

'.(float)(Group::getReduction((int)($order->id_customer))).',

'.$quantityDiscountValue.',

'.(empty($product['ean13']) ? 'NULL' : '\''.pSQL($product['ean13']).'\'').',

'.(empty($product['upc']) ? 'NULL' : '\''.pSQL($product['upc']).'\'').',

'.(empty($product['reference']) ? 'NULL' : '\''.pSQL($product['reference']).'\'').',

'.(empty($product['supplier_reference']) ? 'NULL' : '\''.pSQL($product['supplier_reference']).'\'').',

'.(float)($product['id_product_attribute'] ? $product['weight_attribute'] : $product['weight']).',

\''.(empty($tax_rate) ? '' : pSQL($product['tax'])).'\',

'.(float)($tax_rate).',

'.(float)Tools::convertPrice(floatval($product['ecotax']), intval($order->id_currency)).',

'.(float)$ecotaxTaxRate.',

'.(($specificPrice AND $specificPrice['from_quantity'] > 1) ? 1 : 0).',

\''.pSQL($deadline).'\',

\''.pSQL($download_hash).'\'),';

 

$customizationQuantity = 0;

if (isset($customizedDatas[$product['id_product']][$product['id_product_attribute']]))

{

$customizationText = '';

foreach ($customizedDatas[$product['id_product']][$product['id_product_attribute']] AS $customization)

{

if (isset($customization['datas'][_CUSTOMIZE_TEXTFIELD_]))

foreach ($customization['datas'][_CUSTOMIZE_TEXTFIELD_] AS $text)

$customizationText .= $text['name'].':'.' '.$text['value'].'<br />';

 

if (isset($customization['datas'][_CUSTOMIZE_FILE_]))

$customizationText .= sizeof($customization['datas'][_CUSTOMIZE_FILE_]) .' '. Tools::displayError('image(s)').'<br />';

 

$customizationText .= '---<br />';

}

 

$customizationText = rtrim($customizationText, '---<br />');

 

$customizationQuantity = (int)($product['customizationQuantityTotal']);

$productsList .=

'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">

<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>

<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').' - '.$this->l('Customized').(!empty($customizationText) ? ' - '.$customizationText : '').'</strong></td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>

<td style="padding: 0.6em 0.4em; text-align: center;">'.$customizationQuantity.'</td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice($customizationQuantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>

</tr>';

}

 

if (!$customizationQuantity OR (int)$product['cart_quantity'] > $customizationQuantity)

$productsList .=

'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">

<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>

<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').'</strong></td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>

<td style="padding: 0.6em 0.4em; text-align: center;">'.((int)($product['cart_quantity']) - $customizationQuantity).'</td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(((int)($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>

</tr>';

} // end foreach ($products)

$query = rtrim($query, ',');

$result = $db->Execute($query);

 

// Insert discounts from cart into order_discount table

$discounts = $cart->getDiscounts();

$discountsList = '';

$total_discount_value = 0;

$shrunk = false;

foreach ($discounts AS $discount)

{

$objDiscount = new Discount((int)$discount['id_discount'], $order->id_lang);

$value = $objDiscount->getValue(sizeof($discounts), $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS), $order->total_shipping, $cart->id);

if ($objDiscount->id_discount_type == 2 AND in_array($objDiscount->behavior_not_exhausted, array(1,2)))

$shrunk = true;

 

if ($shrunk AND ($total_discount_value + $value) > ($order->total_products + $order->total_shipping + $order->total_wrapping))

{

$amount_to_add = ($order->total_products + $order->total_shipping + $order->total_wrapping) - $total_discount_value;

if ($objDiscount->id_discount_type == 2 AND $objDiscount->behavior_not_exhausted == 2)

{

$voucher = new Discount();

foreach ($objDiscount AS $key => $discountValue)

$voucher->$key = $discountValue;

$voucher->name = 'VSRK'.(int)$order->id_customer.'O'.(int)$order->id;

$voucher->value = (float)$value - $amount_to_add;

$voucher->add();

$params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);

$params['{voucher_num}'] = $voucher->name;

@Mail::Send((int)$order->id_lang, 'voucher', Mail::l('New voucher regarding your order #').$order->id, $params, $customer->email, $customer->firstname.' '.$customer->lastname);

}

}

else

$amount_to_add = $value;

$order->addDiscount($objDiscount->id, $objDiscount->name, $amount_to_add);

$total_discount_value += $amount_to_add;

if ($id_order_state != _PS_OS_ERROR_ AND $id_order_state != _PS_OS_CANCELED_)

$objDiscount->quantity = $objDiscount->quantity - 1;

$objDiscount->update();

 

$discountsList .=

'<tr style="background-color:#EBECEE;">

<td colspan="4" style="padding: 0.6em 0.4em; text-align: right;">'.$this->l('Voucher code:').' '.$objDiscount->name.'</td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.($value != 0.00 ? '-' : '').Tools::displayPrice($value, $currency, false).'</td>

</tr>';

}

 

// Specify order id for message

$oldMessage = Message::getMessageByCartId((int)($cart->id));

if ($oldMessage)

{

$message = new Message((int)$oldMessage['id_message']);

$message->id_order = (int)$order->id;

$message->update();

}

 

// Hook new order

$orderStatus = new OrderState((int)$id_order_state, (int)$order->id_lang);

if (Validate::isLoadedObject($orderStatus))

{

Hook::newOrder($cart, $order, $customer, $currency, $orderStatus);

foreach ($cart->getProducts() AS $product)

if ($orderStatus->logable)

ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);

}

 

if (isset($outOfStock) AND $outOfStock)

{

$history = new OrderHistory();

$history->id_order = (int)$order->id;

$history->changeIdOrderState(_PS_OS_OUTOFSTOCK_, (int)$order->id);

$history->addWithemail();

}

 

// Set order state in order history ONLY even if the "out of stock" status has not been yet reached

// So you migth have two order states

$new_history = new OrderHistory();

$new_history->id_order = (int)$order->id;

$new_history->changeIdOrderState((int)$id_order_state, (int)$order->id);

$new_history->addWithemail(true, $extraVars);

 

// Order is reloaded because the status just changed

$order = new Order($order->id);

 

// Send an e-mail to customer

if ($id_order_state != _PS_OS_ERROR_ AND $id_order_state != _PS_OS_CANCELED_ AND $customer->id)

{

$invoice = new Address((int)($order->id_address_invoice));

$delivery = new Address((int)($order->id_address_delivery));

$carrier = new Carrier((int)($order->id_carrier), $order->id_lang);

$delivery_state = $delivery->id_state ? new State((int)($delivery->id_state)) : false;

$invoice_state = $invoice->id_state ? new State((int)($invoice->id_state)) : false;

 

$data = array(

'{firstname}' => $customer->firstname,

'{lastname}' => $customer->lastname,

'{email}' => $customer->email,

'{delivery_block_txt}' => AddressFormat::generateAddress($delivery, array('avoid' => array()), "\n"), //, ' ', $fields_style)$this->_getFormatedAddress($delivery, "\n"),

'{invoice_block_txt}' => AddressFormat::generateAddress($invoice, array('avoid' => array()), "\n"), //$this->_getFormatedAddress($invoice, "\n"),

'{delivery_block_html}' => AddressFormat::generateAddress($delivery, array('avoid' => array()), "<br />",//$this->_getFormatedAddress($delivery, "<br />",

array(

'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',

'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),

'{invoice_block_html}' => AddressFormat::generateAddress($invoice, array('avoid' => array()), "<br />", //$this->_getFormatedAddress($invoice, "<br />",

array(

'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',

'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),

'{delivery_company}' => $delivery->company,

'{delivery_firstname}' => $delivery->firstname,

'{delivery_lastname}' => $delivery->lastname,

'{delivery_address1}' => $delivery->address1,

'{delivery_address2}' => $delivery->address2,

'{delivery_city}' => $delivery->city,

'{delivery_postal_code}' => $delivery->postcode,

'{delivery_country}' => $delivery->country,

'{delivery_state}' => $delivery->id_state ? $delivery_state->name : '',

'{delivery_phone}' => ($delivery->phone) ? $delivery->phone : $delivery->phone_mobile,

'{delivery_other}' => $delivery->other,

'{invoice_company}' => $invoice->company,

'{invoice_vat_number}' => $invoice->vat_number,

'{invoice_firstname}' => $invoice->firstname,

'{invoice_lastname}' => $invoice->lastname,

'{invoice_address2}' => $invoice->address2,

'{invoice_address1}' => $invoice->address1,

'{invoice_city}' => $invoice->city,

'{invoice_postal_code}' => $invoice->postcode,

'{invoice_country}' => $invoice->country,

'{invoice_state}' => $invoice->id_state ? $invoice_state->name : '',

'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,

'{invoice_other}' => $invoice->other,

'{order_name}' => sprintf("#%06d", (int)($order->id)),

'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int)($order->id_lang), 1),

'{carrier}' => $carrier->name,

'{payment}' => $order->payment,

'{products}' => $productsList,

'{discounts}' => $discountsList,

'{total_paid}' => Tools::displayPrice($order->total_paid, $currency, false),

'{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $currency, false),

'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency, false),

'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency, false),

'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency, false));

 

if (is_array($extraVars))

$data = array_merge($data, $extraVars);

 

// Join PDF invoice

if ((int)(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)

{

$fileAttachment['content'] = PDF::invoice($order, 'S');

$fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf';

$fileAttachment['mime'] = 'application/pdf';

}

else

$fileAttachment = NULL;

 

if (Validate::isEmail($customer->email))

Mail::Send((int)($order->id_lang), 'order_conf', Mail::l('Order confirmation'), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment);

}

$this->currentOrder = (int)($order->id);

return true;

}

else

{

$errorMessage = Tools::displayError('Order creation failed');

Logger::addLog($errorMessage, 4, '0000002', 'Cart', intval($order->id_cart));

die($errorMessage);

}

}

else

{

$errorMessage = Tools::displayError('Cart can\'t be loaded or an order has already been placed using this cart');

Logger::addLog($errorMessage, 4, '0000001', 'Cart', intval($cart->id));

die($errorMessage);

}

}

 

}

 

 

 

 

$currency = new Currency((int)(isset($_POST['currency_payement']) ? $_POST['currency_payement'] : $cookie->id_currency));

$total = (float)($cart->getOrderTotal(true, Cart::BOTH));

 

$rebaja = $cart->getOrderTotal(true, Cart::BOTH);

$rebaja -= number_format($cart->getOrderTotal(false, Cart::ONLY_PRODUCTS)*(Configuration::get('ORDER_DISCOUNT')/100),2);

 

 

$mailVars = array(

'{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'),

'{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')),

'{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS'))

);

 

$bankwire->validateOrder($cart->id, _PS_OS_BANKWIRE_, $rebaja, $bankwire->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);

$order = new Order($bankwire->currentOrder);

 

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

Link to comment
Share on other sites

help please!!

Yo cheque ese modulo pero cuenta con demasiados errores, casi es mas sencillo hacer uno desde 0 basandose en el original a que alguien mas corrija ese, no muestra el descuento en la factura que manda por email, si cambias a otra moneda que no sea la que es por defecto no hace el descuento correctamente, en el BO no muestra el descuento, practicamente solo muestra el descuento cuando vas a elegir pagar con ese modulo y siempre y cuando estes en la moneda por defecto como ya te mencione, esto es por mencionarte algo, si vas a trabajar en produccion con el eso es algo delicado y que puede darte mucho problemas.

 

Hay un modulo que es exactamente igual pero este funciona perfectamente, muestra bien los decuentos tanto en BO, FO y en facturas, ademas el precio es muy accesible, checa el enlace.

 

Para 1.3.x

http://www.prestasou...product=1662102

Para 1.4.x

http://www.prestasou...product=4418853

Link to comment
Share on other sites

donde hay guia para ver eso Nadie sos un groso por como ayudas, pero recorda 0 de programacion yo:(

 

mira amigo me dice esto el validation dle modulo

 

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

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

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

 

$bankwire = new BankWire_plus();

 

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

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

 

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

 

if (!Validate::isLoadedObject($customer))

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

 

 

 

y el

 

php de bankwire es este

 

if (!defined('_CAN_LOAD_FILES_'))

exit;

 

class BankWire_plus extends PaymentModule

{

private $_html = '';

private $_postErrors = array();

 

public $details;

public $owner;

public $address;

public $dto;

 

public function __construct()

{

$this->name = 'bankwire_plus';

$this->tab = 'payments_gateways';

$this->version = '0.5';

$this->author = 'PrestaShop';

 

$this->currencies = true;

$this->currencies_mode = 'checkbox';

 

$config = Configuration::getMultiple(array('BANK_WIRE_DETAILS', 'BANK_WIRE_OWNER', 'BANK_WIRE_ADDRESS', 'ORDER_DISCOUNT'));

if (isset($config['BANK_WIRE_OWNER']))

$this->owner = $config['BANK_WIRE_OWNER'];

if (isset($config['BANK_WIRE_DETAILS']))

$this->details = $config['BANK_WIRE_DETAILS'];

if (isset($config['BANK_WIRE_ADDRESS']))

$this->address = $config['BANK_WIRE_ADDRESS'];

if (isset($config['ORDER_DISCOUNT']))

$this->dto = $config['ORDER_DISCOUNT'];

 

parent::__construct();

 

$this->displayName = $this->l('Bankwire with discount');

$this->description = $this->l('Accepts bankwire payments and applies a discount');

$this->confirmUninstall = $this->l('Are you sure you want to delete your details?');

if (!isset($this->owner) OR !isset($this->details) OR !isset($this->address))

$this->warning = $this->l('Account owner and details must be configured in order to use this module correctly.');

if (!sizeof(Currency::checkPaymentCurrencies($this->id)))

$this->warning = $this->l('No currency set for this module');

}

 

public function install()

{

if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn'))

return false;

return true;

}

 

public function uninstall()

{

if (!Configuration::deleteByName('BANK_WIRE_DETAILS')

OR !Configuration::deleteByName('BANK_WIRE_OWNER')

OR !Configuration::deleteByName('BANK_WIRE_ADDRESS')

OR !Configuration::deleteByName('ORDER_DISCOUNT')

OR !parent::uninstall())

return false;

return true;

}

 

private function _postValidation()

{

if (isset($_POST['btnSubmit']))

{

if (empty($_POST['details']))

$this->_postErrors[] = $this->l('Account details are required.');

elseif (empty($_POST['owner']))

$this->_postErrors[] = $this->l('Account owner is required.');

}

}

 

private function _postProcess()

{

if (isset($_POST['btnSubmit']))

{

Configuration::updateValue('BANK_WIRE_DETAILS', $_POST['details']);

Configuration::updateValue('BANK_WIRE_OWNER', $_POST['owner']);

Configuration::updateValue('BANK_WIRE_ADDRESS', $_POST['address']);

Configuration::updateValue('ORDER_DISCOUNT', $_POST['dto']);

}

$this->_html .= '<div class="conf confirm"><img src="../img/admin/ok.gif" alt="'.$this->l('ok').'" /> '.$this->l('Settings updated').'</div>';

}

 

private function _displayBankWire()

{

$this->_html .= '<img src="../modules/bankwire_plus/bankwire.jpg" style="float:left; margin-right:15px;"><b>'.$this->l('This module allows you to accept payments by bank wire and applies a discount.').'</b><br /><br />

'.$this->l('If the client chooses this payment mode, the order will change its status into a \'Waiting for payment\' status.').'<br />

'.$this->l('Therefore, you must manually confirm the order as soon as you receive the wire.').'<br /><br /><br />';

}

 

private function _displayForm()

{

$this->_html .=

'<form action="'.$_SERVER['REQUEST_URI'].'" method="post">

<fieldset>

<legend><img src="../img/admin/contact.gif" />'.$this->l('Contact details').'</legend>

<table border="0" width="500" cellpadding="0" cellspacing="0" id="form">

<tr><td colspan="2">'.$this->l('Please specify the bank wire account details for customers').'.<br /><br /></td></tr>

<tr><td width="130" style="height: 35px;">'.$this->l('Account owner').'</td><td><input type="text" name="owner" value="'.htmlentities(Tools::getValue('owner', $this->owner), ENT_COMPAT, 'UTF-8').'" style="width: 300px;" /></td></tr>

<tr>

<td width="130" style="vertical-align: top;">'.$this->l('Details').'</td>

<td style="padding-bottom:15px;">

<textarea name="details" rows="4" cols="53">'.htmlentities(Tools::getValue('details', $this->details), ENT_COMPAT, 'UTF-8').'</textarea>

<p>'.$this->l('Such as bank branch, IBAN number, BIC, etc.').'</p>

</td>

</tr>

<tr>

<td width="130" style="vertical-align: top;">'.$this->l('Bank address').'</td>

<td style="padding-bottom:15px;">

<textarea name="address" rows="4" cols="53">'.htmlentities(Tools::getValue('address', $this->address), ENT_COMPAT, 'UTF-8').'</textarea>

</td>

</tr>

<tr>

<td width="130" style="vertical-align: top;">'.$this->l('Discount (in %)').'</td>

<td style="padding-bottom:15px;">

<input type="text" name="dto" size="4" value="'.Tools::getValue('dto', $this->dto).'">

</td>

</tr>

<tr><td colspan="2" align="center"><input class="button" name="btnSubmit" value="'.$this->l('Update settings').'" type="submit" /></td></tr>

</table>

</fieldset>

</form>

<table>

<tr>

<td align="center">

<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">

<input type="hidden" name="cmd" value="_s-xclick">

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0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTExMDYwODIwMDM1NlowIwYJKoZIhvcNAQkEMRYEFMvvJazimhULFhegcLRj6ZF84F7tMA0GCSqGSIb3DQEBAQUABIGADxPdN75t1OIAdgNUuLn1K9awzbjfeAfhTcjUe1BsvLLLXgMLnmNzu96jjeOXKx/ilnQupP+BSvXqSpymafQ0BT8Ke/DpQlmfqqVdrj08FSRNqfur+ldSRhK1IglDYslQI2vMgdgtwleo2e9mCxbACkmTLDE06+5I73w0FRIa8Dk=-----END PKCS7-----">

<br>Módulo Bankwire_plus - Desarrollado por Ricardo Collazo ([email protected])<br><br>

<input type="image" src="https://www.paypalobjects.com/es_ES/ES/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal. La forma rápida y segura de pagar en Internet.">

<img alt="" border="0" src="https://www.paypalobjects.com/es_ES/i/scr/pixel.gif" width="1" height="1"><br> 

</form>

</td>

</tr>

</table>';

}

 

public function getContent()

{

$this->_html = '<h2>'.$this->displayName.'</h2>';

 

if (!empty($_POST))

{

$this->_postValidation();

if (!sizeof($this->_postErrors))

$this->_postProcess();

else

foreach ($this->_postErrors AS $err)

$this->_html .= '<div class="alert error">'. $err .'</div>';

}

else

$this->_html .= '<br />';

 

$this->_displayBankWire();

$this->_displayForm();

 

return $this->_html;

}

 

public function execPayment($cart)

{

if (!$this->active)

return ;

if (!$this->_checkCurrency($cart))

Tools::redirectLink(__PS_BASE_URI__.'order.php');

 

global $cookie, $smarty;

 

$rebaja = $cart->getOrderTotal(true, Cart::BOTH);

$rebaja -= number_format($cart->getOrderTotal(false, Cart::ONLY_PRODUCTS)*($this->dto/100),2);

 

$smarty->assign(array(

'nbProducts' => $cart->nbProducts(),

'cust_currency' => $cart->id_currency,

'currencies' => $this->getCurrency((int)$cart->id_currency),

'total' => $rebaja,

'this_path' => $this->_path,

'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'

));

 

return $this->display(__FILE__, 'payment_execution.tpl');

}

 

public function hookPayment($params)

{

if (!$this->active)

return ;

if (!$this->_checkCurrency($params['cart']))

return ;

 

global $smarty;

 

$smarty->assign(array(

'this_path' => $this->_path,

'rebaja' => number_format($params['cart']->getOrderTotal(false, Cart::ONLY_PRODUCTS)*($this->dto/100),2),

'dto' => $this->dto,

'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/'

));

return $this->display(__FILE__, 'payment.tpl');

}

 

public function hookPaymentReturn($params)

{

if (!$this->active)

return ;

 

global $smarty;

$state = $params['objOrder']->getCurrentState();

if ($state == _PS_OS_BANKWIRE_ OR $state == _PS_OS_OUTOFSTOCK_)

$smarty->assign(array(

'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false),

'bankwireDetails' => nl2br2($this->details),

'bankwireAddress' => nl2br2($this->address),

'bankwireOwner' => $this->owner,

'status' => 'ok',

'id_order' => $params['objOrder']->id

));

else

$smarty->assign('status', 'failed');

return $this->display(__FILE__, 'payment_return.tpl');

}

 

private function _checkCurrency($cart)

{

$currency_order = new Currency((int)($cart->id_currency));

$currencies_module = $this->getCurrency((int)$cart->id_currency);

$currency_default = Configuration::get('PS_CURRENCY_DEFAULT');

 

if (is_array($currencies_module))

foreach ($currencies_module AS $currency_module)

if ($currency_order->id == $currency_module['id_currency'])

return true;

}

 

/**

* Validate an order in database

* Function called from a payment module

*

* @param integer $id_cart Value

* @param integer $id_order_state Value

* @param float $amountPaid Amount really paid by customer (in the default currency)

* @param string $paymentMethod Payment method (eg. 'Credit card')

* @param string $message Message to attach to order

*/

public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)

{

global $cart;

 

$cart = new Cart((int)($id_cart));

// Does order already exists ?

if (Validate::isLoadedObject($cart) AND $cart->OrderExists() == false)

{

if ($secure_key !== false AND $secure_key != $cart->secure_key)

die(Tools::displayError());

 

// 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->id_address_delivery));

$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;

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

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

$amountPaid = !$dont_touch_amount ? Tools::ps_round((float)($amountPaid), 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());

$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)));

 

// esto es lo que cambio

$order->total_paid = $amountPaid; // not from cart, but from params

 

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

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

 

// Creating order

if ($cart->OrderExists() == false)

$result = $order->add();

else

{

$errorMessage = Tools::displayError('An order has already been placed using this cart.');

Logger::addLog($errorMessage, 4, '0000001', 'Cart', intval($order->id_cart));

die($errorMessage);

}

 

// Next !

if ($result AND isset($order->id))

{

if (!$secure_key)

$message .= $this->l('Warning : the secure key is empty, check your payment account before validation');

// Optional message to attach to this order

if (isset($message) AND !empty($message))

{

$msg = new Message();

$message = strip_tags($message, '<br>');

if (Validate::isCleanHtml($message))

{

$msg->message = $message;

$msg->id_order = intval($order->id);

$msg->private = 1;

$msg->add();

}

}

 

// Insert products from cart into order_detail table

$products = $cart->getProducts();

$productsList = '';

$db = Db::getInstance();

$query = 'INSERT INTO `'._DB_PREFIX_.'order_detail`

(`id_order`, `product_id`, `product_attribute_id`, `product_name`, `product_quantity`, `product_quantity_in_stock`, `product_price`, `reduction_percent`, `reduction_amount`, `group_reduction`, `product_quantity_discount`, `product_ean13`, `product_upc`, `product_reference`, `product_supplier_reference`, `product_weight`, `tax_name`, `tax_rate`, `ecotax`, `ecotax_tax_rate`, `discount_quantity_applied`, `download_deadline`, `download_hash`)

VALUES ';

 

$customizedDatas = Product::getAllCustomizedDatas((int)($order->id_cart));

Product::addCustomizationPrice($products, $customizedDatas);

$outOfStock = false;

foreach ($products AS $key => $product)

{

$productQuantity = (int)(Product::getQuantity((int)($product['id_product']), ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL)));

$quantityInStock = ($productQuantity - (int)($product['cart_quantity']) < 0) ? $productQuantity : (int)($product['cart_quantity']);

if ($id_order_state != _PS_OS_CANCELED_ AND $id_order_state != _PS_OS_ERROR_)

{

if (Product::updateQuantity($product, (int)$order->id))

$product['stock_quantity'] -= $product['cart_quantity'];

if ($product['stock_quantity'] < 0 && Configuration::get('PS_STOCK_MANAGEMENT'))

$outOfStock = true;

 

Product::updateDefaultAttribute($product['id_product']);

}

$price = Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), 6, NULL, false, true, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));

$price_wt = Product::getPriceStatic((int)($product['id_product']), true, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), 2, NULL, false, true, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}));

// Add some informations for virtual products

$deadline = '0000-00-00 00:00:00';

$download_hash = NULL;

if ($id_product_download = ProductDownload::getIdFromIdProduct((int)($product['id_product'])))

{

$productDownload = new ProductDownload((int)($id_product_download));

$deadline = $productDownload->getDeadLine();

$download_hash = $productDownload->getHash();

}

 

// Exclude VAT

if (Tax::excludeTaxeOption())

{

$product['tax'] = 0;

$product['rate'] = 0;

$tax_rate = 0;

}

else

$tax_rate = Tax::getProductTaxRate((int)($product['id_product']), $cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')});

 

$ecotaxTaxRate = 0;

if (!empty($product['ecotax']))

$ecotaxTaxRate = Tax::getProductEcotaxRate($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});

 

$quantityDiscount = SpecificPrice::getQuantityDiscount((int)$product['id_product'], Shop::getCurrentShop(), (int)$cart->id_currency, (int)$vat_address->id_country, (int)$customer->id_default_group, (int)$product['cart_quantity']);

$unitPrice = Product::getPriceStatic((int)$product['id_product'], true, ($product['id_product_attribute'] ? intval($product['id_product_attribute']) : NULL), 2, NULL, false, true, 1, false, (int)$order->id_customer, NULL, (int)$order->{Configuration::get('PS_TAX_ADDRESS_TYPE')});

$quantityDiscountValue = $quantityDiscount ? ((Product::getTaxCalculationMethod((int)$order->id_customer) == PS_TAX_EXC ? Tools::ps_round($unitPrice, 2) : $unitPrice) - $quantityDiscount['price'] * (1 + $tax_rate / 100)) : 0.00;

$query .= '('.(int)($order->id).',

'.(int)($product['id_product']).',

'.(isset($product['id_product_attribute']) ? (int)($product['id_product_attribute']) : 'NULL').',

\''.pSQL($product['name'].((isset($product['attributes']) AND $product['attributes'] != NULL) ? ' - '.$product['attributes'] : '')).'\',

'.(int)($product['cart_quantity']).',

'.$quantityInStock.',

'.(float)(Product::getPriceStatic((int)($product['id_product']), false, ($product['id_product_attribute'] ? (int)($product['id_product_attribute']) : NULL), (Product::getTaxCalculationMethod((int)($order->id_customer)) == PS_TAX_EXC ? 2 : 6), NULL, false, false, $product['cart_quantity'], false, (int)($order->id_customer), (int)($order->id_cart), (int)($order->{Configuration::get('PS_TAX_ADDRESS_TYPE')}), $specificPrice, FALSE)).',

'.(float)(($specificPrice AND $specificPrice['reduction_type'] == 'percentage') ? $specificPrice['reduction'] * 100 : 0.00).',

'.(float)(($specificPrice AND $specificPrice['reduction_type'] == 'amount') ? (!$specificPrice['id_currency'] ? Tools::convertPrice($specificPrice['reduction'], $order->id_currency) : $specificPrice['reduction']) : 0.00).',

'.(float)(Group::getReduction((int)($order->id_customer))).',

'.$quantityDiscountValue.',

'.(empty($product['ean13']) ? 'NULL' : '\''.pSQL($product['ean13']).'\'').',

'.(empty($product['upc']) ? 'NULL' : '\''.pSQL($product['upc']).'\'').',

'.(empty($product['reference']) ? 'NULL' : '\''.pSQL($product['reference']).'\'').',

'.(empty($product['supplier_reference']) ? 'NULL' : '\''.pSQL($product['supplier_reference']).'\'').',

'.(float)($product['id_product_attribute'] ? $product['weight_attribute'] : $product['weight']).',

\''.(empty($tax_rate) ? '' : pSQL($product['tax'])).'\',

'.(float)($tax_rate).',

'.(float)Tools::convertPrice(floatval($product['ecotax']), intval($order->id_currency)).',

'.(float)$ecotaxTaxRate.',

'.(($specificPrice AND $specificPrice['from_quantity'] > 1) ? 1 : 0).',

\''.pSQL($deadline).'\',

\''.pSQL($download_hash).'\'),';

 

$customizationQuantity = 0;

if (isset($customizedDatas[$product['id_product']][$product['id_product_attribute']]))

{

$customizationText = '';

foreach ($customizedDatas[$product['id_product']][$product['id_product_attribute']] AS $customization)

{

if (isset($customization['datas'][_CUSTOMIZE_TEXTFIELD_]))

foreach ($customization['datas'][_CUSTOMIZE_TEXTFIELD_] AS $text)

$customizationText .= $text['name'].':'.' '.$text['value'].'<br />';

 

if (isset($customization['datas'][_CUSTOMIZE_FILE_]))

$customizationText .= sizeof($customization['datas'][_CUSTOMIZE_FILE_]) .' '. Tools::displayError('image(s)').'<br />';

 

$customizationText .= '---<br />';

}

 

$customizationText = rtrim($customizationText, '---<br />');

 

$customizationQuantity = (int)($product['customizationQuantityTotal']);

$productsList .=

'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">

<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>

<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').' - '.$this->l('Customized').(!empty($customizationText) ? ' - '.$customizationText : '').'</strong></td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>

<td style="padding: 0.6em 0.4em; text-align: center;">'.$customizationQuantity.'</td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice($customizationQuantity * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>

</tr>';

}

 

if (!$customizationQuantity OR (int)$product['cart_quantity'] > $customizationQuantity)

$productsList .=

'<tr style="background-color: '.($key % 2 ? '#DDE2E6' : '#EBECEE').';">

<td style="padding: 0.6em 0.4em;">'.$product['reference'].'</td>

<td style="padding: 0.6em 0.4em;"><strong>'.$product['name'].(isset($product['attributes_small']) ? ' '.$product['attributes_small'] : '').'</strong></td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt, $currency, false).'</td>

<td style="padding: 0.6em 0.4em; text-align: center;">'.((int)($product['cart_quantity']) - $customizationQuantity).'</td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.Tools::displayPrice(((int)($product['cart_quantity']) - $customizationQuantity) * (Product::getTaxCalculationMethod() == PS_TAX_EXC ? $price : $price_wt), $currency, false).'</td>

</tr>';

} // end foreach ($products)

$query = rtrim($query, ',');

$result = $db->Execute($query);

 

// Insert discounts from cart into order_discount table

$discounts = $cart->getDiscounts();

$discountsList = '';

$total_discount_value = 0;

$shrunk = false;

foreach ($discounts AS $discount)

{

$objDiscount = new Discount((int)$discount['id_discount'], $order->id_lang);

$value = $objDiscount->getValue(sizeof($discounts), $cart->getOrderTotal(true, Cart::ONLY_PRODUCTS), $order->total_shipping, $cart->id);

if ($objDiscount->id_discount_type == 2 AND in_array($objDiscount->behavior_not_exhausted, array(1,2)))

$shrunk = true;

 

if ($shrunk AND ($total_discount_value + $value) > ($order->total_products + $order->total_shipping + $order->total_wrapping))

{

$amount_to_add = ($order->total_products + $order->total_shipping + $order->total_wrapping) - $total_discount_value;

if ($objDiscount->id_discount_type == 2 AND $objDiscount->behavior_not_exhausted == 2)

{

$voucher = new Discount();

foreach ($objDiscount AS $key => $discountValue)

$voucher->$key = $discountValue;

$voucher->name = 'VSRK'.(int)$order->id_customer.'O'.(int)$order->id;

$voucher->value = (float)$value - $amount_to_add;

$voucher->add();

$params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false);

$params['{voucher_num}'] = $voucher->name;

@Mail::Send((int)$order->id_lang, 'voucher', Mail::l('New voucher regarding your order #').$order->id, $params, $customer->email, $customer->firstname.' '.$customer->lastname);

}

}

else

$amount_to_add = $value;

$order->addDiscount($objDiscount->id, $objDiscount->name, $amount_to_add);

$total_discount_value += $amount_to_add;

if ($id_order_state != _PS_OS_ERROR_ AND $id_order_state != _PS_OS_CANCELED_)

$objDiscount->quantity = $objDiscount->quantity - 1;

$objDiscount->update();

 

$discountsList .=

'<tr style="background-color:#EBECEE;">

<td colspan="4" style="padding: 0.6em 0.4em; text-align: right;">'.$this->l('Voucher code:').' '.$objDiscount->name.'</td>

<td style="padding: 0.6em 0.4em; text-align: right;">'.($value != 0.00 ? '-' : '').Tools::displayPrice($value, $currency, false).'</td>

</tr>';

}

 

// Specify order id for message

$oldMessage = Message::getMessageByCartId((int)($cart->id));

if ($oldMessage)

{

$message = new Message((int)$oldMessage['id_message']);

$message->id_order = (int)$order->id;

$message->update();

}

 

// Hook new order

$orderStatus = new OrderState((int)$id_order_state, (int)$order->id_lang);

if (Validate::isLoadedObject($orderStatus))

{

Hook::newOrder($cart, $order, $customer, $currency, $orderStatus);

foreach ($cart->getProducts() AS $product)

if ($orderStatus->logable)

ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']);

}

 

if (isset($outOfStock) AND $outOfStock)

{

$history = new OrderHistory();

$history->id_order = (int)$order->id;

$history->changeIdOrderState(_PS_OS_OUTOFSTOCK_, (int)$order->id);

$history->addWithemail();

}

 

// Set order state in order history ONLY even if the "out of stock" status has not been yet reached

// So you migth have two order states

$new_history = new OrderHistory();

$new_history->id_order = (int)$order->id;

$new_history->changeIdOrderState((int)$id_order_state, (int)$order->id);

$new_history->addWithemail(true, $extraVars);

 

// Order is reloaded because the status just changed

$order = new Order($order->id);

 

// Send an e-mail to customer

if ($id_order_state != _PS_OS_ERROR_ AND $id_order_state != _PS_OS_CANCELED_ AND $customer->id)

{

$invoice = new Address((int)($order->id_address_invoice));

$delivery = new Address((int)($order->id_address_delivery));

$carrier = new Carrier((int)($order->id_carrier), $order->id_lang);

$delivery_state = $delivery->id_state ? new State((int)($delivery->id_state)) : false;

$invoice_state = $invoice->id_state ? new State((int)($invoice->id_state)) : false;

 

$data = array(

'{firstname}' => $customer->firstname,

'{lastname}' => $customer->lastname,

'{email}' => $customer->email,

'{delivery_block_txt}' => AddressFormat::generateAddress($delivery, array('avoid' => array()), "\n"), //, ' ', $fields_style)$this->_getFormatedAddress($delivery, "\n"),

'{invoice_block_txt}' => AddressFormat::generateAddress($invoice, array('avoid' => array()), "\n"), //$this->_getFormatedAddress($invoice, "\n"),

'{delivery_block_html}' => AddressFormat::generateAddress($delivery, array('avoid' => array()), "<br />",//$this->_getFormatedAddress($delivery, "<br />",

array(

'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',

'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),

'{invoice_block_html}' => AddressFormat::generateAddress($invoice, array('avoid' => array()), "<br />", //$this->_getFormatedAddress($invoice, "<br />",

array(

'firstname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>',

'lastname' => '<span style="color:#DB3484; font-weight:bold;">%s</span>')),

'{delivery_company}' => $delivery->company,

'{delivery_firstname}' => $delivery->firstname,

'{delivery_lastname}' => $delivery->lastname,

'{delivery_address1}' => $delivery->address1,

'{delivery_address2}' => $delivery->address2,

'{delivery_city}' => $delivery->city,

'{delivery_postal_code}' => $delivery->postcode,

'{delivery_country}' => $delivery->country,

'{delivery_state}' => $delivery->id_state ? $delivery_state->name : '',

'{delivery_phone}' => ($delivery->phone) ? $delivery->phone : $delivery->phone_mobile,

'{delivery_other}' => $delivery->other,

'{invoice_company}' => $invoice->company,

'{invoice_vat_number}' => $invoice->vat_number,

'{invoice_firstname}' => $invoice->firstname,

'{invoice_lastname}' => $invoice->lastname,

'{invoice_address2}' => $invoice->address2,

'{invoice_address1}' => $invoice->address1,

'{invoice_city}' => $invoice->city,

'{invoice_postal_code}' => $invoice->postcode,

'{invoice_country}' => $invoice->country,

'{invoice_state}' => $invoice->id_state ? $invoice_state->name : '',

'{invoice_phone}' => ($invoice->phone) ? $invoice->phone : $invoice->phone_mobile,

'{invoice_other}' => $invoice->other,

'{order_name}' => sprintf("#%06d", (int)($order->id)),

'{date}' => Tools::displayDate(date('Y-m-d H:i:s'), (int)($order->id_lang), 1),

'{carrier}' => $carrier->name,

'{payment}' => $order->payment,

'{products}' => $productsList,

'{discounts}' => $discountsList,

'{total_paid}' => Tools::displayPrice($order->total_paid, $currency, false),

'{total_products}' => Tools::displayPrice($order->total_paid - $order->total_shipping - $order->total_wrapping + $order->total_discounts, $currency, false),

'{total_discounts}' => Tools::displayPrice($order->total_discounts, $currency, false),

'{total_shipping}' => Tools::displayPrice($order->total_shipping, $currency, false),

'{total_wrapping}' => Tools::displayPrice($order->total_wrapping, $currency, false));

 

if (is_array($extraVars))

$data = array_merge($data, $extraVars);

 

// Join PDF invoice

if ((int)(Configuration::get('PS_INVOICE')) AND Validate::isLoadedObject($orderStatus) AND $orderStatus->invoice AND $order->invoice_number)

{

$fileAttachment['content'] = PDF::invoice($order, 'S');

$fileAttachment['name'] = Configuration::get('PS_INVOICE_PREFIX', (int)($order->id_lang)).sprintf('%06d', $order->invoice_number).'.pdf';

$fileAttachment['mime'] = 'application/pdf';

}

else

$fileAttachment = NULL;

 

if (Validate::isEmail($customer->email))

Mail::Send((int)($order->id_lang), 'order_conf', Mail::l('Order confirmation'), $data, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, $fileAttachment);

}

$this->currentOrder = (int)($order->id);

return true;

}

else

{

$errorMessage = Tools::displayError('Order creation failed');

Logger::addLog($errorMessage, 4, '0000002', 'Cart', intval($order->id_cart));

die($errorMessage);

}

}

else

{

$errorMessage = Tools::displayError('Cart can\'t be loaded or an order has already been placed using this cart');

Logger::addLog($errorMessage, 4, '0000001', 'Cart', intval($cart->id));

die($errorMessage);

}

}

 

}

 

 

 

 

$currency = new Currency((int)(isset($_POST['currency_payement']) ? $_POST['currency_payement'] : $cookie->id_currency));

$total = (float)($cart->getOrderTotal(true, Cart::BOTH));

 

$rebaja = $cart->getOrderTotal(true, Cart::BOTH);

$rebaja -= number_format($cart->getOrderTotal(false, Cart::ONLY_PRODUCTS)*(Configuration::get('ORDER_DISCOUNT')/100),2);

 

 

$mailVars = array(

'{bankwire_owner}' => Configuration::get('BANK_WIRE_OWNER'),

'{bankwire_details}' => nl2br(Configuration::get('BANK_WIRE_DETAILS')),

'{bankwire_address}' => nl2br(Configuration::get('BANK_WIRE_ADDRESS'))

);

 

$bankwire->validateOrder($cart->id, _PS_OS_BANKWIRE_, $rebaja, $bankwire->displayName, NULL, $mailVars, (int)$currency->id, false, $customer->secure_key);

$order = new Order($bankwire->currentOrder);

 

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

 

Respecto a ese problema, sustituye el fichero que adjunto, por el que esta entro de dicho modulo.

bankwire_plus.php

  • Like 1
Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...