Ejemplo n.º 1
0
 public function createHeader()
 {
     $tools = new Idealo_Universal_Tools_IdealoTools();
     $schema = $this->quoting . Mage::helper('csvexport')->__('Article number') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Article name') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Manufacturer') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Category') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Short description') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Long description') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Image(s)') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Deeplink') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Price') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('EAN') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Article number in shop') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Weight') . $this->quoting . $this->seperator;
     foreach ($this->shipping as $ship) {
         if ($ship['active'] == '1') {
             foreach ($this->payment as $payment) {
                 if ($payment['active'] == '1' && strpos($payment['country'], $ship['title']) !== false) {
                     $schema .= $this->quoting . $payment['title'] . '_' . $ship['title'] . $this->quoting . $this->seperator;
                 }
             }
         }
     }
     $schema .= $this->quoting . Mage::helper('csvexport')->__('portocomment') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Base price') . $this->quoting . $this->seperator;
     $attribute_list = explode(';', $tools->getValue('csvexport/extra/extra_attributes'));
     $schema .= $this->quoting . Mage::helper('csvexport')->__('extraAttributes') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Delivery time') . $this->quoting . $this->seperator . $this->quoting . Mage::helper('csvexport')->__('Manufacturer Part Number') . $this->quoting . $this->seperator;
     if ($this->minOrderPrice != '') {
         $schema .= $this->quoting . Mage::helper('csvexport')->__('additional costs due to minimum order value') . $this->quoting . $this->seperator;
     }
     $schema .= "\n";
     setlocale(LC_ALL, 'de_DE');
     $date = date("d.m.y H:i:s");
     $schema .= $this->quoting . Mage::helper('csvexport')->__('Feed last generated at') . ' ' . $date . ' ' . Mage::helper('csvexport')->__('hours') . $this->quoting . $this->seperator;
     $schema .= "\n";
     $schema .= $this->quoting . Mage::helper('csvexport')->__('idealo - csv export module v.') . VERSION_NUMBER_IDEALO . ' ' . Mage::helper('csvexport')->__('for Magento 1.4.x - 1.7.0 from') . ' ' . VERSION_DATE . $this->quoting . $this->seperator;
     $schema .= "\n";
     $path = substr(__FILE__, 0, -52);
     $fp = fopen($path . 'export/' . $this->filename, "w+");
     fputs($fp, $schema);
     fclose($fp);
 }
Ejemplo n.º 2
0
 public function runExport()
 {
     $tools = new Idealo_Universal_Tools_IdealoTools();
     if ($tools->getValue('csvexport/cron/cron') == '1') {
         $connection = Mage::getSingleton('core/resource')->getConnection('core_read');
         $filename = $tools->getValue('csvexport/file/name');
         $select = "SELECT count(*) FROM `" . TABLE_PREFIX . "catalog_product_entity`;";
         $art_number = $connection->fetchAll($select);
         $art_number = $art_number[0]['count(*)'];
         $interval = $tools->getValue('csvexport/step/interval');
         if ($interval == '' || $interval <= 0 || $art_number < $interval) {
             $interval = $art_number;
         }
         $part = 0;
         while ($part * $interval <= $art_number + $interval) {
             $export = new Idealo_Csvexport_Tools_Idealo($part * $interval, $interval, $part);
             $part++;
         }
         $base = substr(__FILE__, 0, -51);
         $create_file = new Idealo_Csvexport_Tools_CreateFile($base, $filename, MODULE_VERSION_TEXT);
     }
 }
 public function checkSettings()
 {
     $tools = new Idealo_Universal_Tools_IdealoTools();
     $file = $tools->getValue('csvexport/file/name');
     $seperator = $tools->getValue('csvexport/file/seperator');
     $not_set = array();
     if ($file == '') {
         $not_set[] = 'Please enter a feed name!';
     }
     if ($seperator == '') {
         $not_set[] = 'Please define a column dividing value!';
     } elseif (strlen($seperator) > 1) {
         $not_set[] = 'The column dividing value can only consist of one character!';
     }
     $idealo_shipping = new Idealo_Universal_Tools_IdealoShipping('csvexport');
     $shipping = $idealo_shipping->shipping;
     $shipping_active = false;
     foreach ($shipping as $ship) {
         if ($ship['active'] == '1') {
             $shipping_active = true;
             if ($ship['price'] == '') {
                 $not_set[] = $ship['db'];
             } else {
                 if ($ship['type'] == 'hard') {
                     if (!is_numeric($ship['price'])) {
                         $not_set[] = 'Wrong shipping costs format ' . $ship['title'] . '!';
                     }
                 } else {
                     $shippingCostsDE = explode(";", $ship['price']);
                     if (count($shippingCostsDE) <= 1) {
                         $not_set[] = 'Wrong shipping costs format for ' . $ship['title'] . '!';
                     } else {
                         foreach ($shippingCostsDE as $costs) {
                             $costs = explode(":", $costs);
                             if (count($costs) <= 1) {
                                 $not_set[] = 'Wrong shipping costs format ' . $ship['title'] . '!';
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     }
     if (!$shipping_active) {
         $not_set[] = 'Please activate shipping costs for at least one country!';
     }
     $idealo_payment = new Idealo_Universal_Tools_IdealoPayment('csvexport');
     $payment = $idealo_payment->payment;
     $payment_active = false;
     foreach ($payment as $pay) {
         if ($pay['active'] == '1') {
             $payment_active = true;
             break;
         }
     }
     if (!$payment_active) {
         $not_set[] = 'At least one payment method must be activated for each activated shipping country!';
     }
     if (count($not_set) > 0) {
         return $not_set;
     }
     return true;
 }