ShopCMS - 2 часть

шоп

И снова здрасти.
Столкнулся с такой задачей: Есть товар, к нему идёт описание\ инструкция\ прошивка(не важно вообщем), какой-то файл.Так как название файла может быть произвольным, к этому файлу нужно было краткое описание.Доработали cmsку всё заработало, описание выводит - всё хорошо, НО товары перестали добавляться.С чем это может быть связано?
Благодарю заранее.
Сам сталкивался с такого рода проблемой, оказалось лишнюю точку с запятой поставил при ковыряниях в движке... тут надо по коду который правили пройтись посмотреть что и как там изменили, зачастую может где-то что-то лишнее оставили или наоборот нехватает чего))
 
Изменения откатывал, по чутка всё добавлял и нашел ошибку именно в добавлении т.е.

Код:
function AddProduct(
                                $categoryID, $name, $Price, $description,
                                $in_stock,
                                $brief_description, $list_price,
                                $product_code, $sort_order,
                                $ProductIsProgram, $eproduct_filename, $eproduct_filedesc,
                                $eproduct_available_days, $eproduct_download_times,
                                $weight, $meta_description, $meta_keywords,
                                $free_shipping, $min_order_amount, $shipping_freight,
                                $classID, $title, $updateGCV = 1 )
{
        // special symbol prepare
        if ( $free_shipping )
                $free_shipping = 1;
        else
                $free_shipping = 0;

        if ( $classID == null ) $classID = "NULL";

        if ( $min_order_amount == 0 ) $min_order_amount = 1;

        if ( !$ProductIsProgram ) $eproduct_filename = "";

        if ( $eproduct_filename != "" )
        {
                if ( trim($_FILES[$eproduct_filename]["name"]) != ""  )
                {
                        if ( $_FILES[$eproduct_filename]["size"]!=0 )
                                        $r = move_uploaded_file($_FILES[$eproduct_filename]["tmp_name"],
                                                "files/".$_FILES[$eproduct_filename]["name"]);
                        $eproduct_filename = trim($_FILES[$eproduct_filename]["name"]);
                        SetRightsToUploadedFile( "files/".$eproduct_filename );
                }
        }

        if ( trim($name) == "" ) $name = "?";
        db_query("INSERT INTO ".PRODUCTS_TABLE.
                " ( categoryID, name, description,".
                "        customers_rating, Price, in_stock, ".
                "        customer_votes, items_sold, enabled, ".
                "        brief_description, list_price, ".
                "        product_code, sort_order, date_added, ".
                "         eproduct_filename, eproduct_filedesc, eproduct_available_days, ".
                "         eproduct_download_times, ".
                "        weight, meta_description, meta_keywords, ".
                "        free_shipping, min_order_amount, shipping_freight, classID, title ".
                " ) ".
                " VALUES (".
                                (int)$categoryID.",'".
                                xToText(trim($name))."','".
                                xEscSQL($description)."', ".
                                "0, '".
                                (double)$Price."', ".
                                (int)$in_stock.", ".
                                " 0, 0, 1, '".
                                xEscSQL($brief_description)."', '".
                                (double)$list_price."', '".
                                xToText(trim($product_code))."', ".
                                (int)$sort_order.", '".
                                xEscSQL(get_current_time())."',  '".
                                xEscSQL($eproduct_filename)."', ".
                                xEscSQL($eproduct_filedesc)."', ".
                                (int)$eproduct_available_days.", ".
                                (int)$eproduct_download_times.",  ".
                                (float)$weight.", ".
                                "'".xToText(trim($meta_description))."', ".
                                "'".xToText(trim($meta_keywords))."', ".
                                (int)$free_shipping.", ".
                                (int)$min_order_amount.", ".
                                (double)$shipping_freight.", ".
                                (int)$classID.", '".
                                xToText(trim($title))."' ".
                        ");" );
        $insert_id = db_insert_id();
        if ( $updateGCV == 1 && CONF_UPDATE_GCV == '1') update_psCount(1);
        return $insert_id;
}

и если везде убрать $eproduct_filedesc, то товар добавится, но без описания файла.Но самое интересное, при редактировании товара можно вписать описание и оно сохранится.Отсюда следует, что ошибка в INSERT.Мошь кто что заметил?Я уже 2ой день ковыряюсь(

Как вообще осуществляется добавление полей в админку.Мне это представляется так:
1)делаем хтмл на странице админки
2)создаём переменную в админ.пхп
3)вставляем её в select\insert\update
4)создаём поле в нужной таблице
5)присваиваем эту переменную константам смарти
6)выводим в шабло

Но почему №;%?* не работает?!
 
PHP:
 xEscSQL($eproduct_filename)."', ".
                                xEscSQL($eproduct_filedesc)."', ".
должно быть так
PHP:
 xEscSQL($eproduct_filename)."', '".
                                xEscSQL($eproduct_filedesc)."', ".
кавычки одинарной не хватает
 
zzallexx
я тебя обожаю!

antonio_86
ты был прав :p
 
замени этот код
HTML:
{if $smarty.const.CONF_PRODUCT_MAIL eq 1} <a name="inquiry"></a> {include file="header.tpl.html" header=$smarty.const.STRING_FEEDBACK_PRODUCT_HEADER}
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="cbt" align="left">{$smarty.const.STRING_FEEDBACK_PRODUCT_DESCRIPTION}</td>
        </tr>
      </table>
      {if $sent eq NULL}
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="hdbtop" align="left" valign="top"> {if $error ne NULL}
            <table cellspacing="0" cellpadding="0" width="100%">
              <tr>
                <td class="error cattop" align="center">{if $error eq 7}{$smarty.const.ERR_WRONG_CCODE}{else}{$smarty.const.FEEDBACK_ERROR_FILL_IN_FORM}{/if}</td>
              </tr>
            </table>
            {/if}
            <form name="form1post" id="form1post" method="post" action="index.php#inquiry">
              <table cellspacing="0" cellpadding="0" align="left">
                <tr>
                  <td align="left">{$smarty.const.FEEDBACK_CUSTOMER_NAME}</td>
                </tr>
                <tr>
                  <td style="height: 2px;"></td>
                </tr>
                <tr>
                  <td align="left"><input name="customer_name" type="text" style="width: 220px;" value="{$customer_name|replace:"\"":"&quot;"}"></td>
                </tr>
                <tr>
                  <td style="height: 6px;"></td>
                </tr>
                <tr>
                  <td align="left">{$smarty.const.CUSTOMER_EMAIL}</td>
                </tr>
                <tr>
                  <td style="height: 2px;"></td>
                </tr>
                <tr>
                  <td align="left"><input name="customer_email" type="text" style="width: 220px;" value="{$customer_email|replace:"\"":"&quot;"}"></td>
                </tr>
                <tr>
                  <td style="height: 6px;"></td>
                </tr>
                <tr>
                  <td align="left">{$smarty.const.STRING_FEEDBACK_PRODUCT_INQUIRY_EXPLANATION}</td>
                </tr>
                <tr>
                  <td style="height: 2px;"></td>
                </tr>
                <tr>
                  <td align="left"><input name="message_subject" type="hidden" value="{$product_info.name|replace:"\"":"&quot;"}">
                    <textarea name="message_text" style="width: 360px; height: 100px;">{$message_text|replace:"<":"&lt;"}</textarea>
                    <input type="hidden" name="request_information" value="yes">
                    <input type="hidden" name="productID" value="{$product_info.productID}"></td>
                </tr>
                {if $smarty.const.CONF_ENABLE_CONFIRMATION_CODE eq 1}
                <tr>
                  <td style="height: 6px;"></td>
                </tr>
                <tr>
                  <td align="left"><img src="index.php?do=captcha&amp;{php}echo session_name();{/php}={php}echo session_id();{/php}" alt="code"></td>
                </tr>
                <tr>
                  <td style="height: 2px;"></td>
                </tr>
                <tr>
                  <td align="left"><input name="fConfirmationCode" value="{$smarty.const.STR_ENTER_CCODE}" type="text" style="width: 220px; color: #aaaaaa;" onfocus="if(this.value=='{$smarty.const.STR_ENTER_CCODE}')
                        {literal}
                        {this.style.color='#000000';this.value='';}
                        {/literal}" onblur="if(this.value=='')
                        {literal}{{/literal}this.style.color='#aaaaaa';this.value='{$smarty.const.STR_ENTER_CCODE}'{literal}}{/literal}"></td>
                </tr>
                {/if}
              </table>
            </form></td>
        </tr>
      </table>
      <div class="fil"></div>
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="hdbot"><a href="#" onclick="document.getElementById('form1post').submit(); return false">{$smarty.const.OK_BUTTON3}</a></td>
        </tr>
      </table>
      {else}
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="oki cattop" align="center">{$smarty.const.FEEDBACK_SENT_SUCCESSFULLY}</td>
        </tr>
      </table>
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="hdbot">&nbsp;</td>
        </tr>
      </table>
      {/if}
      {/if}
на этот
HTML:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
	<script>
		!window.jQuery && document.write('<script src="jquery-1.4.3.min.js"><\/script>');
	</script>
	<script type="text/javascript" src="data/{$smarty.const.TPL}/fancybox/jquery.mousewheel-3.0.4.pack.js"></script>
	<script type="text/javascript" src="data/{$smarty.const.TPL}/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
	<link rel="stylesheet" type="text/css" href="data/{$smarty.const.TPL}/fancybox/jquery.fancybox-1.3.4.css" media="screen" />
{literal}
<script type="text/javascript">
		$(document).ready(function() {
				$("#various1").fancybox({
				'titlePosition'		: 'inside',
				'transitionIn'		: 'none',
				'transitionOut'		: 'none'
			});
		});
	</script>
	{/literal}
<a id="various1" href="#inline1">Вопрос по товару</a>
<div style="display: none;">
		<div id="inline1" style="width:500px;height:500px;overflow:auto;">
		{if $smarty.const.CONF_PRODUCT_MAIL eq 1} <a name="inquiry"></a> {include file="header.tpl.html" header=$smarty.const.STRING_FEEDBACK_PRODUCT_HEADER}
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="cbt" align="left">{$smarty.const.STRING_FEEDBACK_PRODUCT_DESCRIPTION}</td>
        </tr>
      </table>
      {if $sent eq NULL}
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="hdbtop" align="left" valign="top"> {if $error ne NULL}
            <table cellspacing="0" cellpadding="0" width="100%">
              <tr>
                <td class="error cattop" align="center">{if $error eq 7}{$smarty.const.ERR_WRONG_CCODE}{else}{$smarty.const.FEEDBACK_ERROR_FILL_IN_FORM}{/if}</td>
              </tr>
            </table>
            {/if}
            <form name="form1post" id="form1post" method="post" action="index.php#inquiry">
              <table cellspacing="0" cellpadding="0" align="left">
                <tr>
                  <td align="left">{$smarty.const.FEEDBACK_CUSTOMER_NAME}</td>
                </tr>
                <tr>
                  <td style="height: 2px;"></td>
                </tr>
                <tr>
                  <td align="left"><input name="customer_name" type="text" style="width: 220px;" value="{$customer_name|replace:"\"":"&quot;"}"></td>
                </tr>
                <tr>
                  <td style="height: 6px;"></td>
                </tr>
                <tr>
                  <td align="left">{$smarty.const.CUSTOMER_EMAIL}</td>
                </tr>
                <tr>
                  <td style="height: 2px;"></td>
                </tr>
                <tr>
                  <td align="left"><input name="customer_email" type="text" style="width: 220px;" value="{$customer_email|replace:"\"":"&quot;"}"></td>
                </tr>
                <tr>
                  <td style="height: 6px;"></td>
                </tr>
                <tr>
                  <td align="left">{$smarty.const.STRING_FEEDBACK_PRODUCT_INQUIRY_EXPLANATION}</td>
                </tr>
                <tr>
                  <td style="height: 2px;"></td>
                </tr>
                <tr>
                  <td align="left"><input name="message_subject" type="hidden" value="{$product_info.name|replace:"\"":"&quot;"}">
                    <textarea name="message_text" style="width: 360px; height: 100px;">{$message_text|replace:"<":"&lt;"}</textarea>
                    <input type="hidden" name="request_information" value="yes">
                    <input type="hidden" name="productID" value="{$product_info.productID}"></td>
                </tr>
                {if $smarty.const.CONF_ENABLE_CONFIRMATION_CODE eq 1}
                <tr>
                  <td style="height: 6px;"></td>
                </tr>
                <tr>
                  <td align="left"><img src="index.php?do=captcha&amp;{php}echo session_name();{/php}={php}echo session_id();{/php}" alt="code"></td>
                </tr>
                <tr>
                  <td style="height: 2px;"></td>
                </tr>
                <tr>
                  <td align="left"><input name="fConfirmationCode" value="{$smarty.const.STR_ENTER_CCODE}" type="text" style="width: 220px; color: #aaaaaa;" onfocus="if(this.value=='{$smarty.const.STR_ENTER_CCODE}')
                        {literal}
                        {this.style.color='#000000';this.value='';}
                        {/literal}" onblur="if(this.value=='')
                        {literal}{{/literal}this.style.color='#aaaaaa';this.value='{$smarty.const.STR_ENTER_CCODE}'{literal}}{/literal}"></td>
                </tr>
                {/if}
              </table>
            </form></td>
        </tr>
      </table>
      <div class="fil"></div>
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="hdbot"><a href="#" onclick="document.getElementById('form1post').submit(); return false">{$smarty.const.OK_BUTTON3}</a></td>
        </tr>
      </table>
      {else}
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="oki cattop" align="center">{$smarty.const.FEEDBACK_SENT_SUCCESSFULLY}</td>
        </tr>
      </table>
      <table cellspacing="0" cellpadding="0" width="100%">
        <tr>
          <td class="hdbot">&nbsp;</td>
        </tr>
      </table>
      {/if}
      {/if}
		</div>
	</div>
скачай этот архив *** скрытое содержание ***
положи папку fancybox в /data/default
наслаждайся...
воспользовался этой инструкцией, все работает красиво, но если при заполнении формы допустить ошибку ( к примеру, не заполнить обязательное поле или ввести неправильный код с капчи) - открывается просто страница с товаром без указания ошибки.
Что тут доделать чтоб описание ошибки выдавалось в самом модальном окне?
 
А кто-нибудь делал форму загрузки файлов на сервер?
Пробовал через пхп форму, задал экшен на файл со скрипом, но не получилось.
Пробовал как реализовано в цифровом товаре, там вообще не разобрался.
Т.е. суть в чем: Заходи в админку(не важно куда), жмём обзор, выбираем файл, и жмём кнопку загрузить, далее файл загружается в папку на сервере.
 
Редактирование оформленного заказа

Поделитесь у кого есть доработка для shopcms - редактирование оформленного заказа через админ панель

Добавлено через 4 минуты
Приветствую!
На сайте надо поставить shoutbox/мини чат без регистрации для возможности оставить отзыв покупателям, есть ли подобные готовые модули или какой скрипт сторонний, простой в установке и настройке!?
Посоветуйте пожалуйста!
Тоже самое интересует
 
ShopCMS OpenID

Кто-то видел в свободном доступе или вообще в природе дополнение к магазину этому "OpenID" или а-ля loginza по принципу работы?
Интересно было бы это реализовать.
 
Возвращаясь к теме о електронном продукте...
Можно ли добавить несколько електронных продуктов?Была мысль просто добавить ещё полей eproduct(2, 3 и т.д.), но тогда они будут ограничены, а если их больше?
 
Люди, поделитесь пожалуйста живой ссылкой в личку на нулл адекватный, если есть таковой, или рабочий генератор лицензий к 3.1.2.

Спасибо
 
Назад
Сверху