Developers Guide to CS-Cart Framework

Hello,



Can anyone provide any documentation or links to where I can learn more about the current CS-Cart framework? I need to develop some add-ons for a project I am working on and would like to make sure that I code everything within the CS-Cart framework if possible. Thanks in advance for any advice/direction you can give me.



-Vinh

http://kb2.cs-cart.com

Hello ET,



KB is only to setting up CS-Cart from back office and customize look and feel. Right?



Where is documentation to code an addon?



After real simple User Manual, after very useful Knowledge Base, we need a same easy to use Coder Manual:



How to Make an Addon for CS-Cart



This is will help to increase the CS-Cart Addon catalog.



And will help to keep leadership of CS-Cart versus competition.



Thank you,





Lee Li Pop

Posted by snorocket before: [url]http://docs.cs-cart.com/[/url]

Hello Nodame,


[quote name=‘nodame’]Posted by snorocket before: [url]http://docs.cs-cart.com/[/url][/QUOTE]



Thank you, I will read it.







Lee Li Pop

Thanks for this. I find it many time but never ask :slight_smile:

Thank you very much for this piece of information.

just what i needed

I have found the addon section of docs.cs-cart.com to be very thin. Does anything else exist?

The documentation only deals with hooks, and not with creating new blocks. As one of many examples, I have created a new addon (which I can’t get to work), and when adding a new block there is an underscore (“_”) before its name in the “Block content” drop-down list. Why is that?



What is this used for in controllers:

return array(CONTROLLER_STATUS_OK);



What does $mode refer to in controllers, ie:

if ($mode == ‘clear’) {



I could go on forever. Is there any more documentation to read?

[quote name=‘andrew@livealchemy.com’]when adding a new block there is an underscore (“_”) before its name in the “Block content” drop-down list. Why is that?

[/QUOTE]



The underscore is because there is no language variable for the word. So if you have “block_name” and it shows as “_block_name” in the “Block content” drop down, then create a language variable for “block_name” and it will show it instead of “_block_name”.

$mode in the controller files refers to everything after the . in the dispatch variable passed to the application.



So if you call dispatch=myaddon.view in the url string, the application will load the myaddon controller and pass it the $mode of view.



As an added note, certain “modes” are restricted or have special behavior. I ran into this while developing an application for one of our clients. Calling the mode “add” will actually load the “update” view files.



The basic idea behind that is for the update template to auto-populate the same fields that would be used on the add template. When submitted to the server, the information can be saved and a check can be run on the “id” value that should be stored in a hidden field on the submitting form. If an id was passed, it was an update to an existing record, if an id was not passed it is a new entry. This can be used in the controller file to handle the saving/processing of the information differently if desired, but ultimately the logic should just be similar to a “REPLACE INTO table ( id , field1 , field2 ) VALUES ( ‘$id’ , ‘$field1’ , ‘$field2’ )” query which would automatically insert the row as a new row, or in the event id is specified and exists in the table, run a pre-query to delete that row (essentially replacing it with the new data).



Hopefully this helps everyone who is looking to build their own addon and/or modify an existing one. The CS Cart workflow is very intuitive, but not documented very well. As a result I’ve had to reverse-engineer the default addons to learn the workflow.