我實際上沒有編碼經驗,但是我發現我需要很多它來啓動一個站點並讓它執行我需要的事情。在網上搜索答案几個小時後,我想我應該把問題放在那裏。Shopify中的日期選擇器問題
我加入這個日期選擇器片段到我的網站:
{{ 'http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css' | stylesheet_tag }}
{{ '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js' | script_tag }}
<div style="width:300px; clear:both;">
<p>
<label for="date{{i}}">Delivery Date of {{ item.title }} (Please allow at least 2 days for delivery):</label>
<input id="date{{i}}" type="text" name="attributes[date{{i}}]" value="{{ cart.attributes.date }}" class="required" data-error="Please tell us which week you want your delivery for" />
<span style="display:block" class="instructions"> </span>
</p>
</div>
<script>
jQuery(function() {
jQuery("#date{{i}}").val("").datepicker({ minDate: 1,
beforeShowDay: noSunday
});
function noSunday(date){
var day = date.getDay();
return [(day > 0), ''];
};
});
</script>
我不能讓noWeekends工作。沒有星期天的作品。 請幫忙!
第二個問題,是我有買家使用日期選擇器爲每個產品選擇一個日期。所以我已經把datepicker放在了product.liquid上,並且工作正常。 但我會在退房時顯示購物車中每件物品的選定日期。 任何人都可以幫助我理解編碼嗎?
編輯了更多信息: 在我的cart.liquid中,我有以下代碼來顯示客戶在將產品添加到購物車之前添加到產品中的每種產品的一些自定義功能。 現在,我還讓他們在將產品添加到卡之前在產品頁面上添加日期。當我到達購物車時,下面的代碼正常工作,顯示所有自定義功能。一個問題是我不知道如何添加日期。最後,我還希望不讓客戶在沒有填寫每個可定製部分和每個產品的日期的情況下將東西添加到購物車中。有人可以幫助我瞭解如何編碼此功能?提前謝謝了。
{% for p in item.properties %}
{% unless p.last == blank %}
{{ p.first }}:
{% if p.last contains '/uploads/' %}
<a class="lightbox" href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
{% else %}
{{ p.last }}
{% endif %}
<br />
{% endunless %}
{% endfor %}
噢謝謝你,我設法讓日期選擇器工作! – Learner
所以現在我有以下幾點: – Learner