Dcat Admin SKU扩展增强版

Overview

Dcat Admin SKU扩展增强版

首先感谢前人的肩膀:https://github.com/lty5240/dcat-easy-sku

以及前人的前人的肩膀:https://github.com/jade-kun/sku

因改动太大,故没有往前面两位大佬的仓库中PR。

如果感觉好用,还请给个Star鼓励一下,谢谢 🍻

该插件是 Dcat Admin 的插件,安装方式遵循Dcat Admin官方文档。

默认规格带有图片库存价格三个属性,可自行添加属性,自行处理。

改进的地方

  • 增加了独立设置相关属性的模块;
  • 增加了多图上传功能;
  • 增加删除图片时操作确认;
  • 增加删除图片时同时删除后端图片;
  • 增加图片上传、删除的URL配置项,不用再去修改js文件中的相关变量;

界面展示

  • 可以独立设置规格属性,默认输入框,支持单选框复选框

image

  • 在表单界面规格名位置选择下拉框中的相关属性或者手动输入,生成SKU相关信息。

    image

  • 插件配置页面可以配置图片上传、删除的URL。

    image

安装

composer安装

composer require abbotton/dcat-sku-plus

应用商店安装

等待Dcat Admin 上商店 

使用

// app/Admin/Controllers/ProductController.php

protected function form()
{
    return Form::make(new Product(), function (Form $form) {
        $skuParams = [
            // 扩展第一列
            [
                'name'    => '会员价', // table 第一行 title
                'field'   => 'member_price', // input 的 field_name 名称
                'default' => 5, // 默认值
            ],
            // 扩展第二列
        ];
        // 新增时
        $form->sku('sku', '生成SKU')->addColumn($skuParams);
        
        // 编辑时
        $skuData = []; // 数据结构见附录
        $skuString = json_encode($skuData);
        $form->sku('sku', '生成SKU')->addColumn($skuParams)->value($skuString);
        
        // 获取提交的数据.
        $form->saving(function (Form $form) {
            // 拿到SKU数据,按照业务逻辑做响应处理即可。
            dd($form->input('sku'));
        });
    });
}

附录

最终生成的SKU数据结构,仅供参考

{
  "attrs": {
    "测试": [
      "测试1",
      "测试2"
    ],
    "颜色": [
      "绿",
      ""
    ],
    "含电池": [
      "含电池"
    ],
    "内存": [
      "8G"
    ]
  },
  "sku": [
    {
      "测试": "测试1",
      "颜色": "绿",
      "含电池": "含电池",
      "内存": "8G",
      "pic": [
        {
          "short_url": "sku/HjdrG0RpfIwI3kkgpNNFfmxPasgaOLg6bBPOCDxd.jpg",
          "full_url": "http://127.0.0.1:8000/storage/sku/HjdrG0RpfIwI3kkgpNNFfmxPasgaOLg6bBPOCDxd.jpg"
        },
        {
          "short_url": "sku/bkucABLjzRQ5pEHYX0gwdS1VxJrS6ObiQCIWVvIl.png",
          "full_url": "http://127.0.0.1:8000/storage/sku/bkucABLjzRQ5pEHYX0gwdS1VxJrS6ObiQCIWVvIl.png"
        }
      ],
      "stock": "",
      "price": "",
      "member_price": 5
    }
  ]
}
You might also like...
It's basically a dynamic web browser extension that can display notifications with the help of an admin-controlled dynamic API.
It's basically a dynamic web browser extension that can display notifications with the help of an admin-controlled dynamic API.

D-NOTIFIER A self controlled dynamic API based web browser extension built by Sahil Kumar How It Works? It's basically a dynamic web browser extension

Magento 2 Product Allocation extension allows the to admin manage all products in an order

Magento 2 Product Allocation extension allows the to admin manage all products in an order, making sure that products can only be moved to cart if sufficient allocation is available.

Magento 2 Grid Colors module for colorizing admin grids. Supports saving of states with the help of grid's bookmarks.
Magento 2 Grid Colors module for colorizing admin grids. Supports saving of states with the help of grid's bookmarks.

Magento 2 Grid Colors Overview The module adds extra coloring features to admin grids at the Sales section. With help of this module, it is possible t

Magento 2 Extension to cleanup admin menu and Store > Configuration area by arranging third party extension items.
Magento 2 Extension to cleanup admin menu and Store Configuration area by arranging third party extension items.

Clean Admin Menu - Magento 2 Extension It will merge all 3rd party extension's menu items in backend's primary menu to a common menu item named "Exten

Reset UI Bookmarks allows admin users to reset their own UI bookmarks such as state of filters, column positions and applied sorting ( e.g Sales > Orders ).
Reset UI Bookmarks allows admin users to reset their own UI bookmarks such as state of filters, column positions and applied sorting ( e.g Sales Orders ).

Reset Ui Bookmarks Reset UI Bookmarks becomes an invaluable tool while working daily in the admin panel, especially on Magento® instances with a large

The Laravel eCommerce ABA Payment Gateway module allows the admin to integrate the ABA payment gateway to the online store.

Introduction Bagisto ABA Payment Gateway. Requirements: Bagisto: v1.3.2. Installation with composer: Run the following command composer require bagist

With the help of the Laravel eCommerce CashU Payment Gateway, the admin can integrate the CashU payment method in the Bagisto store.

Introduction Bagisto CashU Payment add-on allow customers to pay for others using CashU payment gateway. Requirements: Bagisto: v1.3.2 Installation wi

Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pages from the admin panel.
Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pages from the admin panel.

Magento 2 Preview/Visit Catalog Overview Magento 2 Preview/Visit Catalog allows the store owner to quickly preview the catalog (product & category) pa

Simply removes the applcation's front-end and redirects it to the admin area.

Simply removes the application's front-end and redirects it to the admin area.

Comments
  • 如果有其他字段使用saving方法,比如有其他缩略图字段修改上传图片,那上传就会报错把sku字段一起提交了

    如果有其他字段使用saving方法,比如有其他缩略图字段修改上传图片,那上传就会报错把sku字段一起提交了

    我sku字段用的json,上传组图pics的时候也会提交sku字段 column 'products.sku'. (SQL: update products set pics = [5,8,9], sku = , products.updated_at = 2022-10-08 09:38:59 where id = 1)

    opened by gitlk 0
  • 项目还在维护吗?

    项目还在维护吗?

    编辑时, 按附录中的数据格式带入后, 没有将扩展列的值带入.

    {
        "attrs": {
            "长度": [
                "110",
                "120"
            ],
            "颜色": [
                "黑色",
                "白色"
            ]
        },
        "sku": [
            {
                "长度": "110",
                "颜色": "黑色",
                "id": 2,
                "images": null,
                "rent_price": 10,
                "deposit_price": 20,
                "is_published": 0,
                "stock": 100,
                "created_at": "2022-09-26T10:49:01.000000Z",
                "updated_at": "2022-09-26T10:49:01.000000Z"
            },
            {
                "长度": "110",
                "颜色": "白色",
                "id": 3,
                "images": null,
                "rent_price": 0,
                "deposit_price": 0,
                "is_published": 0,
                "stock": 0,
                "created_at": "2022-09-26T10:49:01.000000Z",
                "updated_at": "2022-09-26T10:49:01.000000Z"
            },
            {
                "长度": "120",
                "颜色": "黑色",
                "id": 4,
                "images": null,
                "rent_price": 0,
                "deposit_price": 0,
                "is_published": 0,
                "stock": 0,
                "created_at": "2022-09-26T10:49:01.000000Z",
                "updated_at": "2022-09-26T10:49:01.000000Z"
            },
            {
                "长度": "120",
                "颜色": "白色",
                "id": 5,
                "images": null,
                "rent_price": 0,
                "deposit_price": 0,
                "is_published": 0,
                "stock": 0,
                "created_at": "2022-09-26T10:49:01.000000Z",
                "updated_at": "2022-09-26T10:49:01.000000Z"
            }
        ]
    }
    
    image

    感谢您的付出

    opened by wilbur-yu 0
  • 报错了,大佬

    报错了,大佬

    ErrorException htmlspecialchars() expects parameter 1 to be string, array given (View: /home/vagrant/ad.ep.com/vendor/abbotton/dcat-sku-plus/resources/views/index.blade.php)

    opened by Acollty 3
Releases(v1.0.0)
Owner
Write less, do more.
null
Dcat Admin 视频/音频预览扩展

Dcat Admin 音视频预览扩展 安装 composer require abovesky/dcat-media-player 具体安装方法请参考官方文档 使用方法 // 数据表格中使用 $grid->column('video')->video(); $grid->column('audio

null 15 Sep 30, 2022
For the super admin, replace WP Admin Bar My Sites menu with an All Sites menu.

Super Admin All Sites Menu Also available at https://wordpress.org/plugins/super-admin-all-sites-menu/ Use | Prerequisite | Install | Filters | Demo |

Per Søderlind 18 Dec 17, 2022
Arc admin comment preview - Simple Textpattern plugin that adds a comment preview to admin

arc_admin_comment_preview This is a Textpattern plugin for adding comment previews to the admin comment edit pages. Requirements Textpattern 4.0.8+ In

Andy Carter 1 Jan 20, 2017
Description: A simple plugin that sets the current admin page to always be at the top of the admin menu.

=== Sticky Admin Menu === Contributors: sc0ttkclark Donate link: https://www.scottkclark.com/ Tags: admin menu, sticky Requires at least: 4.4 Tested u

Scott Kingsley Clark 2 Sep 29, 2022
Tabler.io bundle for Symfony - a backend/admin theme for easy integration

Tabler Bundle for Symfony This repository contains a Symfony bundle, integrating the fantastic Tabler.io HTML Template into your Symfony project. It s

Kevin Papst 22 Jan 2, 2023
Magento 2 module to quickly acces products, orders and customer from admin menu

Magento 2 module to quickly access product, order or customer views Introduction The Magento 2 backend can be sluggish. Ever wanted to access a produc

null 1 Dec 3, 2021
Online Food Ordering system with admin, owner, rider panel

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

sumit paul 1 Jun 17, 2022
A @laravel based RAD platform for back-office applications, admin/user panels, and dashboards.

For the full documentation, visit orchid.software. Introduction Orchid is a free Laravel package that abstracts standard business logic and allows cod

Laravel Orchid 3.4k Jan 7, 2023
A desktop Laravel admin panel app

Laravel Kit A simple and elegant desktop application for managing your Laravel applications. Available for Windows, Linux and macOS. Website | Feature

Tareque Md Hanif 1k Jan 8, 2023
Give your Magento Admin a facelift.

Installation on Magento 1.7.x, 1.8.x, 1.9.x Install with modgit: $ cd /path/to/magento $ modgit init $ modgit clone admin-theme https://github.com/jre

Johann Reinké 225 Sep 18, 2022