简体   繁体   English

jQuery / PHP混合和匹配电子商务功能

[英]jQuery/PHP Mix and match e-commerce functionality

I'm designing a shop and would like to incorporate sort of a "mix and match" functionality where customers can see which tops match with which bottoms and shoes. 我正在设计一家商店,并希望合并某种“混合搭配”功能,客户可以在其中看到哪些顶部与哪些底部和鞋子相匹配。 There'll be 3 levels and when a user finds the right mix/match then they click buy to add all items to a shopping cart. 共有3个级别,当用户找到合适的组合/匹配项时,他们单击“购买”将所有商品添加到购物车中。

I have drawn UI diagram to try to explain visually: 我已经绘制了UI图以尝试进行直观解释: 在此处输入图片说明

Anyone have an idea on how to do this functionality? 有人对如何执行此功能有想法吗? I'm guessing jQuery would do it, but it needs integration with a shopping cart of some sort. 我猜测jQuery可以做到,但是它需要与某种购物车集成。 Any help is greatly appreciated. 任何帮助是极大的赞赏。

Custom functionality. 自定义功能。 Needs the whole 9 yards. 需要整个9码。 Get the Shopping Cart installed. 安装购物车。 create a new table along side of it. 在其旁边创建一个新表。 Name the table 'levels' and in the table, give it 3 rows, 'id', 'sid', 'level'. 将表命名为“ levels”,并在表中为其分配3行,即“ id”,“ sid”,“ level”。 Depending on the shopping cart you use, you can declare certain values within the shopping_cart table under the column 'extra'. 根据您使用的购物车,您可以在shopping_cart表中的“额外”列下声明某些值。 Use static variables. 使用静态变量。 'Level1', 'Level2', 'Level3'. 'Level1','Level2','Level3'。 Then create a MySQL Trigger event. 然后创建一个MySQL触发事件。 Each time an item is added to the shopping cart list (from the back-end, items to be sold). 每次将商品添加到购物车列表中(从后端,待售商品)。 the Trigger will use the 'id' of that, insert it as the 'sid' in our new table of 'levels'. 触发器将使用该标识符的“ id”,并将其作为“ sid”插入新的“级别”表中。 The 'id' in our new table of 'levels' is the unqieu auto-incrementing value. 新的“级别”表中的“ id”是unqieu自动递增的值。 the 'sid' refers to the 'item id' that was in the original shopping cart table. “ sid”是指原始购物车表格中的“ item id”。 Now use PHP and jQuery. 现在使用PHP和jQuery。 PHP first to get the items from the database, select * from levels where level='Level1'. PHP首先从数据库中获取的项目,SELECT * FROM levels ,其中一级=“1级”。 This will get all items that should be 'level1', which in your case should be things like hats, scarfs, etc i would imagine. 这将获得所有应为“ level1”的项目,在您的情况下,应为我想象的帽子,围巾等。 Ensure you do the same for level2 and level 3. Of course create the HTML structure. 确保对级别2和级别3进行相同的操作。当然要创建HTML结构。 Three 'rows' built with 'position:relative' and width of :10000em. 三个“行”以“ position:relative”和宽度为:10000em构建。 Then each 'item' returned in PHP from our row request, something like: 然后,从我们的行请求中以PHP返回每个“项目”,例如:

echo '<ul>';
while($row = mysql_fetch_array($query)){ 
  echo '<li style"float:left;width:150px;height:85px;">'; 
} 
echo '</ul>';

You can use something like jQuery Tools slider to create this effect that you want per row. 您可以使用类似jQuery Tools滑块的工具来创建每行所需的效果。

http://jquerytools.org/demos/scrollable/index.html http://jquerytools.org/demos/scrollable/index.html

You would need to include custom javascript/jquery to determine the position and ensure that the 'element that should have focus' always has the same width, height, margin, and padding as the one above/below it. 您需要包括自定义javascript / jquery来确定位置,并确保“应具有焦点的元素”始终具有与其上方/下方相同的宽度,高度,边距和填充。 Also, add something like a custom class of 'active-level1-item' to each item that is in view, active-level2-item, active-level3-item, etc. 此外,向视图中的每个项目,active-level2-item,active-level3-item等添加自定义类“ active-level1-item”。

For each of the items in View, use something like AJAX to send the values over to your shopping cart. 对于View中的每个项目,请使用AJAX之类的值将值发送到购物车。 you'll have to do some research to get comfortable with it's documentation. 您必须进行一些研究才能熟悉它的文档。

something like. 就像是。

var Level1Item = $(".activelevel1item").val/text/html();
var Level2Item = $(".activelevel2item").val/text/html();
var Level3Item = $(".activelevel3item").val/text/html();
var levelString = 'level1='+Level1Item+'&level2='+Level2Item+'&level3='+Level3Item;

$.ajax({
  url: 'process_shopping_items.php',
  type: 'POST',
  data: levelString,
  success: function(data){
    //do stuff with returned values in our process_shopping_items.php file
  },
  error: function(err){
    //there was an error, alert the user of our error.
    alert(err);
  },
  complete: function(){
    //our ajax request has completed processing. We can perform all callbacks here.
  }
});

You didn't provide much information so I gave you the down and dirty. 您没有提供太多信息,所以我给您带来麻烦。 While refinements need to be based on the 'tools' you choose to achieve this result, this is definitely a good direction to start in. 尽管需要根据您选择的“工具”进行优化以实现此结果,但这绝对是一个很好的开始方向。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Flexstore或JQuery电子商务网站 - Flexstore or JQuery for e-commerce site 使用wordpress电子商务链接到jquery中的产品 - Linking to product in jquery using wordpress e-commerce 在Weebly电子商务产品页面上添加自定义jQuery - Adding custom jquery on a Weebly e-commerce product page jQuery是在电子商务站点中处理产品差异计算的可接受方法吗? - Is jQuery an acceptable method to process product variation calculations in an E-Commerce site? Laravel+Jquery电商项目中的Form Request数据没有通过Get方法传递给Controller - Form Request data not passing to Controller through Get method in Laravel+Jquery E-commerce project 在面向客户的电子商务应用程序中使用JavaScript格式化日期 - Formatting date with JavaScript in a customer fronting e-commerce application 如何在电子商务表格上要求最低数量? - How Can I require a Minimum Quantity on an e-commerce Form? 在电子商务购物车中使用$(“ form”)。serialize() - Using $(“form”).serialize() in E-Commerce Shopping Cart 如何获得将数据分配给div的样式的值? [MyShop电子商务] - How to get the value of a style that gives data to an div? [MyShop E-commerce] 从WP电子商务通知框中删除“继续购物”链接 - Remove 'Continue Shopping' link from WP e-commerce Notification Box
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM