Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2008
    Posts
    19
    Plugin Contributions
    1

    Default What is the process of adding a new composer plugin

    I have been confused over the years as how best to add composer addons into zencart as they seem to appear in several locations.

    I wanted to know what is the best way to do this within the new 2.0.0 framework.

    I am trying to use Com\Tecnick\Barcode to generate barcodes

    but I am asking this in a more general way to gain clarity.

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,784
    Plugin Contributions
    124

    Default Re: What is the process of adding a new composer plugin

    Running

    composer install

    from the top of your cart hierarchy will create a vendor folder.

    Then you can use

    require DIR_FS_CATALOG . 'vendor/autoload.php';

    in your Zen Cart code.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Mar 2008
    Posts
    19
    Plugin Contributions
    1

    Default Re: What is the process of adding a new composer plugin

    Wouldn't it be better to do this inside the laravel directory so that all the composer elements are together and managed together through one auto load.

    Also what is the difference between the composer elements under laravel and the composer elements under includes/classes or is it just a historic thing?

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    9,784
    Plugin Contributions
    124

    Default Re: What is the process of adding a new composer plugin

    > Wouldn't it be better to do this inside the laravel directory so that all the composer elements are together and managed together through one auto load.

    You asked me how to do this, and I told you how I'm doing it. Please feel free to do whatever you want. For me, having it in a separate, new folder reminds me when I go to do the upgrade that I need to take care of these items as well.

    > Also what is the difference between the composer elements under laravel and the composer elements under includes/classes or is it just a historic thing?

    Historic thing. The laravel folder is new.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Jan 2004
    Posts
    66,387
    Blog Entries
    7
    Plugin Contributions
    81

    Default Re: What is the process of adding a new composer plugin

    Quote Originally Posted by hellsbit View Post
    I have been confused over the years as how best to add composer addons into zencart as they seem to appear in several locations.

    I wanted to know what is the best way to do this within the new 2.0.0 framework.

    I am trying to use Com\Tecnick\Barcode to generate barcodes

    but I am asking this in a more general way to gain clarity.
    Zen Cart does NOT directly manage or rely upon anything provided by Composer, as far as the core app goes.
    The core /composer.json is more information "about" the package, and the only packages "required" there are for the sake of the test suite.
    None of the core Zen Cart app uses anything mentioned in the /composer.json or composer's /vendor directory.

    So, you have 3 options:
    1. What Scott mentioned above. Which has its caveats.
    2. Choose a package which has no other dependencies and unzip it into the /includes/classes/vendors directory, and "require" its autoloader in your application code.
    3. Or put it in the /laravel/composer.json and run composer install to add it to your site. As long as the Laravel infrastructure has been loaded by the time you try to access the classes provided by that vendor, it should work.

    You will of course have to upgrade all your Composer dependencies any time you upgrade your Zen Cart.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. v154 Adding a new Plugin/Contribution, how can we add screenshots?
    By grebenarov in forum Contribution-Writing Guidelines
    Replies: 1
    Last Post: 7 Jul 2015, 07:51 AM
  2. Adding additional data to the database during the order process.
    By PearceStephens in forum Managing Customers and Orders
    Replies: 4
    Last Post: 30 Sep 2014, 08:38 AM
  3. cannot process the adding of the item into the shopping cart
    By wufoxuan in forum General Questions
    Replies: 1
    Last Post: 7 May 2010, 05:26 AM
  4. what are the checkout process success failure pages
    By klynn in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 21 Aug 2008, 09:48 AM
  5. Adding new fields to order process
    By bonheddwr in forum Managing Customers and Orders
    Replies: 9
    Last Post: 23 Jul 2007, 02:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR