douqing0713 2015-08-29 18:12
浏览 42

prestashop创建购物车并以编程方式添加产品[重复]

This question already has an answer here:

I am trying to create a simple task as follows:
1. Write a custom controller
2. create a cart if it is not created
3. add a product to the cart

came accross this code that is similar.

I need to know a few things:
1. In which folder should i place my custom controller?
2. Which parent controller class should my controller extend?
3. what will be the url for the controller?

</div>
  • 写回答

1条回答 默认 最新

  • doudiemei2013 2015-08-31 08:35
    关注

    It depends on when you want this action to happen. Like always with prestashop, you have 2 possibilities :

    Override an existing controller

    For example if you want to add a product to the cart everytime its created, you might want to override CartController. In that case here is the answers to your questions :

    1. In the override/controllers folder.
    2. The parent controller you chose, for example CartControllerCore
    3. The same as the parent controller. Check the official doc about the dispatcher, it's pretty usefull

    Create you own module

    I think this is the best choice if you want to have a real control over when you trigger this action.

    1. In the modules/you_module/controllers folder. The official doc is also a great place to start.
    2. ModuleFrontController
    3. Refer to the page about the dispatcher I gave you above, but the best way to trigger your action is to use the hook system.
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题