Author Topic: price zero issue  (Read 251 times)

Offline shahiran12395

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +3/-0
    • View Profile
price zero issue
« on: August 28, 2019, 10:59:39 PM »
i have issue on when item is put to 0.00 the button redirect me to payment gateway before this it just go to success checkout. it happen for logged in user checkout only. guest checkout work correctly. which part that i need to double check is it payment or confirm controller?

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 4408
  • Karma: +205/-0
    • View Profile
Re: price zero issue
« Reply #1 on: August 29, 2019, 02:04:02 AM »
What is the Payment gateway? Is this AbanteCart core extension or 3rd party?
“Chuck Norris is so amazing.”
― Mother Teresa

Offline shahiran12395

  • Jr. Member
  • **
  • Posts: 50
  • Karma: +3/-0
    • View Profile
Re: price zero issue
« Reply #2 on: August 29, 2019, 03:19:25 AM »
What is the Payment gateway? Is this AbanteCart core extension or 3rd party?

3rd extension..before this it work just fine..for guest and login checkout..but right now only login user cannot checkout item if it is 0.00

Code: [Select]
public function main(){

//init controller data
$this->extensions->hk_InitData($this, __FUNCTION__);

$cart_rt = 'checkout/cart';
$checkout_rt = 'checkout/shipping';
$payment_rt = 'checkout/payment';
$login_rt = 'account/login';
$pmt_address_rt = 'checkout/address/payment';
$shp_address_rt = 'checkout/address/shipping';
$confirm_rt = 'checkout/confirm';
$success_rt = 'checkout/success';
$product_rt = 'product/product';
if ($this->config->get('embed_mode') == true){
$cart_rt = 'r/checkout/cart/embed';
}

if (!$this->cart->hasProducts() || (!$this->cart->hasStock() && !$this->config->get('config_stock_checkout'))){
redirect($this->html->getSecureURL($cart_rt));
}

//validate if order min/max are met
if (!$this->cart->hasMinRequirement() || !$this->cart->hasMaxRequirement()){
redirect($this->html->getSecureURL($cart_rt));
}

if (!$this->customer->isLogged()){
$this->session->data['redirect'] = $this->html->getSecureURL($checkout_rt);

redirect($this->html->getSecureURL($login_rt));
}

if ($this->cart->hasShipping()){
if (!isset($this->session->data['shipping_address_id']) || !$this->session->data['shipping_address_id']){
redirect($this->html->getSecureURL($checkout_rt));
}

if (!isset($this->session->data['shipping_method'])){
redirect($this->html->getSecureURL($checkout_rt));
}
} else{
unset($this->session->data['shipping_address_id']);
unset($this->session->data['shipping_method']);
unset($this->session->data['shipping_methods']);

$this->tax->setZone($this->session->data['country_id'], $this->session->data['zone_id']);

}

if (!isset($this->session->data['payment_address_id']) || !$this->session->data['payment_address_id']){
redirect($this->html->getSecureURL($payment_rt));
}

if (!isset($this->session->data['payment_method'])){
redirect($this->html->getSecureURL($payment_rt));
}

if ($this->request->get['balance'] == 'disapply'){
unset($this->session->data['used_balance'], $this->request->get['balance'], $this->session->data['used_balance_full']);
}
$this->data = array ();

        $this->load->model('checkout/order');
        $date = date("Y-m-d");
        $check_limit = $this->checkTransactionLimit($this->customer->getId(),$date);

        if(!$check_limit['proceed']){
            return redirect($check_limit['url']);
        }

$order = new AOrder($this->registry);
$this->data = $order->buildOrderData($this->session->data);
$order_id = $order->saveOrder();
if ($order_id === false){
// preventing rebuilding order of already processed orders
//(by "back" button via browser history from external payment page(paypal, google_checkout etc))
redirect($this->html->getSecureURL($success_rt));
}
$this->session->data['order_id'] = $order_id;

        $count_card = $this->checkcardnumber($this->data['cardnumber']);

        $this->log->write("car number " .$count_card);
        $this->log->write($this->data['cardnumber']);
        $this->log->write("---------------------------------------");

        if($count_card >= 2){
            return redirect($this->html->getSecureURL('checkout/payment&cclimitusage=1&mode=edit'));
        } else {
            $this->updatecardnumber($this->session->data['order_id'],$this->data['cardnumber']);

        }
        unset($this->data['cardnumber']);

$this->document->setTitle($this->language->get('heading_title'));

$this->document->resetBreadcrumbs();

$this->document->addBreadcrumb(array (
'href'      => $this->html->getHomeURL(),
'text'      => $this->language->get('text_home'),
'separator' => false
));

$this->document->addBreadcrumb(array (
'href'      => $this->html->getSecureURL($cart_rt),
'text'      => $this->language->get('text_basket'),
'separator' => $this->language->get('text_separator')
));

if ($this->cart->hasShipping()){
$this->document->addBreadcrumb(array (
'href'      => $this->html->getSecureURL($checkout_rt),
'text'      => $this->language->get('text_shipping'),
'separator' => $this->language->get('text_separator')
));
}

$this->document->addBreadcrumb(array (
'href'      => $this->html->getSecureURL($payment_rt, '&mode=edit', true),
'text'      => $this->language->get('text_payment'),
'separator' => $this->language->get('text_separator')
));

$this->document->addBreadcrumb(array (
'href'      => $this->html->getSecureURL($confirm_rt),
'text'      => $this->language->get('text_confirm'),
'separator' => $this->language->get('text_separator')
));

$this->data['error_warning'] = $this->error['warning'];
$this->data['success'] = $this->session->data['success'];
if (isset($this->session->data['success'])){
unset($this->session->data['success']);
}

//balance
$balance_def_currency = $this->customer->getBalance();
$balance = $this->currency->convert($balance_def_currency, $this->config->get('config_currency'), $this->session->data['currency']);

if ($balance != 0 || ($balance == 0 && $this->config->get('config_zero_customer_balance')) && (float)$this->session->data['used_balance'] != 0){
$this->data['balance'] = $this->language->get('text_balance_checkout') . ' ' . $this->currency->format($balance, $this->session->data['currency'], 1);
if ((float)$this->session->data['used_balance'] > 0){
$this->data['disapply_balance'] = array ('href' => $this->html->getSecureURL($payment_rt, '&mode=edit&balance=disapply', true),
                                         'text' => $this->language->get('button_disapply_balance'));
$this->data['balance'] .= ' (' . $this->currency->format($balance_def_currency - (float)$this->session->data['used_balance']) . ')';
$this->data['balance'] .= '      ' . $this->currency->format((float)$this->session->data['used_balance']) . ' ' . $this->language->get('text_applied_balance');
} elseif ((float)$this->session->data['used_balance'] == 0 && $balance > 0){
$this->data['disapply_balance'] = array ('href' => $this->html->getSecureURL($payment_rt, '&mode=edit&balance=apply', true),
                                         'text' => $this->language->get('button_apply_balance'));
}
}

$this->loadModel('account/address');
$shipping_address = $this->model_account_address->getAddress($this->session->data['shipping_address_id']);
if ($this->cart->hasShipping()){
$this->data['shipping_address'] = $this->customer->getFormattedAddress($shipping_address, $shipping_address['address_format']);
} else{
$this->data['shipping_address'] = '';
}

$this->data['shipping_method'] = $this->session->data['shipping_method']['title'];
$this->data['shipping_method_price'] = $this->session->data['shipping_method']['title'];
$this->data['checkout_shipping_edit'] = $this->html->getSecureURL($checkout_rt, '&mode=edit', true);
$this->data['checkout_shipping_address'] = $this->html->getSecureURL($shp_address_rt);

$payment_address = $this->model_account_address->getAddress($this->session->data['payment_address_id']);
if ($payment_address){
$this->data['payment_address'] = $this->customer->getFormattedAddress($payment_address, $payment_address['address_format']);
} else{
$this->data['payment_address'] = '';
}
if ($this->session->data['payment_method']['id'] != 'no_payment_required'){
$this->data['payment_method'] = $this->session->data['payment_method']['title'];
} else{
$this->data['payment_method'] = '';
}

$this->data['checkout_payment_edit'] = $this->html->getSecureURL($payment_rt, '&mode=edit', true);
$this->data['checkout_payment_address'] = $this->html->getSecureURL($pmt_address_rt);

$this->loadModel('tool/seo_url');
$this->loadModel('tool/image');

$product_ids = array ();
foreach ($this->data['products'] as $result){
$product_ids[] = (int)$result['product_id'];
}

//get customer product permission
$this->loadModel('catalog/product');
        $this->loadModel('account/customer');
        $cust_info = $this->model_account_customer->getCustomer($this->session->data['customer_id']);

        if ($this->customer->isLogged()){
            $this->checkMemberRank($this->customer->getLoginName(),$product_ids);
            $this->checkWalletBallance($this->customer->getLoginName(),$order_id);

            /*
             * check product restriction for every item added to cart
             * before proceed payment
             */
            $check_products = $this->model_catalog_product->check_purchase_product($product_ids,$cust_info['active_member'],$cust_info['first_buyer']);

            if (!$check_products['proceed']){
                return redirect($this->html->getSecureURL('checkout/cart&new='.$check_products['new'].'&active='.$cust_info['active_member']));
            }
        }



$resource = new AResource('image');
$thumbnails = $resource->getMainThumbList(
'products',
$product_ids,
$this->config->get('config_image_cart_width'),
$this->config->get('config_image_cart_height')
);

        $calculate_st_value_per_day = '';

//Format product data specific for confirmation page
for ($i = 0; $i < sizeof($this->data['products']); $i++){
$product_id = $this->data['products'][$i]['product_id'];
$opts = $this->data['products'][$i]['option'];
$options = array ();
foreach ($opts as $option){
//hide hidden options
if ($option['element_type'] == 'H'){
continue;
}
$title = '';
$value = $option['value'];
// hide binary value for checkbox
if ($option['element_type'] == 'C' && in_array($value, array (0, 1))){
$value = '';
}
// strip long textarea value
if ($option['element_type'] == 'T'){
$title = strip_tags($value);
$title = str_replace('\r\n', "\n", $title);
$value = str_replace('\r\n', "\n", $value);
if (mb_strlen($value) > 64){
$value = mb_substr($value, 0, 64) . '...';
}
}
$options[] = array (
'name'  => $option['name'],
'value' => $value,
'title' => $title
);
}

$this->data['products'][$i]['option'] = $options;

            //get total st ordered
            $total_st_value = $this->model_catalog_product->get_total_st($this->data['products'][$i]['product_id'],$this->data['products'][$i]['quantity']);
            $calculate_st_value_per_day = $this->calculate_st_value($this->session->data['order_id'],$this->session->data['customer_id']);

$thumbnail = $thumbnails[$product_id];
$tax = $this->tax->calcTotalTaxAmount($this->data['products'][$i]['total'], $this->data['products'][$i]['tax_class_id']);
$price = $this->data['products'][$i]['price'];
$qty = $this->data['products'][$i]['quantity'];
$this->data['products'][$i] = array_merge(
$this->data['products'][$i],
array (
'thumb' => $thumbnail,
'tax'   => $this->currency->format($tax),
'price' => $this->currency->format($price),
'total' => $this->currency->format_total($price, $qty),
                            'st_value'   => $total_st_value,
'href'  => $this->html->getSEOURL($product_rt, '&product_id=' . $product_id, true)
));
}

        $this->data['total_order_st_value'] = $calculate_st_value_per_day;
        $this->data['title_st_value'] = 'Total Point:';

$display_totals = $this->cart->buildTotalDisplay();
$this->data['totals'] = $display_totals['total_data'];

$this->data['cart'] = $this->html->getSecureURL($cart_rt);

if ($this->config->get('config_checkout_id')){
$this->loadModel('catalog/content');
$content_info = $this->model_catalog_content->getContent($this->config->get('config_checkout_id'));
if ($content_info){
$this->data['text_accept_agree'] = $this->language->get('text_accept_agree');
$this->data['text_accept_agree_href'] = $this->html->getURL('r/content/content/loadInfo', '&content_id=' . $this->config->get('config_checkout_id'), true);
$this->data['text_accept_agree_href_link'] = $content_info['title'];
} else{
$this->data['text_accept_agree'] = '';
}
} else{
$this->data['text_accept_agree'] = '';
}

if ($this->config->get('coupon_status')){
$this->data['coupon_status'] = $this->config->get('coupon_status');
}

if ($this->session->data['payment_method']['id'] != 'no_payment_required'){
$this->addChild('responses/extension/' . $this->session->data['payment_method']['id'], 'payment');
} else{
$this->addChild('responses/checkout/no_payment', 'payment');
}

$this->view->batchAssign($this->data);
if ($this->config->get('embed_mode') == true){
//load special headers
$this->addChild('responses/embed/head', 'head');
$this->addChild('responses/embed/footer', 'footer');
$this->processTemplate('embed/checkout/confirm.tpl');
} else{
$this->processTemplate('pages/checkout/confirm.tpl');
}

//update data before render
$this->extensions->hk_UpdateData($this, __FUNCTION__);
}

this is the confirm controller code..am i accidentally erase something

 

Powered by SMFPacks Social Login Mod