• 30-01-2014, 10:47:44
    #1
    Merhaba üstadlar,

    Kodlama olayında çok yeniyim ve şöyle bir problemim var.

    Elimde bu kodlar var,
    <?phpclass ModelShippingMng extends Model {
        function getQuote($address) {
            $this->load->language('shipping/mng');
            
            if ($this->config->get('mng_status')) {
                  $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int)$this->config->get('mng_geo_zone_id') . "' AND country_id = '" . (int)$address['country_id'] . "' AND (zone_id = '" . (int)$address['zone_id'] . "' OR zone_id = '0')");
    
    
                  if (!$this->config->get('mng_geo_zone_id')) {
                    $status = TRUE;
                  } elseif ($query->num_rows) {
                    $status = TRUE;
                  } else {
                    $status = FALSE;
                  }
            } else {
                $status = FALSE;
            }
            
            $method_data = array();
        
            if ($status) {
                $cost = 0;
                $desi = $this->cart->getDesi();
                $sub_total = $this->cart->getSubTotal();
                
                $rate1 = $this->config->get('mng_rate1');
                $rate2 = $this->config->get('mng_rate2');
                $rate3 = $this->config->get('mng_rate3');
                $rate4 = $this->config->get('mng_rate4');
                $rate5 = $this->config->get('mng_rate5');
                $rate6 = $this->config->get('mng_rate6');
                $rate7 = $this->config->get('mng_rate7');
                $rate8 = $this->config->get('mng_rate8');            
                
                
                if ($desi < 2){$cost = $rate1;}
                if (($desi >= 2)&&($desi<=6)){$cost = $rate2;}
                if (($desi >= 7)&&($desi<=10)){$cost = $rate3;}
                if (($desi >= 11)&&($desi<=15)){$cost = $rate4;}
                if (($desi >= 16)&&($desi<=20)){$cost = $rate5;}
                if (($desi >= 21)&&($desi<=25)){$cost = $rate6;}
                if (($desi >= 26)&&($desi<=30)){$cost = $rate7;}
                if ($desi > 30){$cost = $rate7 + ($rate8 * ($desi - 30));}
                            
                
                $quote_data = array();
                
                if ((float)$cost) {
                    $text = $this->language->get('text_description');
                
                    if ($this->config->get('mng_display_weight')) {
                        $text .= ' (' . $this->language->get('text_weight') . ' ' . $this->weight->format($this->cart->getWeight(), $this->config->get('config_weight_class')) . ')';
                    }
                
                        
    
    
                    if ($this->config->get('mng_display_time')) {
                        $text .= ' (' . $this->language->get('text_time') . ')';
                    }    
                    
                      $quote_data['mng'] = array(
                        'code'           => 'mng.mng',
                        'title'        => $text,
                        'cost'         => $cost,
                        'tax_class_id' => $this->config->get('mng_tax_class_id'),
                        'text'         => $this->currency->format($this->tax->calculate($cost, $this->config->get('mng_tax_class_id'), $this->config->get('config_tax')))
                      );
    
    
                      $method_data = array(
                        'code'         => 'mng',
                        'title'      => $this->language->get('text_title'),
                        'quote'      => $quote_data,
                        'sort_order' => $this->config->get('mng_sort_order'),
                        'error'      => FALSE
                      );
                }
            }
        
            return $method_data;
        }
    }
    ?>

    ve ben bu koda elimde sql'de bulunan *****_product tablosunda sku değerini okutturup aşağıdaki işlemi yaptırmak istiyorum.

    eğer SKU 1 ise ücretsiz yaz, ücret 0 olsun,
    eğer SKU 1 değilse işleme devam et ve desi hesapla

    Yardımlarınız için şimdiden teşekkür ederim.
  • 30-01-2014, 11:28:01
    #2
    Kimlik doğrulama veya yönetimden onay bekliyor.
    @HedefB;

    ***_product tablosunun kolonlarını ve örnek bi' kayıtın resmini konuya ekler misiniz?
  • 30-01-2014, 15:43:08
    #3
    @saintx;

    Kolonların tamamını da yazabilirim isterseniz ama ekrana sığmıyor çok fazla kolon mevcut.

    ****_product tablosunun örnek resmini ekledim.



    Eklenti olarak ekleyemiyorum o yüzden de imageshack'a yükledim.

    Şunu da eklemek istiyorum SKU değeri ya 1 oluyor ya da boş oluyor.
  • 30-01-2014, 19:05:39
    #4
    product_id'ye nereden ulaşacağız peki en üstte verdiğiniz betikte?
  • 30-01-2014, 19:36:20
    #5
    saintx adlı üyeden alıntı: mesajı görüntüle
    product_id'ye nereden ulaşacağız peki en üstte verdiğiniz betikte?
    Sql'den çağıramaz mıyız? Ya da product.php var ürün sayfasını düzenleyen oradan çağırabiliriz. Şuanda düzenlemeye çalıştığım yazılım Opencart.
  • 31-01-2014, 03:17:00
    #6
    çok yeni olmanıza rağmen code igniter (framework) üzerine yazılmış olan e-ticaret yazılımı (opencart) üzerinde değişiklik yapmaya çalışmanız ilginç. çözüm çok basit ama bu çözülse bir sonraki adımda takılacağın için bir şey yazmamayı tercih ediyorum.
  • 31-01-2014, 12:27:49
    #7
    Üyeliği durduruldu
    ismaildikmen adlı üyeden alıntı: mesajı görüntüle
    çok yeni olmanıza rağmen code igniter (framework) üzerine yazılmış olan e-ticaret yazılımı (opencart) üzerinde değişiklik yapmaya çalışmanız ilginç. çözüm çok basit ama bu çözülse bir sonraki adımda takılacağın için bir şey yazmamayı tercih ediyorum.
    Katılıyorum Bu Arada if Döngü Değil Koşuldur.