Witam,
mam problem z wystawianiem aukcji poprzez sklep przy wystawianiu mam taki komunikat :
Warunki oferty (zwroty, reklamacje) są wymagane dla kont firma doNewAuctionExt - After sales service conditions (return policies, implied warranties) are required by company account.
Kod błędu: ERR_AFTER_SALES_SERVICE_CONDITIONS_REQUIRED_BY_COMPANY
OK
wiecie może jak to można naprawić dzięki za pomoc
poniżej kod php:
<?php
$al_data = '';
if ( !empty($_GET['al_data']) ) $al_data = $_GET['al_data'];
if ( !empty($_POST['al_data']) ) $al_data = $_POST['al_data'];
$al_data = json_decode($al_data, true); // before global filters, there is raw json strings some times
include('admin.php');
if( function_exists('abo_module_allegro_check') )
abo_module_allegro_check();
$function = ($s->POST('al_function') !== null) ? $s->POST('al_function') : $s->GET('al_function');
// Remove empty values of fids because in JS it is not checking. Only for many auctions (bulk)
if ( !empty($al_data) && isset($al_data['cats_data']) )
foreach($al_data['cats_data'] as $cid => $data)
foreach($data as $k => $arr)
if ( isset($arr['id']) && isset($arr['value']) && empty($arr['value']) && $arr['value'] !== '0' && $arr['value'] !== "0" && $arr['value'] !== 0 )
unset($al_data['cats_data'][$cid][$k]);
if ( strlen($s->conf->allegro_accounts) < 5 )
$s->tpl->display_ajax(array('faultcode' => 'NO API KEY', 'faultstring' => $s->tpl->L_ALLEGRO_ERROR_NO_KEY));
include_once('./admin_inc/allegro.php');
if ( in_array($function, array('doNewAuctionExt', 'doCheckNewAuctionExt')) )
{
if ( defined('SHOP_ABO') )
{
include_once(DIR_PATH.'abo_functions.php');
abo_allegro_check($al_data);
}
$al_data = array_merge( $al_data, allegroKazqAutosettingsToAllegroInputConverter( json_decode($s->POST('config')) ) );
$result = allegro_new_auction($al_data, $function, true);
if ( $function == 'doNewAuctionExt' && !empty($result['itemUrl']) )
insert_log(0, 'admin_panel', $result['itemId'], 'NEW_AUCTION', (($result['itemInfo'] && $result['itemInfo'] != '-') ? '['.isset($result['itemInfo']) ? $result['itemInfo'] : ''.'] ' : '').$result['itemUrl'], 'ALLEGRO');
$result['previewHtml'] = previewAuctionHtml($al_data);
$s->tpl->display_ajax($result);
}
if ( $function == 'doNewAuctionExtBulk' )
{
if ( empty($al_data['ids']) )
{
die('Empty "ids" param');
}
$result = $s->db->sql_query("INSERT INTO sshop_queue (q_type, q_data, q_method, q_start, q_limit, q_cnt_total, q_date, q_lang_string, q_sql)
VALUES ('allegro', '', 'query', 0, 10, ".count($al_data['ids']).", '".CUR_DATETIME."', 'allegro_new_auction', '".m(implode(', ', $al_data['ids']))."')");
if ( !$s->conf->queue_crontab_id )
queue_check_set_last_conf_crontab_id();
insert_log(0, 'admin_panel', 0, 'ALLEGRO_NEW_AUCTIONS', 'Items: '.implode(', ', $al_data['ids']), 'ALLEGRO');
$s->tpl->display_ajax(array('success' => true));
exit;
}
if ( $function == 'doFreshAuctionExtBulk' )
{
$al_data = array_merge( $al_data, allegroKazqAutosettingsToAllegroInputConverter( json_decode($s->POST('config')) ) );
$result = allegro_new_freshauctions($al_data);
$s->tpl->display_ajax($result);
exit;
}
if( $function == 'massEdit' )
{
$items_changed = 0;
$data = array();
$result = false;
switch( $s->GET('sub') )
{
case 'closeAuction':
$prodId = explode(',', $s->POST('prodId'));
include(DIR_PATH . 'inc/functions_queue.php');
$changed = allegro_close_auctions_check($prodId);
if( is_array($changed) )
{
$items_changed = $changed['changed'];
$data['total'] = $changed['total'];
}
$result = true;
break;
case 'price':
case 'amount':
global $allegroModule;
$field = 'alle_' . $s->GET('sub');
$ids = sql_arr_intval($s->POST('ids'));
$value = strfloat($s->POST('value'));
$operator = preg_replace('/\x{00f7}/u', '/', $s->POST('operator'));
if( $value > 0 )
{
$q = allegro_ids_to_change_in_queue($s->GET('sub'));
$where = '';
if( $s->GET('sub') == 'price' )
$where = ' and alle_offers < 1';
$sql = "SELECT count(1) as total FROM sshop_products_allegro
WHERE alle_prod_id IN({$ids})
AND alle_to_date > '" . CUR_DATETIME . "'";
$res = $s->db->sql_query($sql);
$row = $s->db->sql_fetch($res);
$total = $row['total'];
$rows = array();
$sql = "select *
from sshop_products_allegro
where alle_prod_id IN({$ids})
and alle_to_date > '" . CUR_DATETIME . "'" . $where;
$res = $s->db->sql_query($sql);
while( $row = $s->db->sql_fetch($res) )
{
$alle_id = (string) $row['alle_id'];
if( !isset($q[$alle_id]) )
{
if( !$allegroModule->item()->canChangeField($row, $s->GET('sub'), $operator, $value) )
continue;
$rows[] = $alle_id;
}
}
unset($q);
if( !empty($rows) )
{
$arr = array('type' => $s->GET('sub'));
foreach($rows as $id)
$arr['value'][$id] = array('o' => $operator, 'v' => $value);
//add new queue
allegro_change_to_queue($arr, true);
$data['queue'] = count($rows);
$data['total'] = $total;
}
}
$result = true;
break;
}
$data['success'] = $result;
$data['items_changed'] = $items_changed;
$s->tpl->display_ajax($data);
}
elseif($function == 'allegro_import')
{
$data = array('success'=>true);
if( $s->conf->allegro_country == 228 )
{
$test_mode_location = array($s->tpl->L_CONFIG,$s->tpl->L_INTEGRATION,$s->tpl->L_ALLEGRO,$s->tpl->L_CONFIG,$s->tpl->L_TEST_MODE);
$data['faultcode'] = 'ALLEGRO_IMPORT_TEST_MODE'; // test mode, so no update!
$data['faultstring'] = str_replace('[ALLEGRO_TEST_MODE_LOCATION]', implode(' » ', $test_mode_location), $s->tpl->{"L_".$data['faultcode']});
$s->tpl->display_ajax($data);
}
$login = m($s->POST('login'));
$accounts = json_decode($s->conf->allegro_accounts, 1);
$login_ok = false;
foreach($accounts as $acc)
{
if($acc['login'] == $login)
{
$login_ok = true;
break;
}
}
if($login_ok)
{
$sql = "SELECT q_id FROM sshop_queue WHERE q_type = 'wholesales'
AND q_data='allegro' AND q_sql = '".$login."' limit 1";
$res = $s->db->sql_query($sql);
$row = $s->db->sql_fetch($res);
if( empty($row) )
{
$allegro_login = allegro_query('doGetMySellItems', array('pageSize' =>1, 'pageNumber' => 0), $login);
if( !empty($allegro_login['faultcode']) )
{
$data=array_merge($allegro_login, $data);
$s->tpl->display_ajax($data);
}
else if( empty($allegro_login['sellItemsCounter']) )
{
$data['faultcode'] = 'ALLEGRO_NO_PRODUCTS'; // 0 products, so no update!
$data['faultstring'] = $s->tpl->{"L_".$data['faultcode']};
$s->tpl->display_ajax($data);
}
$arr = array(
'q_type' => "'wholesales'",
'q_data' => "'allegro'",
'q_start' => 0,
'q_limit' => 1,
'q_cnt_total' => -1,
'q_date' => "NOW()",
'q_sql' => "'".$login."'", // exception for Allegro
'q_lang_string' => "'wholesale_import'",
'q_manual' => "'no'",
);
$s->db->sql_query("START TRANSACTION");
$sql = "INSERT INTO sshop_queue ". $s->db->array_to_sql_insert($arr);
$res = $s->db->sql_query($sql);
if( $s->db->sql_affectedrows() )
{
if ( !$s->conf->queue_crontab_id )
queue_check_set_last_conf_crontab_id();
$s->db->sql_query("UPDATE sshop_wholesales SET login = '".$login."' WHERE id = 'allegro'");
$s->db->sql_query("COMMIT");
}
}
else
{
$data['faultcode'] = 'QUEUE_EXISTS'; // queue exists for this login
$data['faultstring'] = $s->tpl->{"L_".$data['faultcode']};
}
}
else
{
$data['faultcode'] = 'ERROR_LOGIN';
$data['faultstring'] = $s->tpl->{"L_".$data['faultcode']}; // wrong login
}
$s->tpl->display_ajax($data);
}
elseif( $function == 'relations' )
{
$rel = array();
$result = $s->db->sql_query("SELECT cat_id, cat_alle_rel
FROM sshop_categories
WHERE cat_alle_rel IS NOT NULL
AND cat_alle_rel <> 0");
while( $row = $s->db->sql_fetch($result) )
{
if( !isset($rel[$row['cat_alle_rel']]) )
$rel[$row['cat_alle_rel']] = array();
$rel[$row['cat_alle_rel']][] = (int)$row['cat_id'];
}
$s->tpl->display_ajax(array('success' => true, 'data' => (object)$rel));
}
if ( $function == 'getAllegroPayments' )
{
$query = "SELECT alle_payments, alle_shipments, alle_bank, alle_bank2, alle_abroad, alle_pay_other FROM sshop_products_allegro ORDER BY alle_from_date DESC LIMIT 1";
$result = $s->db->sql_query($query);
while($row = $s->db->sql_fetch($result, 'object')) {
$data = $row;
}
if($result && !empty($data)) {
$data = array(
'success' => true,
'data' => $data
);
} else {
$data = array('success' => false);
}
$s->tpl->display_ajax($data);
exit;
}
/* cenniki dostaw allegro
@TAGS @cennikdostaw.begin */
/* zwraca zapisane ustawienia formularza cennikow dostaw allegro - lista
@TAGS: @cennikdostaw.get @allegro */
if ( $function == 'getPaymentPanelFormSavedConfigurations' ) {
$query = "select * from `sshop_config_add` where `name` like 'allegro_paymentPanelFormSavedSettings_%'";
$result = $s->db->sql_query( $query );
$rdata = array();
while ( $row = $s->db->sql_fetch( $result ) ) {
$rdata[] = json_decode($row['value']);
}
$data = array('success'=>true,'data'=>$rdata);
$s->tpl->display_ajax($data);
exit;
}
/* zapisuje ustawienia cennikow allegro. Nazwa moze sie dublowac. Id jest kluczem w bazie dopisywanym jako postfix w kolumnie 'name'
@TAGS: @cennikdostaw.add @allegro */
if ( $function == 'setPaymentPanelFormConfiguration' ) {
function kazq_rebuild( $obj, $keys ) {
$nobj = array();
foreach ( $keys as $key )
if ( isset($obj->$key) )
$nobj[$key] = $obj->$key;
return (object)$nobj;
}
$config = $s->POST('config');
$config = json_decode($config);
if ( !$config ) {
$s->tpl->display_ajax(array('success'=>false,'error'=>'nie podanokonfiguracji'));
exit;
}
switch ( $config->windowMode ) {
case 'select':
$ids = $s->POST('ids');
switch ( $config->writeMode ) {
case 1:
$config = kazq_rebuild( $config, array('id','config') );
$dbconfig = $s->db->mysqli_escape(json_encode($config));
$query = "update `sshop_products` set `prod_allegro_default_pricelist` = '$dbconfig' where `prod_id` in ($ids)";
$s->db->sql_query($query);
break;
case 0:
$config = kazq_rebuild( $config, array('id','config') );
$dbconfig = '@'.$config->id;
$query = "update `sshop_products` set `prod_allegro_default_pricelist` = '$dbconfig' where `prod_id` in ($ids)";
$s->db->sql_query($query);
break;
}
break;
case 'create':
$config->id = '';
for ( $i = 0; $i < 12; ++$i )
$config->id .= dechex(mt_rand(0,15));
$config = kazq_rebuild( $config, array('id','name','config') );
$DBKeyName = $s->db->mysqli_escape('allegro_paymentPanelFormSavedSettings_'.$config->id);
$dbconfig = $s->db->mysqli_escape(json_encode($config));
$query = "insert into sshop_config_add values ( '{$DBKeyName}', '{$dbconfig}' ) on duplicate key update `value`='{$dbconfig}'";
$s->db->sql_query($query);
break;
case 'edit':
$config = kazq_rebuild( $config, array('id','name','config') );
$DBKeyName = $s->db->mysqli_escape('allegro_paymentPanelFormSavedSettings_'.$config->id);
$dbconfig = $s->db->mysqli_escape(json_encode($config));
$query = "insert into sshop_config_add values ( '{$DBKeyName}', '{$dbconfig}' ) on duplicate key update `value`='{$dbconfig}'";
$s->db->sql_query($query);
break;
}
$s->tpl->display_ajax(array('success'=>true));
exit;
}
/* usuwa cennik dostaw allegro
@TAGS: @cennikdostaw.delete @allegro */
if ( $function == 'deletePaymentPanelFormConfiguration' ) {
$id = $s->GET('id');
if ( $id && strlen($id) > 4 ) {
$idf = $s->db->mysqli_escape('allegro_paymentPanelFormSavedSettings_'.$id);
$query = "delete from sshop_config_add where `name` = '{$idf}'";
$s->db->sql_query($query);
$query = "update sshop_products set prod_allegro_default_pricelist = NULL where `prod_allegro_default_pricelist` = '@{$id}'";
$s->db->sql_query($query);
$s->tpl->display_ajax(array('success'=>true));
}
$s->tpl->display_ajax(array('success'=>false));
}
/* pobiera cennik dla produktu
@TAGS: @cennikdostaw.product @allegro */
if ( $function == 'getPaymentPanelFormConfigurationForProduct' ) {
$id = $s->POST('prod_id');
if ( $id && strlen($id) > 1 ) {
$settings = array('writeMode'=>1);
$id = $s->db->mysqli_escape($id);
$query = "select `prod_allegro_default_pricelist` from `sshop_products` where `prod_id` = '{$id}'";
$result = $s->db->sql_query( $query );
$rdata = array();
$row = $s->db->sql_fetch( $result );
if ( $row['prod_allegro_default_pricelist'][0] == '@' ) {
$id = substr($row['prod_allegro_default_pricelist'],1,1000);
$id = $s->db->mysqli_escape('allegro_paymentPanelFormSavedSettings_'.$id);
$query = "select `value` as `prod_allegro_default_pricelist` from `sshop_config_add` where `name` = '{$id}' limit 1";
$result = $s->db->sql_query( $query );
$row = $s->db->sql_fetch( $result );
$settings['writeMode'] = 0;
}
$rdata = json_decode($row['prod_allegro_default_pricelist']);
if ( !is_object($rdata) )
$rdata = (object)array('writeMode'=>0);
else
$rdata->writeMode = $settings['writeMode'];
$data = array('success'=>true,'data'=>$rdata);
$s->tpl->display_ajax($data);
}
$s->tpl->display_ajax(array('success'=>false));
}
if ( $function == 'checkForEmptyAllegroPriceList' ) {
$ids = $s->db->mysqli_escape($s->POST('ids'));
$query = "select `prod_id` from `sshop_products` where `prod_id` in ($ids) and (char_length(`prod_allegro_default_pricelist`) < 10 or `prod_allegro_default_pricelist` is NULL)";
$result = $s->db->sql_query( $query );
$rdata = array();
while ( $row = $s->db->sql_fetch( $result ) ) {
$rdata[] = $row['prod_id'];
}
$data = array('ids'=>$rdata,'bad_ids'=>count($rdata));
$s->tpl->display_ajax(array('success'=>true,'data'=>$data));
}
/* koniec cenikow dostaw allegro
@TAGS @cennikdostaw.end */
$result = allegro_query($function, $al_data);
if ( $function == 'doGetCatsDataLimit' && isset($result['catsList']) && is_array($result['catsList']) )
{
foreach($result['catsList'] as $k => $v)
{
$result['catsList'][$k]['id'] = $result['catsList'][$k]['catId'];
$result['catsList'][$k]['n'] = $result['catsList'][$k]['catName'];
$result['catsList'][$k]['pa'] = $result['catsList'][$k]['catParent'];
$result['catsList'][$k]['po'] = $result['catsList'][$k]['catPosition'];
unset($result['catsList'][$k]['catIsProductCatalogueEnabled'], $result['catsList'][$k]['catId'], $result['catsList'][$k]['catName'], $result['catsList'][$k]['catParent'], $result['catsList'][$k]['catPosition']);
}
}
if ( $function == 'doGetSellFormFieldsForCategory' )
{
usort($result['sellFormFieldsForCategory']['sellFormFieldsList'], function($a, $b) {
return strcasecmp($a['sellFormTitle'], $b['sellFormTitle']);
});
}
if ( !AJAX )
p($result, 1);
$s->tpl->display_ajax($result);
?>