【问题标题】:How to create Drag and drop product by category in Magento如何在 Magento 中按类别创建拖放产品
【发布时间】:2015-11-24 06:20:09
【问题描述】:

当我将产品的<li> 元素拖到第一个位置或任何其他位置然后刷新页面时,它会恢复到以前的位置

这是我编辑的文件: magento/app/design/frontend/base/default/template/catalog/product/list.phtml

我刚刚将 ul 从 <ul class="products-grid"> 更改为

<ul id="sortable" class="products-grid"> 

现在它工作了,但只有一个 &lt;ul&gt;

 <script>
  $(function() {
    $( "#sortable" ).sortable();
    $( "#sortable" ).disableSelection();
  });
  </script>

这是我获取代码的链接:

https://jqueryui.com/sortable/#connect-lists

【问题讨论】:

  • 开始实施并询问您在编码时遇到的问题.. 否则没有人可以帮助您。
  • 好的,巴巴克先生,谢谢!
  • 我将开始实施
  • 感谢 Babak T 先生编辑我的问题

标签: magento drag-and-drop categories


【解决方案1】:

您需要将列表的位置存储在某处,以防止刷新页面后回退到以前的位置..

通常人们将列表的顺序保存在列表来自的特定表的字段中。然后稍后当您想要选择需要按该 order_field 排序的行时。

由于您使用的是 Magento,除非您找到插件或库,否则创建此功能并非易事。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多