简体   繁体   English

在PrestaShop中自动加载PHP库以运输运输模块

[英]Autoload PHP library in PrestaShop for shipping carrier module

I want to use this library in PrestaShop shipping carrier modules: https://github.com/dvdoug/BoxPacker 我想在PrestaShop运输载体模块中使用此库: https : //github.com/dvdoug/BoxPacker

The BoxPacker library determines the number and size of boxes required from an available list to pack the selected items. BoxPacker库从可用列表中确定包装所选项目所需的盒子的数量和大小。 I will use the library in shipping carrier modules, such as fedexcarrier, to retrieve more accurate shipping rates. 我将在运送载体模块(例如fedexcarrier)中使用该库来检索更准确的运送费率。 The library uses namespace and is PSR-4 compliant. 该库使用名称空间,并且符合PSR-4。

I don't know how to integrate it with PrestaShop v1.5.6.2. 我不知道如何将其与PrestaShop v1.5.6.2集成。 How can I integrate the library with PrestaShop (using composer?) and make it available in the shipping modules using PrestaShop's autoloader? 如何将库与PrestaShop集成(使用composer?),并使用PrestaShop的自动加载器在运输模块中使用它?

You just need to clone the specific shipping module and add this feature just the way you would add it in a custom script. 您只需要克隆特定的运输模块,然后像在自定义脚本中添加该功能一样添加此功能。 There's nothing special in PrestaShop or any other script regarding such integration. PrestaShop或任何其他有关这种集成的脚本都没有什么特别的。 You need to include the class files where they are required explicitly. 您需要在明确需要它们的地方包括类文件。

For example if you use this classes within the main module file, you need to include them before the class declaration. 例如,如果您在主模块文件中使用此类,则需要在类声明之前包括它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM