{"id":13806132,"url":"https://github.com/sinbadxiii/phalcon-cart","last_synced_at":"2025-12-25T13:07:47.106Z","repository":{"id":57051594,"uuid":"219980359","full_name":"sinbadxiii/phalcon-cart","owner":"sinbadxiii","description":"Simple shopping cart for Phalcon, example https://ankas.ru","archived":false,"fork":false,"pushed_at":"2021-07-21T05:57:25.000Z","size":13,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-10T07:39:28.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sinbadxiii.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-06T11:23:21.000Z","updated_at":"2023-11-03T23:35:22.000Z","dependencies_parsed_at":"2022-08-24T05:11:10.751Z","dependency_job_id":null,"html_url":"https://github.com/sinbadxiii/phalcon-cart","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinbadxiii%2Fphalcon-cart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinbadxiii%2Fphalcon-cart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinbadxiii%2Fphalcon-cart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sinbadxiii%2Fphalcon-cart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sinbadxiii","download_url":"https://codeload.github.com/sinbadxiii/phalcon-cart/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254031290,"owners_count":22002734,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T01:01:08.114Z","updated_at":"2025-12-25T13:07:47.033Z","avatar_url":"https://github.com/sinbadxiii.png","language":"PHP","funding_links":[],"categories":["Shop \u0026 Ecommerce"],"sub_categories":[],"readme":"# Phalcon Shopping Cart\n\nA simple shoppingcart implementation for Phalcon.\n\n### Installation\n\nInstall the package through Composer.\n\nRun the Composer require command from the Terminal:\n\n```\ncomposer require sinbadxiii/phalcon-cart\n```\n\n## How use\n\nAdd in services\n\n```\n$di-\u003eset(\n      'cart',\n      function () use ($di) {\n          return new Sinbadxiii\\Phalcon\\Cart\\CartShopping(\n              $di-\u003egetSession()\n          );\n      }\n  );\n```\n\nor creating with name instance\n\n```\n$di-\u003eset(\n      'compare',\n      function () use ($di) {\n          return new Sinbadxiii\\Phalcon\\Cart\\CartShopping(\n              $di-\u003egetSession(), 'compare'\n          );\n      }\n  );\n```\n\n```\n#add()\n$this-\u003ecart-\u003eadd('1', 'Product Name 1', 1, 100.99);\n\n#update()\n$rowId = '5d12249fdca4cb0fff77f49bbffc128c';\n$this-\u003ecart-\u003eupdate($rowId, 10);\n\n#remove()\n$rowId = '5d12249fdca4cb0fff77f49bbffc128c';\n$this-\u003ecart-\u003eremove($rowId);\n\n#content()\n$this-\u003ecart-\u003econtent();\n\n#destroy()\n$this-\u003ecart-\u003edestroy();\n\n#total() with Tax\n$this-\u003ecart-\u003etotal();\n\n#total() without Tax\n$this-\u003ecart-\u003esubtotal();\n\n#count()\n$this-\u003ecart-\u003ecount();\n\n#countTotal()\n$this-\u003ecart-\u003ecountTotal();\n```\n\n## Instances\n\nThe packages supports multiple instances of the cart. The way this works is like this:\n\nYou can set the current instance of the cart by calling $this-\u003ecart-\u003einstance('newInstance'). From this moment, the active instance of the cart will be newInstance, so when you add, remove or get the content of the cart, you're work with the newInstance instance of the cart. If you want to switch instances, you just call $this-\u003ecart-\u003einstance('otherInstance') again, and you're working with the otherInstance again.\n\nSo a little example:\n\n```\n$this-\u003ecart-\u003einstance('shop')-\u003eadd('100', 'Product #1', 1, 100.00);\n\n// Get the content of the 'shop' cart\n$this-\u003ecart-\u003econtent();\n\n$this-\u003ecart-\u003einstance('wishlist')-\u003eadd('200', 'Product #2', 1, 20.00);\n\n// Get the content of the 'wishlist' cart\n$this-\u003ecart-\u003econtent();\n\n// If you want to get the content of the 'shopping' cart again\n$this-\u003ecart-\u003einstance('shop')-\u003econtent();\n\n// And the count of the 'wishlist' cart again\n$this-\u003ecart-\u003einstance('wishlist')-\u003ecount();\n```\n\n\u003e N.B. Keep in mind that the cart stays in the last set instance for as long as you don't set a different one during script execution.\n\n\u003e N.B.2 The default cart instance is called default, so when you're not using instances, $this-\u003ecart-\u003econtent(); is the same as $this-\u003ecart-\u003einstance('shop')-\u003econtent().\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinbadxiii%2Fphalcon-cart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsinbadxiii%2Fphalcon-cart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsinbadxiii%2Fphalcon-cart/lists"}