如何在 Magento 中按类别创建拖放产品
How to create Drag and drop product by category in Magento
当我将产品的 <li>
元素拖到第一个位置或任何其他位置,然后刷新页面时,它会恢复到之前的位置
这是我编辑过的文件:
magento/app/design/frontend/base/default/template/catalog/product/list.phtml
我刚刚将 ul 从 <ul class="products-grid">
更改为
<ul id="sortable" class="products-grid">
现在可以使用了,但只有一个 <ul>
<script>
$(function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
});
</script>
这是我从中获取代码的 link:
您需要将列表的位置存储在某处,以防止刷新页面后回退到之前的位置..
通常人们将列表的顺序保存在列表来源的特定 table 的字段中。然后稍后当您想要 SELECT 行时,您将需要 ORDER BY that order_field.
由于您使用的是 Magento,因此创建此功能并非易事,除非您找到插件或库。
当我将产品的 <li>
元素拖到第一个位置或任何其他位置,然后刷新页面时,它会恢复到之前的位置
这是我编辑过的文件: magento/app/design/frontend/base/default/template/catalog/product/list.phtml
我刚刚将 ul 从 <ul class="products-grid">
更改为
<ul id="sortable" class="products-grid">
现在可以使用了,但只有一个 <ul>
<script>
$(function() {
$( "#sortable" ).sortable();
$( "#sortable" ).disableSelection();
});
</script>
这是我从中获取代码的 link:
您需要将列表的位置存储在某处,以防止刷新页面后回退到之前的位置..
通常人们将列表的顺序保存在列表来源的特定 table 的字段中。然后稍后当您想要 SELECT 行时,您将需要 ORDER BY that order_field.
由于您使用的是 Magento,因此创建此功能并非易事,除非您找到插件或库。