【问题标题】:In magento how to create an attribute to upload an image product page admin在magento中如何创建属性来上传图片产品页面管理员
【发布时间】:2023-03-05 17:11:02
【问题描述】:

我需要在我的产品页面中添加徽标图像。为此,我想创建一个属性以在产品页面管理员中上传图像。如何创建属性以在产品页面中上传图像并使其显示在前端?

【问题讨论】:

    标签: magento


    【解决方案1】:

    您可以为每个产品添加新的产品图像类型,而不是使用简单的属性。

    这里有一个非常简单的例子:

    http://www.pixafy.com/blog/2012/12/adding-a-fourth-image-position-to-the-admin-for-a-magento-product/

    希望对你有帮助

    更新

    你只需要在 helper('catalog/image')->init($_product, 'brandimage')->resize(400,300); ?>">

    【讨论】:

    • 您好,我已尝试此链接,但无法正常工作。我已在管理员中上传图片并选择相应的单选按钮并更新此文件 app\design\frontend\default\Mytheme\ 中的代码模板\目录\产品\view.phtml。但是在前端我没有得到图像,而是得到了该图像的硬编码路径。@SKV
    • 嗨,这是我在前端获取的图像路径。localhost/magentosample/media/catalog/product/cache/1/…
    • 你只需要在 helper('catalog/image')->init($_product, 'brandimage')->resize(400,300); ?>">
    【解决方案2】:

    我认为下面的链接可以帮助你。

    http://www.magentocommerce.com/magento-connect/file-attributes.html

    此扩展使我们能够为产品上传文件。我想这也可以用来上传图片。

    希望对你有所帮助...

    【讨论】:

    • 链接打不开:(
    【解决方案3】:

    如果您需要上传产品页面选项卡中的文件,则无需创建产品自定义属性。只需安装以下扩展程序

    然后 php bin/magento setup:upgrade php bin/magento setup:static-content:deploy en_GB php bin/magento indexer:reindex php bin/magento cache:clean

    完美运行。

    https://github.com/Sebwite/Magento2-Product-Downloads/tree/2.1-dev

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-18
      • 1970-01-01
      • 2019-05-22
      • 2022-11-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多