tr-opencart

     
avatar Şuanki Zaman: 04-18-2024, 10:01 PMHoşgeldin Misafir !
  Şifremi Hatırlat   kayıt ol
opencart temaları

Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql -

Konuyu görüntüleyenler: 1 Misafir
 
Değerlendir:
  • 1 Oy - 5 Yüzde
  • 1
  • 2
  • 3
  • 4
  • 5
%
Cevapla  Gönder 
v  v
Yazar  Osman Erdi - Görüntüleme - Okunma  14250 - Yorum  18

Osman Erdiv
Banned
user avatar
Çevrimdışı

Mesajlar: 15
Konular: 2
Katılma Tarihi: Nov 2012
Teşekkürler: 1
0 Mesajına, 0 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-19-2012 06:01 PM

Selamun Aleykum ,
Opencart'ı bir haftadır inceliyorum kendi ihtiyaçlarım doğrultusunda sistemi düzenlemeye calışıyorum , php ve mysql bilgim biraz var bir çok noktada bana yeterli oldu ancak eksiğimde çok olduğundan şöyle bir problemim var ;
Opencart'ın bildiğimiz gibi Transaction(Site içi bakiye gibi birşey) eklentisi var , istediğimiz kullanıcıya admin panelden bakiye yükleyebiliyoruz.Ben e-ticaret sitemde üyelerin sadece bakiyeleri ile alışveriş yapmalarını istiyorum genelde 18- yaş ortalamasına sahip kullanıcılarım lacağından Banka Haale onayından sonra hesaplarına bakiye yukleyip onlarında kullanmasını sağlamak istiyorum ki opencart buna izin veriyor buraya kadar her şey harika ancak olay şu ki ÖRN: Bir ürün fiyatı 90 tl ise eğer kullanıcının hesabında 70 tl kalmış ise , bu ürünü alırken opencart sistemi bakiyenin hepsini kullanıyor ve 90-70 diyor 20 tl daha odemeniz gerekiyor diyor ama ürünü onay için gönderiyor bu durumda ben kişinin 20 tl daha havale etmesini beklemek zorunda kalıyorum , Bu durum ürün alışverişlerinde gereksiz yığılmalar oluşturur diye düşünüyorum cünkü bu halde bakiyesi olmayanlar bile ürünü alma isteği yollayabilecek.Benim yapmak istediğim aslında gerçekten cok zor bir şey değil.Ben kullanıcının sepete eklediği ürün fiyatı bakiyesinden fazla ise "[COLOR="#FF0000"]lutfen bakiye yukleyiniz[/COLOR]" gibi bir hata vermesini istiyorum.Bu hatayı tam olarak Sepetim sayfasında verebilir.Öünkü mesela stokta ürün yoksa yukarıda hatayı veriyor veya diğer fonksiyonlara baarsan hediye kodunda hata cıakrsa gene roada veriyor hatayı.İstediğim bakiye yetersizse bir hata emsajı çıkarmak ve kullanıcının KASA menüsüne gidememesi şimdi bu bir yazıyla tabiki olmaz şimdi aşağıda bazı dosyaları falan tanıtıcam ona göre belki php.mysql bilenleriniz bana yardımcı olabilir diye düşünüyorum.

Ücretli Olarak Yapabilirim Diyeniniz varsa buradan benimle iletişime geçebilir dostlar

Opencart ta sistem tam olarak şöyle gerçekleşiyor;

Opencart kurulu olan ana dizinde;

>catalog
>controller ( language verilerinin tanımlandıgı , fonksiyonların cekildiği ve kullanıldığı dosyalar burada )
>language (bildiğimiz dil klasörleri)
>model ( controllerdeki dosyaların fonksiyonları çektiği dosyalar burada )
>view (temaya eklmememiz gereken kodların dosyaları burada)

Bu klasörler içerisinden bazı dosyalara fonksiyonlar ekleyerek işlemimizi gerçekleştiricez.
Şimdi arkadaşlar

\catalog\controller\checkout\cart.php içi;
Kod:
<?php
class ControllerCheckoutCart extends Controller {
    private $error = array();
    
    public function index() {
        $this->language->load('checkout/cart');

        if (!isset($this->session->data['vouchers'])) {
            $this->session->data['vouchers'] = array();
        }
        
        // Update
        if (!empty($this->request->post['quantity'])) {
            foreach ($this->request->post['quantity'] as $key => $value) {
                $this->cart->update($key, $value);
            }
            
            unset($this->session->data['shipping_method']);
            unset($this->session->data['shipping_methods']);
            unset($this->session->data['payment_method']);
            unset($this->session->data['payment_methods']);
            unset($this->session->data['reward']);
            
            $this->redirect($this->url->link('checkout/cart'));              
        }
           
        // Remove
        if (isset($this->request->get['remove'])) {
            $this->cart->remove($this->request->get['remove']);
            
            unset($this->session->data['vouchers'][$this->request->get['remove']]);
            
            $this->session->data['success'] = $this->language->get('text_remove');
        
            unset($this->session->data['shipping_method']);
            unset($this->session->data['shipping_methods']);
            unset($this->session->data['payment_method']);
            unset($this->session->data['payment_methods']);
            unset($this->session->data['reward']);  
                                
            $this->redirect($this->url->link('checkout/cart'));
        }
            
        // Coupon    
        if (isset($this->request->post['coupon']) && $this->validateCoupon()) {
            $this->session->data['coupon'] = $this->request->post['coupon'];
                
            $this->session->data['success'] = $this->language->get('text_coupon');
            
            $this->redirect($this->url->link('checkout/cart'));
        }
        
        // Voucher
        if (isset($this->request->post['voucher']) && $this->validateVoucher()) {
            $this->session->data['voucher'] = $this->request->post['voucher'];
                
            $this->session->data['success'] = $this->language->get('text_voucher');
                
            $this->redirect($this->url->link('checkout/cart'));
        }

        // Reward
        if (isset($this->request->post['reward']) && $this->validateReward()) {
            $this->session->data['reward'] = abs($this->request->post['reward']);
                
            $this->session->data['success'] = $this->language->get('text_reward');
                
            $this->redirect($this->url->link('checkout/cart'));
        }
        
        
        
        // Shipping
        if (isset($this->request->post['shipping_method']) && $this->validateShipping()) {
            $shipping = explode('.', $this->request->post['shipping_method']);
            
            $this->session->data['shipping_method'] = $this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]];
            
            $this->session->data['success'] = $this->language->get('text_shipping');
            
            $this->redirect($this->url->link('checkout/cart'));
        }
        
        $this->document->setTitle($this->language->get('heading_title'));

          $this->data['breadcrumbs'] = array();

          $this->data['breadcrumbs'][] = array(
            'href'      => $this->url->link('common/home'),
            'text'      => $this->language->get('text_home'),
            'separator' => false
          );

          $this->data['breadcrumbs'][] = array(
            'href'      => $this->url->link('checkout/cart'),
            'text'      => $this->language->get('heading_title'),
            'separator' => $this->language->get('text_separator')
          );
            
        if ($this->cart->hasProducts() || !empty($this->session->data['vouchers'])) {
            $points = $this->customer->getRewardPoints();
            
            $points_total = 0;
            
            foreach ($this->cart->getProducts() as $product) {
                if ($product['points']) {
                    $points_total += $product['points'];
                }
            }        
                
              $this->data['heading_title'] = $this->language->get('heading_title');
            
            $this->data['text_next'] = $this->language->get('text_next');
            $this->data['text_next_choice'] = $this->language->get('text_next_choice');
             $this->data['text_use_coupon'] = $this->language->get('text_use_coupon');
            $this->data['text_use_voucher'] = $this->language->get('text_use_voucher');
            $this->data['text_use_reward'] = sprintf($this->language->get('text_use_reward'), $points);
            $this->data['text_shipping_estimate'] = $this->language->get('text_shipping_estimate');
            $this->data['text_shipping_detail'] = $this->language->get('text_shipping_detail');
            $this->data['text_shipping_method'] = $this->language->get('text_shipping_method');
            $this->data['text_select'] = $this->language->get('text_select');
            $this->data['text_none'] = $this->language->get('text_none');
                        
            $this->data['column_image'] = $this->language->get('column_image');
              $this->data['column_name'] = $this->language->get('column_name');
              $this->data['column_model'] = $this->language->get('column_model');
              $this->data['column_quantity'] = $this->language->get('column_quantity');
            $this->data['column_price'] = $this->language->get('column_price');
              $this->data['column_total'] = $this->language->get('column_total');
            
            $this->data['entry_coupon'] = $this->language->get('entry_coupon');
            $this->data['entry_voucher'] = $this->language->get('entry_voucher');
            $this->data['entry_reward'] = sprintf($this->language->get('entry_reward'), $points_total);
            $this->data['entry_country'] = $this->language->get('entry_country');
            $this->data['entry_zone'] = $this->language->get('entry_zone');
            $this->data['entry_postcode'] = $this->language->get('entry_postcode');
                        
            $this->data['button_update'] = $this->language->get('button_update');
            $this->data['button_remove'] = $this->language->get('button_remove');
            $this->data['button_coupon'] = $this->language->get('button_coupon');
            $this->data['button_voucher'] = $this->language->get('button_voucher');
            $this->data['button_reward'] = $this->language->get('button_reward');
            $this->data['button_quote'] = $this->language->get('button_quote');
            $this->data['button_shipping'] = $this->language->get('button_shipping');            
              $this->data['button_shopping'] = $this->language->get('button_shopping');
              $this->data['button_checkout'] = $this->language->get('button_checkout');
            
            if (isset($this->error['warning'])) {
                $this->data['error_warning'] = $this->error['warning'];
            } elseif (!$this->cart->hasStock() && (!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning'))) {
                  $this->data['error_warning'] = $this->language->get('error_stock');        
            } else {
                $this->data['error_warning'] = '';
            }
            
            if ($this->config->get('config_customer_price') && !$this->customer->isLogged()) {
                $this->data['attention'] = sprintf($this->language->get('text_login'), $this->url->link('account/login'), $this->url->link('account/register'));
            } else {
                $this->data['attention'] = '';
            }
                        
            if (isset($this->session->data['success'])) {
                $this->data['success'] = $this->session->data['success'];
            
                unset($this->session->data['success']);
            } else {
                $this->data['success'] = '';
            }
            
            $this->data['action'] = $this->url->link('checkout/cart');  
                        
            if ($this->config->get('config_cart_weight')) {
                $this->data['weight'] = $this->weight->format($this->cart->getWeight(), $this->config->get('config_weight_class_id'), $this->language->get('decimal_point'), $this->language->get('thousand_point'));
            } else {
                $this->data['weight'] = '';
            }
                        
            $this->load->model('tool/image');
            
              $this->data['products'] = array();
            
            $products = $this->cart->getProducts();

              foreach ($products as $product) {
                $product_total = 0;
                    
                foreach ($products as $product_2) {
                    if ($product_2['product_id'] == $product['product_id']) {
                        $product_total += $product_2['quantity'];
                    }
                }            
                
                if ($product['minimum'] > $product_total) {
                    $this->data['error_warning'] = sprintf($this->language->get('error_minimum'), $product['name'], $product['minimum']);
                }                
                    
                if ($product['image']) {
                    $image = $this->model_tool_image->resize($product['image'], $this->config->get('config_image_cart_width'), $this->config->get('config_image_cart_height'));
                } else {
                    $image = '';
                }

                $option_data = array();

                foreach ($product['option'] as $option) {
                    if ($option['type'] != 'file') {
                        $value = $option['option_value'];    
                    } else {
                        $filename = $this->encryption->decrypt($option['option_value']);
                        
                        $value = utf8_substr($filename, 0, utf8_strrpos($filename, '.'));
                    }
                    
                    $option_data[] = array(
                        'name'  => $option['name'],
                        'value' => (utf8_strlen($value) > 20 ? utf8_substr($value, 0, 20) . '..' : $value)
                    );
                }
                
                // Display prices
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $price = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')));
                } else {
                    $price = false;
                }
                
                // Display prices
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $total = $this->currency->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax')) * $product['quantity']);
                } else {
                    $total = false;
                }
                
                $this->data['products'][] = array(
                      'key'      => $product['key'],
                      'thumb'    => $image,
                    'name'     => $product['name'],
                      'model'    => $product['model'],
                      'option'   => $option_data,
                      'quantity' => $product['quantity'],
                      'stock'    => $product['stock'] ? true : !(!$this->config->get('config_stock_checkout') || $this->config->get('config_stock_warning')),
                    'reward'   => ($product['reward'] ? sprintf($this->language->get('text_points'), $product['reward']) : ''),
                    'price'    => $price,
                    'total'    => $total,
                    'href'     => $this->url->link('product/product', 'product_id=' . $product['product_id']),
                    'remove'   => $this->url->link('checkout/cart', 'remove=' . $product['key'])
                );
              }
            
            // Gift Voucher
            $this->data['vouchers'] = array();
            
            if (!empty($this->session->data['vouchers'])) {
                foreach ($this->session->data['vouchers'] as $key => $voucher) {
                    $this->data['vouchers'][] = array(
                        'key'         => $key,
                        'description' => $voucher['description'],
                        'amount'      => $this->currency->format($voucher['amount']),
                        'remove'      => $this->url->link('checkout/cart', 'remove=' . $key)  
                    );
                }
            }

            if (isset($this->request->post['next'])) {
                $this->data['next'] = $this->request->post['next'];
            } else {
                $this->data['next'] = '';
            }
                        
            $this->data['coupon_status'] = $this->config->get('coupon_status');
            
            if (isset($this->request->post['coupon'])) {
                $this->data['coupon'] = $this->request->post['coupon'];            
            } elseif (isset($this->session->data['coupon'])) {
                $this->data['coupon'] = $this->session->data['coupon'];
            } else {
                $this->data['coupon'] = '';
            }
            
            $this->data['voucher_status'] = $this->config->get('voucher_status');
            
            if (isset($this->request->post['voucher'])) {
                $this->data['voucher'] = $this->request->post['voucher'];                
            } elseif (isset($this->session->data['voucher'])) {
                $this->data['voucher'] = $this->session->data['voucher'];
            } else {
                $this->data['voucher'] = '';
            }
            
            $this->data['reward_status'] = ($points && $points_total && $this->config->get('reward_status'));
            
            if (isset($this->request->post['reward'])) {
                $this->data['reward'] = $this->request->post['reward'];                
            } elseif (isset($this->session->data['reward'])) {
                $this->data['reward'] = $this->session->data['reward'];
            } else {
                $this->data['reward'] = '';
            }

            $this->data['shipping_status'] = $this->config->get('shipping_status') && $this->config->get('shipping_estimator') && $this->cart->hasShipping();    
                                
            if (isset($this->request->post['country_id'])) {
                $this->data['country_id'] = $this->request->post['country_id'];                
            } elseif (isset($this->session->data['shipping_country_id'])) {
                $this->data['country_id'] = $this->session->data['shipping_country_id'];                  
            } else {
                $this->data['country_id'] = $this->config->get('config_country_id');
            }
                
            $this->load->model('localisation/country');
            
            $this->data['countries'] = $this->model_localisation_country->getCountries();
                        
            if (isset($this->request->post['zone_id'])) {
                $this->data['zone_id'] = $this->request->post['zone_id'];                
            } elseif (isset($this->session->data['shipping_zone_id'])) {
                $this->data['zone_id'] = $this->session->data['shipping_zone_id'];            
            } else {
                $this->data['zone_id'] = '';
            }
            
            if (isset($this->request->post['postcode'])) {
                $this->data['postcode'] = $this->request->post['postcode'];                
            } elseif (isset($this->session->data['shipping_postcode'])) {
                $this->data['postcode'] = $this->session->data['shipping_postcode'];                    
            } else {
                $this->data['postcode'] = '';
            }
            
            if (isset($this->request->post['shipping_method'])) {
                $this->data['shipping_method'] = $this->request->post['shipping_method'];                
            } elseif (isset($this->session->data['shipping_method'])) {
                $this->data['shipping_method'] = $this->session->data['shipping_method']['code'];
            } else {
                $this->data['shipping_method'] = '';
            }
                        
            // Totals
            $this->load->model('setting/extension');
            
            $total_data = array();                    
            $total = 0;
            $taxes = $this->cart->getTaxes();
            
            // Display prices
            if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                $sort_order = array();
                
                $results = $this->model_setting_extension->getExtensions('total');
                
                foreach ($results as $key => $value) {
                    $sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
                }
                
                array_multisort($sort_order, SORT_ASC, $results);
                
                foreach ($results as $result) {
                    if ($this->config->get($result['code'] . '_status')) {
                        $this->load->model('total/' . $result['code']);
            
                        $this->{'model_total_' . $result['code']}->getTotal($total_data, $total, $taxes);
                    }
                    
                    $sort_order = array();
                  
                    foreach ($total_data as $key => $value) {
                        $sort_order[$key] = $value['sort_order'];
                    }
        
                    array_multisort($sort_order, SORT_ASC, $total_data);            
                }
            }
            
            $this->data['totals'] = $total_data;
                        
            $this->data['continue'] = $this->url->link('common/home');
                        
            $this->data['checkout'] = $this->url->link('checkout/checkout', '', 'SSL');

            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/cart.tpl')) {
                $this->template = $this->config->get('config_template') . '/template/checkout/cart.tpl';
            } else {
                $this->template = 'default/template/checkout/cart.tpl';
            }
            
            $this->children = array(
                'common/column_left',
                'common/column_right',
                'common/content_bottom',
                'common/content_top',
                'common/footer',
                'common/header'    
            );
                        
            $this->response->setOutput($this->render());                    
        } else {
              $this->data['heading_title'] = $this->language->get('heading_title');

              $this->data['text_error'] = $this->language->get('text_empty');

              $this->data['button_continue'] = $this->language->get('button_continue');
            
              $this->data['continue'] = $this->url->link('common/home');

            unset($this->session->data['success']);

            if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/error/not_found.tpl')) {
                $this->template = $this->config->get('config_template') . '/template/error/not_found.tpl';
            } else {
                $this->template = 'default/template/error/not_found.tpl';
            }
            
            $this->children = array(
                'common/column_left',
                'common/column_right',
                'common/content_top',
                'common/content_bottom',
                'common/footer',
                'common/header'    
            );
                    
            $this->response->setOutput($this->render());            
        }
      }
    
    private function validateTransaction() {
        $this->load->model('account/transaction');
                
        $trans_info = $this->model_account_transaction->getTransactions('amount');            
        $product_price = $this->data['products'][] = array('price');
        if (!$trans_info < $product_price ) ; {            
            $this->error['warning'] = $this->language->get('error_transaction');
        }
        
        if (!$this->error) {
            return true;
        } else {
            return false;
        }        
    }
    
    private function validateCoupon() {
        $this->load->model('checkout/coupon');
                
        $coupon_info = $this->model_checkout_coupon->getCoupon($this->request->post['coupon']);            
        
        if (!$coupon_info) {            
            $this->error['warning'] = $this->language->get('error_coupon');
        }
        
        if (!$this->error) {
            return true;
        } else {
            return false;
        }        
    }
    
    private function validateVoucher() {
        $this->load->model('checkout/voucher');
                
        $voucher_info = $this->model_checkout_voucher->getVoucher($this->request->post['voucher']);            
        
        if (!$voucher_info) {            
            $this->error['warning'] = $this->language->get('error_voucher');
        }
        
        if (!$this->error) {
            return true;
        } else {
            return false;
        }        
    }
    
    private function validateReward() {
        $points = $this->customer->getRewardPoints();
        
        $points_total = 0;
        
        foreach ($this->cart->getProducts() as $product) {
            if ($product['points']) {
                $points_total += $product['points'];
            }
        }    
                
        if (empty($this->request->post['reward'])) {
            $this->error['warning'] = $this->language->get('error_reward');
        }
    
        if ($this->request->post['reward'] > $points) {
            $this->error['warning'] = sprintf($this->language->get('error_points'), $this->request->post['reward']);
        }
        
        if ($this->request->post['reward'] > $points_total) {
            $this->error['warning'] = sprintf($this->language->get('error_maximum'), $points_total);
        }
        
        if (!$this->error) {
            return true;
        } else {
            return false;
        }        
    }
    
    private function validateShipping() {
        if (!empty($this->request->post['shipping_method'])) {
            $shipping = explode('.', $this->request->post['shipping_method']);
                    
            if (!isset($shipping[0]) || !isset($shipping[1]) || !isset($this->session->data['shipping_methods'][$shipping[0]]['quote'][$shipping[1]])) {            
                $this->error['warning'] = $this->language->get('error_shipping');
            }
        } else {
            $this->error['warning'] = $this->language->get('error_shipping');
        }
        
        if (!$this->error) {
            return true;
        } else {
            return false;
        }        
    }
                                
    public function add() {
        $this->language->load('checkout/cart');
        
        $json = array();
        
        if (isset($this->request->post['product_id'])) {
            $product_id = $this->request->post['product_id'];
        } else {
            $product_id = 0;
        }
        
        $this->load->model('catalog/product');
                        
        $product_info = $this->model_catalog_product->getProduct($product_id);
        
        if ($product_info) {            
            if (isset($this->request->post['quantity'])) {
                $quantity = $this->request->post['quantity'];
            } else {
                $quantity = 1;
            }
                                                        
            if (isset($this->request->post['option'])) {
                $option = array_filter($this->request->post['option']);
            } else {
                $option = array();    
            }
            
            $product_options = $this->model_catalog_product->getProductOptions($this->request->post['product_id']);
            
            foreach ($product_options as $product_option) {
                if ($product_option['required'] && empty($option[$product_option['product_option_id']])) {
                    $json['error']['option'][$product_option['product_option_id']] = sprintf($this->language->get('error_required'), $product_option['name']);
                }
            }
            
            if (!$json) {
                $this->cart->add($this->request->post['product_id'], $quantity, $option);

                $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
                
                unset($this->session->data['shipping_method']);
                unset($this->session->data['shipping_methods']);
                unset($this->session->data['payment_method']);
                unset($this->session->data['payment_methods']);
                
                // Totals
                $this->load->model('setting/extension');
                
                $total_data = array();                    
                $total = 0;
                $taxes = $this->cart->getTaxes();
                
                // Display prices
                if (($this->config->get('config_customer_price') && $this->customer->isLogged()) || !$this->config->get('config_customer_price')) {
                    $sort_order = array();
                    
                    $results = $this->model_setting_extension->getExtensions('total');
                    
                    foreach ($results as $key => $value) {
                        $sort_order[$key] = $this->config->get($value['code'] . '_sort_order');
                    }
                    
                    array_multisort($sort_order, SORT_ASC, $results);
                    
                    foreach ($results as $result) {
                        if ($this->config->get($result['code'] . '_status')) {
                            $this->load->model('total/' . $result['code']);
                
                            $this->{'model_total_' . $result['code']}->getTotal($total_data, $total, $taxes);
                        }
                        
                        $sort_order = array();
                      
                        foreach ($total_data as $key => $value) {
                            $sort_order[$key] = $value['sort_order'];
                        }
            
                        array_multisort($sort_order, SORT_ASC, $total_data);            
                    }
                }
                
                $json['total'] = sprintf($this->language->get('text_items'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0), $this->currency->format($total));
            } else {
                $json['redirect'] = str_replace('&amp;', '&', $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']));
            }
        }
        
        $this->response->setOutput(json_encode($json));        
    }
    
    public function quote() {
        $this->language->load('checkout/cart');
        
        $json = array();    
        
        if (!$this->cart->hasProducts()) {
            $json['error']['warning'] = $this->language->get('error_product');                
        }                

        if (!$this->cart->hasShipping()) {
            $json['error']['warning'] = sprintf($this->language->get('error_no_shipping'), $this->url->link('information/contact'));                
        }                
        
        if ($this->request->post['country_id'] == '') {
            $json['error']['country'] = $this->language->get('error_country');
        }
        
        if ($this->request->post['zone_id'] == '') {
            $json['error']['zone'] = $this->language->get('error_zone');
        }
            
        $this->load->model('localisation/country');
        
        $country_info = $this->model_localisation_country->getCountry($this->request->post['country_id']);
        
        if ($country_info && $country_info['postcode_required'] && (utf8_strlen($this->request->post['postcode']) < 2) || (utf8_strlen($this->request->post['postcode']) > 10)) {
            $json['error']['postcode'] = $this->language->get('error_postcode');
        }
                        
        if (!$json) {        
            $this->tax->setShippingAddress($this->request->post['country_id'], $this->request->post['zone_id']);
        
            // Default Shipping Address
            $this->session->data['shipping_country_id'] = $this->request->post['country_id'];
            $this->session->data['shipping_zone_id'] = $this->request->post['zone_id'];
            $this->session->data['shipping_postcode'] = $this->request->post['postcode'];
        
            if ($country_info) {
                $country = $country_info['name'];
                $iso_code_2 = $country_info['iso_code_2'];
                $iso_code_3 = $country_info['iso_code_3'];
                $address_format = $country_info['address_format'];
            } else {
                $country = '';
                $iso_code_2 = '';
                $iso_code_3 = '';    
                $address_format = '';
            }
            
            $this->load->model('localisation/zone');
        
            $zone_info = $this->model_localisation_zone->getZone($this->request->post['zone_id']);
            
            if ($zone_info) {
                $zone = $zone_info['name'];
                $zone_code = $zone_info['code'];
            } else {
                $zone = '';
                $zone_code = '';
            }    
        
            $address_data = array(
                'firstname'      => '',
                'lastname'       => '',
                'company'        => '',
                'address_1'      => '',
                'address_2'      => '',
                'postcode'       => $this->request->post['postcode'],
                'city'           => '',
                'zone_id'        => $this->request->post['zone_id'],
                'zone'           => $zone,
                'zone_code'      => $zone_code,
                'country_id'     => $this->request->post['country_id'],
                'country'        => $country,    
                'iso_code_2'     => $iso_code_2,
                'iso_code_3'     => $iso_code_3,
                'address_format' => $address_format
            );
        
            $quote_data = array();
            
            $this->load->model('setting/extension');
            
            $results = $this->model_setting_extension->getExtensions('shipping');
            
            foreach ($results as $result) {
                if ($this->config->get($result['code'] . '_status')) {
                    $this->load->model('shipping/' . $result['code']);
                    
                    $quote = $this->{'model_shipping_' . $result['code']}->getQuote($address_data);
        
                    if ($quote) {
                        $quote_data[$result['code']] = array(
                            'title'      => $quote['title'],
                            'quote'      => $quote['quote'],
                            'sort_order' => $quote['sort_order'],
                            'error'      => $quote['error']
                        );
                    }
                }
            }
    
            $sort_order = array();
          
            foreach ($quote_data as $key => $value) {
                $sort_order[$key] = $value['sort_order'];
            }
    
            array_multisort($sort_order, SORT_ASC, $quote_data);
            
            $this->session->data['shipping_methods'] = $quote_data;
            
            if ($this->session->data['shipping_methods']) {
                $json['shipping_method'] = $this->session->data['shipping_methods'];
            } else {
                $json['error']['warning'] = sprintf($this->language->get('error_no_shipping'), $this->url->link('information/contact'));
            }                
        }    
        
        $this->response->setOutput(json_encode($json));                        
    }
    
    public function country() {
        $json = array();
        
        $this->load->model('localisation/country');

        $country_info = $this->model_localisation_country->getCountry($this->request->get['country_id']);
        
        if ($country_info) {
            $this->load->model('localisation/zone');

            $json = array(
                'country_id'        => $country_info['country_id'],
                'name'              => $country_info['name'],
                'iso_code_2'        => $country_info['iso_code_2'],
                'iso_code_3'        => $country_info['iso_code_3'],
                'address_format'    => $country_info['address_format'],
                'postcode_required' => $country_info['postcode_required'],
                'zone'              => $this->model_localisation_zone->getZonesByCountryId($this->request->get['country_id']),
                'status'            => $country_info['status']        
            );
        }
        
        $this->response->setOutput(json_encode($json));
    }
}
?>

Bu kodlar arasından "validate" diye arattım mesela couponvalidate var o mesela kupon kodu girince yanlışsa hata vermesini sağlıyor
onu örnek alarak bitane
Kod:
private function validateTransaction() {
        $this->load->model('account/transaction');
                
        $trans_info = $this->model_account_transaction->getTransactions('amount');            
        $product_price = $this->data['products'][] = array('price');
        if (!$trans_info < $product_price ) ; {            
            $this->error['warning'] = $this->language->get('error_transaction');
        }
        
        if (!$this->error) {
            return true;
        } else {
            return false;
        }        
    }
valitadeTransaction oluşturdum zaten kodların içinde bu oluşturduğumu sizde görebilirsiniz bu oluşturduğum şey tabiki çalışmıyor Big Grin şimdi burada birde gene cart.php içine
Kod:
// Coupon (coupon u transaction oarlak editliyorum şimdilik :D)    
        if (isset($this->request->post['transaction']) && $this->validateTransaction()) {
            $this->session->data['transaction'] = $this->request->post['transaction'];
                
            $this->session->data['success'] = $this->language->get('text_transaction');
            
            $this->redirect($this->url->link('checkout/cart'));
        }
gibi bir kod eklememiz gerekiyor sanırım.bu iki kodu cart.php ye ekledim şimdi bu kodlar tabiki uyumlu deilde bazı değişikliklerle çalışır hale gelebilir şimdi asıl önemli nokta.
ilk eklediğim private function validateTransaction() a bakıcak olursak en yukarda aşağıdaki kodu görüyoruz
Kod:
$this->load->model('account/transaction');
bunları yazarken birşey farkettim MODEL klasöründe total diye klasör var onun içinde credit.php var onun içinde üyelerin bakiyelerinin toplam yani toplam bakiye foksiyonu var sanırım yanılıyorsam
\catalog\model\total\credit.php
Kod:
<?php
class ModelTotalCredit extends Model {
    public function getTotal(&$total_data, &$total, &$taxes) {
        if ($this->config->get('credit_status')) {
            $this->load->language('total/credit');
        
            $balance = $this->customer->getBalance();
            
            if ((float)$balance) {
                if ($balance > $total) {
                    $credit = $total;    
                } else {
                    $credit = $balance;    
                }
                
                if ($credit > 0) {
                    $total_data[] = array(
                        'code'       => 'credit',
                        'title'      => $this->language->get('text_credit'),
                        'text'       => $this->currency->format(-$credit),
                        'value'      => -$credit,
                        'sort_order' => $this->config->get('credit_sort_order')
                    );
                    
                    $total -= $credit;
                }
            }
        }
    }
    
    public function confirm($order_info, $order_total) {
        $this->load->language('total/credit');
        
        if ($order_info['customer_id']) {
            $this->db->query("INSERT INTO " . DB_PREFIX . "customer_transaction SET customer_id = '" . (int)$order_info['customer_id'] . "', order_id = '" . (int)$order_info['order_id'] . "', description = '" . $this->db->escape(sprintf($this->language->get('text_order_id'), (int)$order_info['order_id'])) . "', amount = '" . (float)$order_total['value'] . "', date_added = NOW()");                
        }
    }    
}
?>
evet aynen oyle bu durumda model olarak almamız gereken dosya yolu "\catalog\model\total\credit.php" olmalı diye sanıyorum buradan toplam bakiye degerini çekip . "\catalog\controller\checkout\cart.php"nin içine yazacağımız kodlarla de müşterinin sepete eklediği ürün fiyatıyla karşılaştırmamız gerekiyor bunu if else kullanarak sizin ayrdımlarınızla yapabiliriz ama peki asıl soruardan biride şu . müşterinin sepete eklediği ürünlerin toplam değerini nasıl alıp bakiye degeriyle karşılaştırıcaz? Gene total klasörüne bakıyorum hemen inşallah ordadır.
evet orada sanırım hemen o dosyayıda gösteriyorum sizlere Smile
\catalog\model\total\total.php; adı altında ve carttaki toplam degeri yansıtan kodlar burada sanırım sizde bir bakın;
Kod:
<?php
class ModelTotalTotal extends Model {
    public function getTotal(&$total_data, &$total, &$taxes) {
        $this->load->language('total/total');
    
        $total_data[] = array(
            'code'       => 'total',
            'title'      => $this->language->get('text_total'),
            'text'       => $this->currency->format(max(0, $total)),
            'value'      => max(0, $total),
            'sort_order' => $this->config->get('total_sort_order')
        );
    }
}
?>

şimdi Model olarak elimizde aşağıdaki iki dosya var ;
\catalog\model\total\credit.php
\catalog\model\total\total.php

Ve controller klasörü içerinde düzenlememiz gereken bir cart.php var oda surada;
catalog\controller\checkout\cart.php

Bu durumda bizim cart.php ye eklememiz gereken fonksiyon basitçe şöyle başlamalı ve bitmeli midir?
Kod:
private function validateTransaction() {
        $this->load->model('total\total');   ** total.php dosyası ürün toplam diyatının değeri burada**
                $this->load->model('total\creditl'); ** credit.php dosyası kullanıcının toplam bakiye degeri burada **
                
        $trans_total = $this->model_total_total->getTotal('total');            
        $product_price_total = $this->model_total_credit->getTotal('credit') ;

        if (!$trans_total < $product_price_total ) ; {            
            $this->error['warning'] = $this->language->get('error_transaction'); **  langguageyi tanımlamasını yapılmış varsayalım **
        }
        
        if (!$this->error) {
            return true;
        } else {
            return false;
        }        
    }

bu yukarıda yazdığımı catalog\controller\checkout\cart.php ye eklesek bide tanımlama yapabilmek için sanırım birde şunu eklesek kodlar arasına; bu aşağıdaki sanırım işlemden sora yonlendirme falan filan yapıyor buda gerekli sanırım ayrıca foksiyonda tanımlanıyor sanırım;

Kod:
// Coupon (coupon u transaction oarlak editliyorum şimdilik :D)    
        if (isset($this->request->post['transaction']) && $this->validateTransaction()) {
            $this->session->data['transaction'] = $this->request->post['transaction'];
                
            $this->session->data['success'] = $this->language->get('text_transaction');
            
            $this->redirect($this->url->link('checkout/cart'));
        }

bu son iki kodu eklesek de kesin yanlış olduğunu az çok tahmin ediyorumda ben php bilgisi olan biri değilim şuan bazı şeyleri öğrenme aşamasındayım , eğer istediğim şeye yaklaştıysam lutfen bana yardım edin Sad amacım anlaşıldığı gibi toplam ürün fiyatı ile toplam bakiye fiyatından büyükse ekranda hata göstermek
Bu kodarı toparlayabilirsek geriye sadece tema klasörüne birkaç kod eklemek kalıyor diye sanıyorum umarım anlaşılır bir biçimde anlatmışımdır olayı lutfen yardımınıza ihtiyacım var php ve mysqlciler Sad
Alıntı Yaparak Cevapla
Paylaş!
Osman Erdiv
Banned
user avatar
Çevrimdışı

Mesajlar: 15
Konular: 2
Katılma Tarihi: Nov 2012
Teşekkürler: 1
0 Mesajına, 0 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-19-2012 07:16 PM
Kod:
private function validateTransaction() {
        $this->load->model('catalog/product');  
        $this->load->model('total/credit');
                
        $product_price_total = $this->data['income'] = $this->currency->format($product_info['price'];        
        $trans_total = $this->data['balance'] = $this->currency->format($this->customer->getBalance(), $this->currency->getCode()); ;

        if ( $trans_total > $product_price_total ) ; {            
            $this->error['warning'] = $this->language->get('error_transaction');
        }
        
        if (!$this->error) {
            return true;
        } else {
            return false;
        }        
    }
bu yukarıdakini yeni keşfettim ilk mesajımda saçmalamış olabilirim yapmak istediğimi anlayanalrınız lutfen yardım edin Sad

Yani bir if dongusu içinde ( toplam_bakiye < toplam price ) $this->error['warning'] = $this->language->get('error_transaction'); ayzdırmam gerekiyo
birde yukarılara
Kod:
// Transactiom    
        if (isset($this->validateTransaction()) {
            $this->data['income'] = $this->currency->format($product_info['price'] <= $this->data['balance'] = $this->currency->format($this->customer->getBalance();
                
            $this->session->data['success'] = $this->language->get('text_coupon');
            
            $this->redirect($this->url->link('checkout/cart'));
        }

ekledim biseler yapmaya calısıyorum ama :Big Grin
Halen k7urcalıyorum bu foksiyon dahamı mantıklı olur acaba?
Alıntı Yaparak Cevapla
Paylaş!
Osman Erdiv
Banned
user avatar
Çevrimdışı

Mesajlar: 15
Konular: 2
Katılma Tarihi: Nov 2012
Teşekkürler: 1
0 Mesajına, 0 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-19-2012 10:11 PM
Arkadaşlar ben parayla yaparım diyen varsa gene görüşebiliriz ben yapamıycam sanırım bu bilgiyle :/
Alıntı Yaparak Cevapla
Paylaş!
GokhanKorkutv
Deli (:
***
V.İ.P Premium user avatar
Çevrimdışı

Mesajlar: 227
Konular: 9
Katılma Tarihi: Sep 2012
Rep Puanı: 6
Teşekkürler: 18
81 Mesajına, 183 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-19-2012 11:39 PM
validateTransaction'ı doğru yaptığını farzedersek;

Bu fonksiyonu nereye bağladın?

Yani sadece fonksiyonu yazmakla bitmeyecektir. Bunu tetikleyecek olan bir şey lazım.

Mesela bunu kasaya git butonuna ekleyebilirsin.
GokhanKorkut
www.gokhankorkut.com
because we share life..

Alıntı Yaparak Cevapla
Paylaş!
Osman Erdiv
Banned
user avatar
Çevrimdışı

Mesajlar: 15
Konular: 2
Katılma Tarihi: Nov 2012
Teşekkürler: 1
0 Mesajına, 0 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-20-2012 12:40 AM
Abi aslında neyi nasıl yapmamız gerektiği konusunda kabataslak bir yol çizebilse biri bana mantığını kavrardım ama bu olayın mantığını tam anlıyamadım ben :/
Alıntı Yaparak Cevapla
Paylaş!
GokhanKorkutv
Deli (:
***
V.İ.P Premium user avatar
Çevrimdışı

Mesajlar: 227
Konular: 9
Katılma Tarihi: Sep 2012
Rep Puanı: 6
Teşekkürler: 18
81 Mesajına, 183 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-20-2012 01:31 AM
Aslında ne yapmak istediğini anlayamadığım için, sadece senin yapmış olduğun kısımdaki eksiği söylemiştim.

Çünkü ilk mesajında söylediğin sistemin ucu açık bir çok ayrıntısı var.
GokhanKorkut
www.gokhankorkut.com
because we share life..

Alıntı Yaparak Cevapla
Paylaş!
Osman Erdiv
Banned
user avatar
Çevrimdışı

Mesajlar: 15
Konular: 2
Katılma Tarihi: Nov 2012
Teşekkürler: 1
0 Mesajına, 0 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-20-2012 01:38 AM
Yani ozaman toplam fiyatı tutan deger ile toplam bakiyeyi tutan değeri bulup bir " if " içinde degerlendirip biri diğerinden küçükse hata verdirmek aslında sandığım kadar kolay değil.
Alıntı Yaparak Cevapla
Paylaş!
GokhanKorkutv
Deli (:
***
V.İ.P Premium user avatar
Çevrimdışı

Mesajlar: 227
Konular: 9
Katılma Tarihi: Sep 2012
Rep Puanı: 6
Teşekkürler: 18
81 Mesajına, 183 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-20-2012 01:42 AM
Kolay veya zordan ziyade, üzeirnde uğraşmak gerekiyor. Yapmak istediğinizi yapsanız bile bir çok bug ortaya çıkacaktır. Ve bunları fixlerken ömrünüz tükenir emin olun.
GokhanKorkut
www.gokhankorkut.com
because we share life..

Alıntı Yaparak Cevapla
Paylaş!
Osman Erdiv
Banned
user avatar
Çevrimdışı

Mesajlar: 15
Konular: 2
Katılma Tarihi: Nov 2012
Teşekkürler: 1
0 Mesajına, 0 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-20-2012 03:06 AM
Anladım enyse ben ugrasmaya devam edicem yapacağıma inanarak Big Grin
Alıntı Yaparak Cevapla
Paylaş!
sabitertanv
Süper Moderator
******
Süper Moderator user avatar
Çevrimdışı

Mesajlar: 290
Konular: 31
Katılma Tarihi: Dec 2011
Rep Puanı: 21
Teşekkürler: 22
127 Mesajına, 601 Teşekkür edildi.



Kişisel Bilgileri: v
Konu Tarihi: 11-20-2012 09:41 AM
Aslında startup içerisinde bir class tanımlamak çok daha mantıklı geliyor bana senin düşünceni uygulayabilmek için(login check sınıfı gibi yapılabilir diye düşünüyorum). Biraz uğraşalım bakalım belki birşeyler çıkar.
sabitertan
Forumuna sahip çık! .:|Bağış Yap|:.
Alıntı Yaparak Cevapla
Paylaş!

« Önceki | Sonraki »
Cevapla  Gönder 

Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Konusunun Linki Direk Link
Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Konusunun HTML Kodu HTML Link
Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Konusu BBCode Linki BBCode Link
Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Konusunu Paylaş Sosyal Paylaş

Benzeyen Konular
Konu: Yazar Cevaplar: Gösterim: Son Mesaj
  [Tema] Opencart Default Tema İçin **** Yardım Lütfen ex-xe 1 2,395 12-27-2020 01:08 PM
Son Mesaj: serajans
  e-ticaret sistemi kurmada yardımcı olabilecek? reddecks 0 1,966 11-17-2020 01:21 PM
Son Mesaj: reddecks
Exclamation Google Adwords ve Facebook Pixel Snippet Kodları İçin Ücretli Yardım Arıyorum Cancevik 0 951 04-09-2019 07:03 PM
Son Mesaj: Cancevik
Smile Tema Düzenleme ve N11 Entegrasyon Orhimes 0 1,111 02-21-2019 03:20 AM
Son Mesaj: Orhimes
  Ücretli yaptırılacak -|- 1.5 temasını 3.x sürümüne uygun düzenleme/editleme bucayer6 0 1,075 03-18-2018 01:38 AM
Son Mesaj: bucayer6
  tema düzenleme hkk, murat-1903 1 1,098 02-23-2018 10:34 PM
Son Mesaj: DeathDance
  bir kaç konu başlığında yardım istiyorum etoburbitkimarketi 0 1,156 12-12-2017 10:30 PM
Son Mesaj: etoburbitkimarketi
  E-Ticaret Sitemizi Yenileme Konusunda yardım. copmurat 0 1,246 11-08-2017 11:22 PM
Son Mesaj: copmurat
  [Ücretli] Opencart 2.3.0.2 Ücretli Modül Düzenleme Desteği Mustafak4r4 4 2,424 11-06-2017 09:06 PM
Son Mesaj: Mustafak4r4
Tongue opencart ücretli yardım (sipariş listesine kutucular eklenecek) Serkan.SK 0 1,497 05-02-2017 02:29 AM
Son Mesaj: Serkan.SK

Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - indir, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Videosu, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - online izle, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Bedava indir, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Yükle, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Hakkında, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - nedir, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - Free indir, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - oyunu, Bakiye Sistemi Düzenleme - YARDIM - PHP ve MySql - download


Forum Atla: