Вы не авторизованы.
Добрый вечер! Подскажите, будьте добры, почему у меня кнопка "Добавить в корзину" то открывает корзину в сплывающем окне с затемнением, то в этом же окне? Отчего зависит выбор кнопки понять не могу Вот shopping_cart
<script type="text/javascript" src="{$smarty.const.URL_JS}/JsHttpRequest.js"></script> <div id="blck-content"> <script type="text/javascript" src="{$smarty.const.URL_JS}/JsHttpRequest.js"></script> <table cellpadding="0" cellspacing="0" width="100%"> <tr> <td {if $PAGE_VIEW eq 'noframe'}class="background_cart_top"{/if} id="cart_page_title"> <h1>{$CurrentDivision.name|translate}</h1> {if $cart_content&&!$widget_view} <!-- <div> <a id="my_closeLink" href='{"?ukey=home&view=frame"|set_query_html}' target="_parent"> {lbl_goto_shopping} </a> </div> --> {/if} </td> {if $cart_content} <td {if $PAGE_VIEW eq 'noframe'}class="background_cart_top"{/if} id="cart_clear"><a href='{"?ukey=cart&view&clear_cart=yes"|set_query}'>{"cart_clear_cart"|translate}</a> </td> {/if} </tr> </table> <div {if $PAGE_VIEW eq 'noframe'}class="paddingblock"{/if}> {$MessageBlock} {* shopping cart *} {if $cart_content} {if $make_more_exact_cart_content} <p>{"cart_items_left_from_prev_session"|translate}</p> {/if} {if $cart_amount lt $smarty.const.CONF_MINIMAL_ORDER_AMOUNT & $cart_error_show eq 1 & !$MessageBlock} <div class='error_block'><span class="error_flag">{"cart_min_order_amount_not_reached"|translate} {$cart_min}</span></div> {/if} <form action="{'?ukey=cart&view'|set_query_html}" name="ShoppingCartForm" method="post" target="_self"> <input type="hidden" name="update" value="1" > <input type="hidden" name="shopping_cart" value="1" > <table id="cart_content_tbl" cellspacing="0"> <colgroup> <col width="10%" /> <col width="50%" /> <col width="15%" /> <col width="20%" /> <col width="5%" /> </colgroup> <tr id="cart_content_header"> <td></td> <td></td> <td align="center">{lbl_cart_product_quantity}</td> <td align="center">{lbl_cart_products_total}</td> <td></td> </tr> {assign var="ProductsNum" value=0} {section loop=$cart_content name=i} <tr class='row_{cycle values="odd,even"}'> <td align="center" valign="top" width="1%">{if $cart_content[i].thumbnail_url}<img src="{$cart_content[i].thumbnail_url|escape:'html'}" width="{$cart_content[i].thumbnail_width}" />{else} {/if}</td> <td> {if !$widget_view} {if $smarty.const.CONF_ENABLE_PRODUCT_SKU&&$cart_content[i].product_code}<i>{$cart_content[i].product_code}</i> {/if} <a href='{"?ukey=product&productID=`$cart_content[i].productID`&product_slug=`$cart_content[i].slug`"|set_query_html}' {if $PAGE_VIEW eq 'noframe'}class="gofromfade"{/if}>{$cart_content[i].name}</a> {else} {if $smarty.const.CONF_ENABLE_PRODUCT_SKU&&$cart_content[i].product_code}<i>{$cart_content[i].product_code}</i> {/if} {$cart_content[i].name} {/if} {if $cart_content[i].brief_description}<div class="cart_product_brief_description">{$cart_content[i].brief_description}</div>{/if} </td> <td align="center"> {assign var="ProductsNum" value=$ProductsNum+$cart_content[i].quantity} {if $session_items}{assign var=_prdid value=$session_items[i]} {else}{assign var=_prdid value=$cart_content[i].id} {/if} <input class="cart_product_quantity digit" type="text" maxlength="10" name="count_{$_prdid}" value="{$cart_content[i].quantity}" size="5" > {if $cart_content[i].min_order_amount} <div class="error_block"><span class="error_msg" style="font-size:smaller"> {"prdset_minimal_order_quantity"|translate} {$cart_content[i].min_order_amount} {"str_items"|translate} </span></div> {/if} </td> <td align="center" nowrap="nowrap"> {$cart_content[i].cost} </td> <td align="center"> <a href='{"?ukey=cart&view&remove=`$_prdid`"|set_query_html}' title='{"btn_delete"|transcape}'> <img src="{$smarty.const.URL_IMAGES}/remove.gif" alt='{"btn_delete"|transcape}' /> </a> </td> </tr> {/section} {if $cart_discount neq ''} <tr> <td colspan="3" class="cart_discount_label"> {"usr_custinfo_group_discount"|translate}, {$discount_percent|string_format:'%0.1f%%'} </td> <td align="center" nowrap="nowrap"> - <span id="discount_value">{$cart_discount}</span> </td> <td></td> </tr> {/if} {if $smarty.const.CONF_DSC_COUPONS_ENABLED eq 'Y'} <tr id="coupon_form" style="display: {if $current_coupon neq '0'}none{/if};"> <td colspan="3" class="cart_discount_label"> {"lbl_frnt_discount_coupon"|translate}: <input type="text" size="12" maxlength="10" name="discount_coupon_code" id="discount_coupon_code" value="" onBlur="onApplyButtonClick();" onkeypress="return noenter(event);" > <button type="button" onClick="onApplyButtonClick();" tabindex="1001">{"btn_apply"|translate}</button> </td> <td align="center"> <span id="wrong_coupon_lbl" style="color: #666666; font-size: 80%; display: none;">{"lbl_wrong_coupon"|translate}</span> <b id="processing_coupon_lbl" style="color: blue; display: none;">{"lbl_processing_coupon"|translate}</b> </td> </tr> <tr id="coupon_info" style="display: {if $current_coupon eq '0'}none{/if};"> <td colspan="3" class="cart_discount_label"> {"lbl_frnt_discount_coupon"|translate}: <b id="coupon_info_code">{$current_coupon}</b> <button type="button" onClick="onDeleteCouponClick();" tabindex="1002">{"btn_change"|translate}</button> </td> <td align="center"> - <span id="coupon_discount_value">{$coupon_discount}</span> </td> </tr> {/if} {if $cart_discount eq '' and $smarty.const.CONF_DSC_COUPONS_ENABLED eq 'N'} <tr style="height: 30px;"></tr> {/if} <tr> <td id="cart_total_label" colspan="2"> {"str_total"|translate} </td> <td align="center"> <input type="submit" name="recalculate" value='{"btn_recalculate"|transcape}' tabindex="1004" > </td> <td id="cart_total" align="center">{$cart_total}</td> <td></td> </tr> <tr> <td colspan="5" align="right" id="cart_checkout_btn"> <input type="submit" class="btn_checkout" name="checkout" value="{"str_checkout"|translate}" id="btn-checkout" type="submit" tabindex="1005" > <div> <a id="my_closeLink" href='{"?ukey=home&view=frame"|set_query_html}' target="_parent"> {lbl_goto_shopping} </a> </div> <!-- {if ($GoogleCheckout_CheckoutButton || $PPExpressCheckout_button || $VKontakteCheckout_button) && $PAGE_VIEW ne 'mobile'} Checkout replacement --> <!--<p>{lbl_cart_checkout_alternative}</p>--> <!-- {literal} hack for vkontakte--> <!--<style type="text/css"> #checkout_replacements td {padding: 0;} </style>--> <!-- {/literal} --> <!--<table id="checkout_replacements" style="padding: 0;"> <tr> <td valign="middle">{$GoogleCheckout_CheckoutButton|default:' '}</td> <td valign="middle">{$PPExpressCheckout_button|default:' '}</td> <td valign="middle">{$VKontakteCheckout_button|default:' '}</td> </tr> </table>--> <!-- {/if} --> </td> </tr> </table> </form> {else} <p style="text-align: center;">{"cart_cart_is_empty"|translate}</p> {/if} </div> </div> <script type="text/javascript" language="javascript"> {if $PAGE_VIEW eq 'noframe' && !$smarty.get.external} {* adjust cart window height *} {literal} function adjust_cart_window(){ var wndSize = getWindowSize(parent); var scr_h = wndSize[1] - 100; var wnd_h = getLayer('blck-content').offsetHeight + 85; parent.resizeFadeIFrame(null, Math.min(scr_h, wnd_h)); } {/literal} adjust_cart_window(); {if $ProductsNum} parent.document.getElementById('shpcrtgc').innerHTML="{$ProductsNum} {"srch_products_plural"|translate}"; parent.document.getElementById('shpcrtca').innerHTML='{$cart_total}'; {else} parent.document.getElementById('shpcrtgc').innerHTML="{"cart_content_empty"|translate}"; parent.document.getElementById('shpcrtca').innerHTML=" "; {/if} {/if} {if $jsgoto} document.getElementById('btn-checkout').disabled = true; if (!top)closeFadeIFrame(true); if (top)top.location = "{$jsgoto}"; else document.location.href = "{$jsgoto}"; {/if} {literal} function onApplyButtonClick() { var coupon_code = document.getElementById('discount_coupon_code').value; document.getElementById('wrong_coupon_lbl').style.display = 'none'; document.getElementById('processing_coupon_lbl').style.display = ''; document.forms['ShoppingCartForm'].recalculate.disabled = true; document.forms['ShoppingCartForm'].checkout.disabled = true; var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState != 4)return; document.getElementById('processing_coupon_lbl').style.display = 'none'; document.forms['ShoppingCartForm'].recalculate.disabled = false; document.forms['ShoppingCartForm'].checkout.disabled = false; if(req.responseJS.applied == 'N') { document.getElementById('wrong_coupon_lbl').style.display = ''; return; }; document.getElementById('coupon_form').style.display = 'none'; document.getElementById('coupon_info').style.display = ''; document.getElementById('coupon_info_code').innerHTML = coupon_code; document.getElementById('cart_total').innerHTML = req.responseJS.new_total_show_value; {/literal}{if $PAGE_VIEW eq 'noframe' && !$smarty.get.external}{literal} parent.document.getElementById('shpcrtca').innerHTML = req.responseJS.new_total_show_value; {/literal}{/if}{literal} if(req.responseJS.new_coupon_show != '') { document.getElementById('coupon_discount_value').innerHTML = req.responseJS.new_coupon_show; }; }; try { req.open(null, set_query('&ukey=cart&caller=1&initscript=ajaxservice'), true); req.send({'action': 'try_apply_discount_coupon', 'coupon_code': coupon_code}); } catch ( e ) { catchResult(e); } finally { ;} }; function onDeleteCouponClick() { var req = new JsHttpRequest(); req.onreadystatechange = function() { if (req.readyState != 4)return; document.getElementById('coupon_form').style.display = ''; document.getElementById('wrong_coupon_lbl').style.display = 'none'; document.getElementById('coupon_info').style.display = 'none'; document.getElementById('discount_coupon_code').value = document.getElementById('coupon_info_code').innerHTML; document.getElementById('cart_total').innerHTML = req.responseJS.new_total_show_value; {/literal}{if $PAGE_VIEW eq 'noframe' && !$smarty.get.external}{literal} parent.document.getElementById('shpcrtca').innerHTML = req.responseJS.new_total_show_value; {/literal}{/if}{literal} }; try { req.open(null, set_query('&ukey=cart&caller=1&initscript=ajaxservice'), true); req.send({'action': 'remove_doscount_coupon'}); } catch ( e ) { catchResult(e); } finally { ;} }; function noenter(event) { if(event.keyCode == 13) { document.getElementById('discount_coupon_code').blur(); return false; }; }; {/literal} </script>
Помогите, пожалуйста
Неактивен
Не успевают загрузиться яваскрипты, а кнопка уже нажата.
P.S. удалите лишнюю запись кстати
<script type="text/javascript" src="{$smarty.const.URL_JS}/JsHttpRequest.js"></script>
Неактивен
jekky25 написал:
Не успевают загрузиться яваскрипты, а кнопка уже нажата.
P.S. удалите лишнюю запись кстати
<script type="text/javascript" src="{$smarty.const.URL_JS}/JsHttpRequest.js"></script>
А как это поправить? Просто нужно, чтобы именно с затемнением получалось.
П.С. Лишнюю строчку убрала. Спасибо)
Неактивен
там срабатывает класс hndl_proceed_checkout . Работает через библиотеку behavior.js. Эта библиотека отделяет по сути html код от яваскрипта. Но пока она не загрузится и не загрузится обработчик класса в файле frame.js событие срабатывать не будет. Особо не вдавался в детали как это поменять (поскольку таких задач не поступало), но как вариант. Вместо класса повесить напрямую в ссылку корзины обработчик события onClick.
т.е. в файл shopping_cart_info.html в ссылку коризны добавить onClick="openFadeIFrame(ORIG_LANG_URL + set_query('?ukey=cart&view=noframe')); return false;"
ну или как вариант в этой же ссылке вместо href="{"?ukey=cart"|set_query}" поставить href="javascript://" тогда корзина в отдельной странице открываться не будет. Но ссылка не будет срабатывать, пока скрипты не загрузятся.
Неактивен
jekky25 написал:
там срабатывает класс hndl_proceed_checkout . Работает через библиотеку behavior.js. Эта библиотека отделяет по сути html код от яваскрипта. Но пока она не загрузится и не загрузится обработчик класса в файле frame.js событие срабатывать не будет. Особо не вдавался в детали как это поменять (поскольку таких задач не поступало), но как вариант. Вместо класса повесить напрямую в ссылку корзины обработчик события onClick.
т.е. в файл shopping_cart_info.html в ссылку коризны добавить onClick="openFadeIFrame(ORIG_LANG_URL + set_query('?ukey=cart&view=noframe')); return false;"
ну или как вариант в этой же ссылке вместо href="{"?ukey=cart"|set_query}" поставить href="javascript://" тогда корзина в отдельной странице открываться не будет. Но ссылка не будет срабатывать, пока скрипты не загрузятся.
Не работает почему-то. Может, я не правильно вставляла, но опять срабатывает то так, то сяк. Можете показать, как поправить, а то прям полтергейст какой-то
{if $smarty.const.CONF_SHOW_ADD2CART eq 1} {if $smarty.const.CONF_SHOPPING_CART_VIEW ne $smarty.const.SHCART_VIEW_PAGE} {assign var=checkout_class value="hndl_proceed_checkout"} {/if} <div class="shcart_link"><a class="{$checkout_class}" rel="nofollow" href="{"?ukey=cart"|set_query}">{"cart_title"|translate}</a></div> {if $shopping_cart_items} <div id="shpcrtgc">{$shopping_cart_items} {"cart_content_not_empty"|translate}</div> <div id="shpcrtca">{$shopping_cart_value_shown|replace:'"':'"'}</div> {literal} <script type="text/javascript"> <!-- var shopping_cart_info = getElementByClass('cpt_shopping_cart_info', document, 'div'); if(shopping_cart_info){shopping_cart_info.id='cart_not_empty';} //--> </script> {/literal} {else} <div id="shpcrtgc">{"cart_content_empty"|translate}</div> <div id="shpcrtca"> </div> {/if} {/if}
Неактивен
вот так попробуйте
{if $smarty.const.CONF_SHOW_ADD2CART eq 1} {if $smarty.const.CONF_SHOPPING_CART_VIEW ne $smarty.const.SHCART_VIEW_PAGE} {assign var=checkout_class value="hndl_proceed_checkout"} {/if} <div class="shcart_link"><a {*class="{$checkout_class}"*} rel="nofollow" href="{"?ukey=cart"|set_query}" onClick="openFadeIFrame(ORIG_LANG_URL + set_query('?ukey=cart&view=noframe')); return false;">{"cart_title"|translate}</a></div> {if $shopping_cart_items} <div id="shpcrtgc">{$shopping_cart_items} {"cart_content_not_empty"|translate}</div> <div id="shpcrtca">{$shopping_cart_value_shown|replace:'"':'"'}</div> {literal} <script type="text/javascript"> <!-- var shopping_cart_info = getElementByClass('cpt_shopping_cart_info', document, 'div'); if(shopping_cart_info){shopping_cart_info.id='cart_not_empty';} //--> </script> {/literal} {else} <div id="shpcrtgc">{"cart_content_empty"|translate}</div> <div id="shpcrtca"> </div> {/if} {/if}
Неактивен
jekky25 написал:
вот так попробуйте
Код:
{if $smarty.const.CONF_SHOW_ADD2CART eq 1} {if $smarty.const.CONF_SHOPPING_CART_VIEW ne $smarty.const.SHCART_VIEW_PAGE} {assign var=checkout_class value="hndl_proceed_checkout"} {/if} <div class="shcart_link"><a {*class="{$checkout_class}"*} rel="nofollow" href="{"?ukey=cart"|set_query}" onClick="openFadeIFrame(ORIG_LANG_URL + set_query('?ukey=cart&view=noframe')); return false;">{"cart_title"|translate}</a></div> {if $shopping_cart_items} <div id="shpcrtgc">{$shopping_cart_items} {"cart_content_not_empty"|translate}</div> <div id="shpcrtca">{$shopping_cart_value_shown|replace:'"':'"'}</div> {literal} <script type="text/javascript"> <!-- var shopping_cart_info = getElementByClass('cpt_shopping_cart_info', document, 'div'); if(shopping_cart_info){shopping_cart_info.id='cart_not_empty';} //--> </script> {/literal} {else} <div id="shpcrtgc">{"cart_content_empty"|translate}</div> <div id="shpcrtca"> </div> {/if} {/if}
Не помогает((( Еще и кнопка Купить в 1 клик стала просто корзину в этом же окне открывать
Неактивен
Точнее так, срабатывает из product_brief.html: ведет просто в корзину в этом же окне, а в product_add2cart_button.html просто нажимается кнопка и действия не происходит, как бы прощелкивается страница. Сейчас закомментировала "купить в 1 клик". Думаю, что это все одна беда, которую Вы обозначили
Неактивен
Так у вас доработки были. Сайт покажите.
Неактивен
jekky25 написал:
Так у вас доработки были. Сайт покажите.
www.loveni.ru , купить в 1 клик закомментировала пока, чтобы людей не смущать
Неактивен
Так у вас код в "моя корзина" добавлен. Он нормально срабатывает, когда нажимаете на корзину?
Неактивен
Вы про код Купить в 1 клик? Раньше срабатывало все отлично. Все началось после того, как я решила переделать "Вернуться к покупкам" из корзины, чтобы не выбрасывало на главную, а делало -1 шаг. Потом вернула все обратно (трогала shopping_cart.html, shopping_cart.php) и просто переименовала на "Вернуться на главную". Но началась эта канитель.
Может быть, что я еще что-то затрагивала, когда пыталась переделать, но не помню, вроде нет.
Неактивен
Нет я про кнопку МОЯ КОРЗИНА. При нажатии на нее должна открываться корзина во фрейме. Если скрипты не успели подгрузиться, то может открываться отдельной страницей. Соответственно, код, который я вам указал, там стоит, и сейчас эта кнопка открывает корзину во фрейме.
Неактивен
Сейчас при нажатии на кнопку Моя корзина она открывается то с затемнением (реже), то в этом же окне, но как при оформлении заказа, те без затемнения
Неактивен
Подозреваю, что ответ кроется в другом.
У вас при загрузке страницы скрипт buyme.js загружается до Jquery, но при этом он используется эту библиотеку... просто поместите его ниже и затестите.
http://joxi.ru/82Q4q3GfgGvWmd
Неактивен
wiggly написал:
Подозреваю, что ответ кроется в другом.
У вас при загрузке страницы скрипт buyme.js загружается до Jquery, но при этом он используется эту библиотеку... просто поместите его ниже и затестите.
http://joxi.ru/82Q4q3GfgGvWmd
Спасибо огромное, добрый человек Именно в этом была загвоздка
Неактивен