【发布时间】:2016-04-19 17:07:26
【问题描述】:
所以我正在尝试创建一个 Shopify 购买按钮,该按钮链接到特定日期的产品。我需要将选定的日期发送到产品句柄,然后让 shopify 按钮显示该产品,或者说该产品不存在。这是我所拥有的:
<html>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <head>
</head>
<body>
<div id="buttonId" data-embed_type="product" data-shop="maritix.myshopify.com" data-product_name="Ferry Riide" data-product_handle="ferry-riide" data-has_image="false" data-display_size="compact" data-redirect_to="cart" data-buy_button_text="Add to cart" data-buy_button_out_of_stock_text="Out of Stock" data-buy_button_product_unavailable_text="Unavailable" data-button_background_color="7fb466" data-button_text_color="ffffff" data-product_modal="false" data-product_title_color="000000" data-next_page_button_text="Next page">
</div>
<noscript><a href="https://maritix.myshopify.com/cart/17754591620:1" target="_blank">Buy Ferry Ride</a></noscript>
<form>
<p id="date"><input type="text" id="datepicker"></p>
</form>
</body>
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script type="text/javascript">
document.getElementById('ShopifyEmbedScript') || document.write('<script type="text/javascript" src="https://widgets.shopifyapps.com/assets/widgets/embed/client.js" id="ShopifyEmbedScript"><\/script>');
</script>
<script>
$(function() {
$( "#datepicker" ).datepicker();
var date = $("#date").text;
$("#buttonId").data-product_handle = date;
$("#buttonId").data-product_name = date;
});
</script>
</html>
对不起,如果这是一团糟,我在 javascript/html 中非常生疏。
【问题讨论】:
标签: jquery html datepicker shopify