Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

API helper class for CS-Cart 4 - FREE Rate Topic   * * * * * 2 votes

 

Posted 06 July 2015 - 02:28 PM #21

Hello friends... I am a newbie in cs cart. anyone can tell me how to override the template file..
I want to override orders/details.tpl in another addon.

Thank you...! :-)

 
  • imac
  • Head of Product
  • CS-Cart Architects
  • Join Date: 22-Nov 05
  • 2074 posts

Posted 07 July 2015 - 09:47 PM #22

Hello friends... I am a newbie in cs cart. anyone can tell me how to override the template file..
I want to override orders/details.tpl in another addon.

Thank you...! :-)


There is a separate section in Docs "How to override a template": http://docs.cs-cart..../tpl_hooks.html
Here is an extra link:
http://stackoverflow...ariant-item-tpl
Ilya Makarov,
CS-Cart Architect Team
Suggest and vote for new features | Report a bug

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19698 posts

Posted 08 July 2015 - 08:49 AM #23

Hello friends... I am a newbie in cs cart. anyone can tell me how to override the template file..
I want to override orders/details.tpl in another addon.

Thank you...! :-)


For admin panel please use:

design/backend/templates/addons/YOUR_ADDON/overrides/views/orders/details.tpl

For store-front please use:

design/themes/YOUR_THEME/templates/addons/YOUR_ADDON/overrides/views/orders/details.tpl

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • Kriziun
  • Newbie
  • Trial users
  • Join Date: 31-Jul 15
  • 1 posts

Posted 31 July 2015 - 09:59 PM #24

Hi, i'm trying ti update tracking number by sending a request to http://host/api/shipments/1 via PUT request. I can receive a shipment data via GET request so id is correct.
My test data is {"carrier":"FEDEX","tracking_number":"111"}
But I received an error: {"message":"Bad Request: Only the tracking_number and carrier params can be updated with the setting 'Allow multiple shipments for a single order' set","status":400}

What i'm doing wrong?

 
  • eComLabs
  • CS-Cart Expert
  • Authorized Reseller
  • Join Date: 27-Jan 14
  • 19698 posts

Posted 03 August 2015 - 09:36 AM #25

Looks like a bug in the app\Tygh\Api\Entities\Shipments.php file due to the following code:

if (Settings::instance()->getValue('use_shipments', '', $order_info['company_id']) == 'Y') {
      $data['message'] = __('api_shipments_not_allow_update');
      $valid_params = false;
}

The system checks value of the setting, but does not check input parameters.

Please contact CS-Cart support team.

GET A FREE QUOTE | CS-Cart Add-ons | CS-Cart Licenses | CS-Cart Development | CS-Cart Design | Server Configuration | UniTheme and YOUPI
CS-Cart                USD 345     Multi-Vendor              USD 1250    CS-Cart RU                         24500 руб.
CS-Cart Ultimate  USD 775     CS-Cart + YOUPI      USD 545      CS-Cart RU + UniTheme    36000 руб.


 
  • mokeshop
  • Senior Member
  • Members
  • Join Date: 27-Jul 12
  • 1005 posts

Posted 18 November 2015 - 12:09 PM #26

i read this http://doc.prestasho...REST webserviceand there are some prepared tools... 

 

hope this prepared solutions will be found in the future directly on cs cart api page



 

Posted 16 April 2016 - 09:54 AM #27

Hi there,

 

In the past few months, I left my API wrapper project alone :(

Yesterday I made some changes regarding bug reports, and released the first "official" release with version number 1.0.0

 

You can find the latest version of this wrapper class here: https://github.com/d...stvan/cscartapi

 

I'm using this tool for a lot of projects, and I realized, that this class is helpful, but it would be good if I will be able to install the package via Composer, and I'm working on a version which has a lot of helpful methods, and a beautiful API.

If you think it is a good idea, please share your ideas here.

 

Enhancements for version 2.0.x

- Composer compatibility

- New API (eg. CSCart::Products()->whereStatus('A')->get()->toArray()) which is similar to Laravel's Eloquent API

- Service provider for Laravel (I use this API in Laravel projects a lot)

- New HTTP Client version (you will have the option to use streamclient instead of curlclient) 



 
  • Rbraat
  • Newbie
  • Trial users
  • Join Date: 17-May 16
  • 2 posts

Posted 17 May 2016 - 02:29 PM #28

How can i create a new category with this tool?



 

Posted 19 May 2016 - 07:24 AM #29

How can i create a new category with this tool?

 

You can check the official API documentation here:

http://docs.cs-cart....categories.html

 

If you create a POST request to "/categories", it will create a new entry for you.

 

For more information about this tool, please check the readme file here: https://github.com/d...stvan/cscartapi



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11365 posts

Posted 19 December 2016 - 12:28 AM #30

Hello, you can directly in the home page (index.tpl) call Banner and blog data Can no one help me?

Happy to if I could understand your question. 


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • markhedley
  • Advanced Member
  • Trial users
  • Join Date: 19-Nov 16
  • 129 posts

Posted 19 December 2016 - 04:44 AM #31

Hello, you can directly in the home page (index.tpl) call Banner and blog data Can no one help me?

stick to the topic perhaps???



 
  • phillip
  • Newbie
  • Trial users
  • Join Date: 09-Mar 13
  • 8 posts

Posted 26 June 2018 - 04:04 PM #32

Hello.

Good work. Very useful tool.

Phillip



 

Posted 19 July 2019 - 10:41 PM #33

Is anyone else seeing an issue where API calls trigger the CS-Cart menu to break? I have been experiencing this off and on since 4.9.x and am still seeing the issue manifest on the latest 4.10.3. Just retrieving a list of categories seems to trigger the problem, e.g.:

$categories = $cscartapi->get("categories", ['items_per_page'=>1000]);

 

After running this query, drop-down menu items disappear and the category pages show a 404. Clearing cache doesn't help. The products / categories are still present in the back-end. This is worrisome for using the API on a production site... the only way I am able to resolve is to reload a database backup.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11365 posts

Posted 19 July 2019 - 11:32 PM #34

Are you talking about the api itself or the helper class that is wrapped around it?  Not sure the helper has been updated for quite some time....


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • yckelvin
  • Advanced Member
  • Members
  • Join Date: 22-May 15
  • 52 posts

Posted 20 July 2019 - 08:20 AM #35

Hey everyone,

I made a simply helper class for CS-Cart 4 API. With this class, everyone can easily access to the API, without getting issues with the cURL extension, headers, authentication, etc.

Just call the CSCartAPI class with 3 parameters, and after it you can access the api() method. Using is easy, and free!

Everyone can download it from my GitHub repo.

I made some tests, so it is working, but not the best at the moment. I accept suggestions, improvements and bug reports smile.png

Regards,

Istvan Drahos

 

Very nice but I am newbie to cs-cart, may I know what I should put to the api_url? 



 

Posted 20 July 2019 - 03:03 PM #36

@tbirnseth I am using the helper class. The class is pretty minimalist, so I'm not sure why it would contribute to the behavior I'm seeing. I can bypass the class if necessary, but before doing that I think I'll do a DIFF on the database before and after an API call is made to identify what it actually happening in CS-Cart.



 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11365 posts

Posted 20 July 2019 - 05:07 PM #37

@tbirnseth I am using the helper class. The class is pretty minimalist, so I'm not sure why it would contribute to the behavior I'm seeing. I can bypass the class if necessary, but before doing that I think I'll do a DIFF on the database before and after an API call is made to identify what it actually happening in CS-Cart.

If you're running 4.10.x, I would not trust anything... I've recommended to all my clients that they NOT upgrade to 4.10.x until thing get flushed out and it stabilizes and remain at 4.9.3.  It's going to take me months to validate/change all my addons to be compatible with 4.10.x.  Not one of cs-cart's finer moments.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • soft-solid
  • Junior Member
  • Members
  • Join Date: 19-Apr 10
  • 855 posts

Posted 20 July 2019 - 06:25 PM #38

Very nice but I am newbie to cs-cart, may I know what I should put to the api_url? 

 

You should enter the address of your store there. So it's just the domain.

 

Best regards

Robert


Team of SoftSolid
cs-cart.pl

 

Posted 20 July 2019 - 06:35 PM #39

@tbirnseth, thanks for the insight. Good to know add-ons aren't compatible into the 4.10.x series.

 

Comparing the database before and after API call, the lone change is a new row under cscart_sessions. I'm not sure how to troubleshoot the BLOB data package, but deleting that row magically restores menu / URL functionality. Creating new (non-API) sessions does not impact functionality either. It's possible that something is wrong with the API call, but it is concerning that session data could be stored in such a way as to break cart functionality.

 

I'll re-attempt on 4.9.x to see whether this issue persists.



 

Posted 20 July 2019 - 08:00 PM #40

The problem appears in 4.9.x as well. Specifically, a new row with session_id ending in ****-0-A is created. The api.php has a NO_SESSION constant equal to true, which I gather means this row should NOT be added to the cscart_sessions table. Deleting only this new row from the database resolves whatever problem is causing CS-Cart to refuse to load menu and pages on front-end. At this point I wonder how many developers are actually actively using the API.