/** * Inicjacja nowej aukcji * * @return boolean */ public function createNewAuction() { // sprawdzenie dostepnej ilosci $query = 'SELECT quantity FROM ' . _DB_PREFIX_ . 'product where id_product = ' . Tools::getValue('id_product') . ' LIMIT 1;'; $result = Db::getInstance()->ExecuteS($query); if (!$this->auctionValidation($result[0]['quantity'])) { return false; } $fields = array(); $field = array(); $field['fvalue-string'] = ''; $field['fvalue-int'] = 0; $field['fvalue-float'] = 0; $field['fvalue-image'] = ''; $field['fvalue-datetime'] = 0; $field['fvalue-date'] = ''; $field['fvalue-range-int'] = array('fvalue-range-int-min' => 0, 'fvalue-range-int-max' => 0); $field['fvalue-range-float'] = array('fvalue-range-float-min' => 0, 'fvalue-range-float-max' => 0); $field['fvalue-range-date'] = array('fvalue-range-date-min' => '', 'fvalue-range-date-max' => ''); // tytul - string $f = $field; $f['fid'] = 1; $f['fvalue-string'] = Tools::getValue('fid_1'); $fields[1] = $f; $title = Tools::getValue('fid_1'); // kategoria - int $cat_id = Tools::getValue('fid_2'); $f = $field; $f['fid'] = 2; $f['fvalue-int'] = $cat_id; $fields[2] = $f; // czas trwania $f = $field; $f['fid'] = 4; $f['fvalue-int'] = Tools::getValue('fid_4'); $fields[4] = $f; // liczba sztuk $f = $field; $f['fid'] = 5; $f['fvalue-int'] = Tools::getValue('fid_5'); $fields[5] = $f; // cena kup teraz $f = $field; $f['fid'] = 8; $f['fvalue-float'] = Tools::getValue('fid_8'); $fields[8] = $f; // kraj $f = $field; $f['fid'] = 9; $f['fvalue-int'] = Tools::getValue('fid_9'); $fields[9] = $f; // woj $f = $field; $f['fid'] = 10; $f['fvalue-int'] = Tools::getValue('fid_10'); $fields[10] = $f; // miejscowosc $f = $field; $f['fid'] = 11; $f['fvalue-string'] = Tools::getValue('fid_11'); $fields[11] = $f; // transport $f = $field; $f['fid'] = 12; $f['fvalue-int'] = Tools::getValue('fid_12'); $fields[12] = $f; // forma platnosci $f = $field; $f['fid'] = 14; $f['fvalue-int'] = Tools::getValue('fid_14'); $fields[14] = $f; // zdjecie $di = Tools::getValue('prod_image'); if ($di == 1) { $image = $this->getProductImage(Tools::getValue('id_product')); } else { // uploaded image $image = file_get_contents($_FILES["fid_16"]["tmp_name"]); } if ($image) { $f = $field; $f['fid'] = 16; $f['fvalue-image'] = $image; $fields[16] = $f; } // opis if ($this->atemplate != '') { $content = preg_replace('/\\{\\{allegro\\}\\}/', Tools::getValue('fid_24'), $this->atemplate); } else { $content = '<div style="padding: 5px 10px;"' . Tools::getValue('fid_24') . '</div>'; } $content = $this->parseAuctionContent($content); $f = $field; $f['fid'] = 24; $f['fvalue-string'] = $content; $fields[24] = $f; // sztuki/pary $f = $field; $f['fid'] = 28; $f['fvalue-int'] = Tools::getValue('fid_28'); $fields[28] = $f; // rodzaj aukcji $f = $field; $f['fid'] = 29; $f['fvalue-int'] = Tools::getValue('fid_29'); $fields[29] = $f; // kod pocztowy $f = $field; $f['fid'] = 32; $f['fvalue-string'] = Tools::getValue('fid_32'); $fields[32] = $f; // auto wznawianie $f = $field; $f['fid'] = 30; $f['fvalue-string'] = Tools::getValue('fid_30'); $fields[30] = $f; // wysylka w ciagu $f = $field; $f['fid'] = 340; $f['fvalue-string'] = Tools::getValue('fid_340'); $fields[340] = $f; // wysylka free $f = $field; $f['fid'] = 35; $f['fvalue-int'] = Tools::getValue('fid_35'); $fields[35] = $f; // wysylka poczta eko if (Tools::getValue('fid_36')) { $f = $field; $f['fid'] = 36; $f['fvalue-float'] = Tools::getValue('fid_36'); $fields[36] = $f; } if (Tools::getValue('fid_37')) { $f = $field; $f['fid'] = 37; $f['fvalue-float'] = Tools::getValue('fid_37'); $fields[37] = $f; } // wysylka poczta prior if (Tools::getValue('fid_38')) { $f = $field; $f['fid'] = 38; $f['fvalue-float'] = Tools::getValue('fid_38'); $fields[38] = $f; } // wysylka pobranie if (Tools::getValue('fid_39')) { $f = $field; $f['fid'] = 39; $f['fvalue-float'] = Tools::getValue('fid_39'); $fields[39] = $f; } // kurier if (Tools::getValue('fid_40')) { $f = $field; $f['fid'] = 40; $f['fvalue-float'] = Tools::getValue('fid_40'); $fields[40] = $f; } if (Tools::getValue('fid_41')) { $f = $field; $f['fid'] = 41; $f['fvalue-float'] = Tools::getValue('fid_41'); $fields[41] = $f; } if (Tools::getValue('fid_42')) { $f = $field; $f['fid'] = 42; $f['fvalue-float'] = Tools::getValue('fid_42'); $fields[42] = $f; } if (Tools::getValue('fid_43')) { $f = $field; $f['fid'] = 43; $f['fvalue-float'] = Tools::getValue('fid_43'); $fields[43] = $f; } if (Tools::getValue('fid_44')) { $f = $field; $f['fid'] = 44; $f['fvalue-float'] = Tools::getValue('fid_44'); $fields[44] = $f; } if (Tools::getValue('fid_45')) { $f = $field; $f['fid'] = 45; $f['fvalue-float'] = Tools::getValue('fid_45'); $fields[45] = $f; } // sprawdzenie czy wybrana kategoria wymaga parametru stanu //$cat_query = 'SELECT * FROM ' . _DB_PREFIX_ . 'allegro_field where `sell-form-title` = "Stan" and `sell-form-cat` = ' . $cat_id . ';'; //$cat_data = Db::getInstance()->ExecuteS($cat_query); $jb = new Jb(); $cat_data = $jb->getStateSelectForCategory($cat_id); if ($cat_data) { $state = $cat_data; $state_fid = $state['sell-form-id']; $state_val = Tools::getValue('fid_' . $state_fid); $f = $field; $f['fid'] = $state_fid; $f['fvalue-int'] = $state_val; $fields['stan'] = $f; } try { $ret = $this->allegro->newAuctionExt($fields); if (isset($ret['item-id'])) { $this->storeAuctionHistory($ret, $title, Tools::getValue('id_product')); } return true; } catch (SoapFault $fault) { $this->webapierror = $fault->faultstring; $this->error = true; return false; } }
<?php require_once 'Jb.class.php'; include_once dirname(__FILE__) . '/../../classes/MySQL.php'; $jb = new Jb(); if (@$_POST['getsubcategory']) { $level = $_POST['level']; $level++; $cat = $jb->getCategories($_POST['getsubcategory']); $html = '<span level="' . $level . '" class="levels level_' . $level . '"><select id="select_category_' . $_POST['getsubcategory'] . '"> ' . $jb->buildCategoriesHtml($cat) . ' </select> <script type="text/javascript"> $(document).ready(function(){ $("#select_category_' . $_POST['getsubcategory'] . '").live("change", function(event){ if ($(this).val() != "") { $("#category").val($(this).val()); loadProductStateSelect($(this).val()); $.ajax({ url: \'/modules/jballegro/ajax.php\', data: \'&level=' . $level . '&getsubcategory=\' + $(this).val(), type: "POST", success: function(data) { $(".levels").each(function(index) { if($(this).attr("level")>' . $level . ') $(this).remove(); }); $(\'#categories_select\').append(data); } }); }
<?php require_once 'Jb.class.php'; include_once dirname(__FILE__) . '/../../classes/MySQL.php'; $jb = new Jb(); if (isset($_GET['checkallegro'])) { echo json_encode($jb->checkByAllegro()); } else { if (isset($_GET['checkaqty'])) { echo json_encode($jb->checkByQuantity()); } else { echo 'Brak parametrów'; } }