-
+ {% for toc_hash in site.data.frontend-guide.theme %}
+ {% assign toc = toc_hash[page.side_toc]%}
+
- + {{ toc.name }} + + + {% endfor %} +
diff --git a/.gitignore b/.gitignore index 6e56faa304..928ad598e3 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ /node_modules/ _algolia_api_key +_data/backup.yml diff --git a/Gemfile b/Gemfile index 1cb3ba0f00..46c0e1bf71 100644 --- a/Gemfile +++ b/Gemfile @@ -3,6 +3,7 @@ source 'https://rubygems.org' gem 'github-pages' gem 'jekyll-last-modified-at' gem 'devdocs', :git => 'https://github.com/magento-devdocs/devdocs-theme.git', :branch => 'devdocs-stable' +gem "webrick", "~> 1.8" gem 'wdm' if Gem.win_platform? diff --git a/Gemfile.lock b/Gemfile.lock index e2337cd348..41e3c20189 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,6 +1,6 @@ GIT remote: https://github.com/magento-devdocs/devdocs-theme.git - revision: f864973ba8a063a7ad3da4ecfe47fa978a230f17 + revision: edabd815ee3ead3efffe983be5cb6961c3543aae branch: devdocs-stable specs: devdocs (0.0.1) @@ -9,283 +9,332 @@ GIT GEM remote: https://rubygems.org/ specs: - activesupport (4.2.10) - i18n (~> 0.7) - minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) - tzinfo (~> 1.1) - addressable (2.5.2) - public_suffix (>= 2.0.2, < 4.0) - algolia_html_extractor (2.6.1) + Ascii85 (1.1.0) + activesupport (7.1.2) + base64 + bigdecimal + concurrent-ruby (~> 1.0, >= 1.0.2) + connection_pool (>= 2.2.5) + drb + i18n (>= 1.6, < 2) + minitest (>= 5.1) + mutex_m + tzinfo (~> 2.0) + addressable (2.8.6) + public_suffix (>= 2.0.2, < 6.0) + afm (0.2.2) + algolia_html_extractor (2.6.4) json (~> 2.0) - nokogiri (~> 1.8.2) - algoliasearch (1.23.2) + nokogiri (~> 1.10) + algoliasearch (1.27.5) httpclient (~> 2.8, >= 2.8.3) json (>= 1.5.1) + async (2.8.0) + console (~> 1.10) + fiber-annotation + io-event (~> 1.1) + timers (~> 4.1) + base64 (0.2.0) + bigdecimal (3.1.5) coffee-script (2.4.1) coffee-script-source execjs coffee-script-source (1.11.1) colorator (1.1.0) - colorize (0.8.1) - commonmarker (0.17.13) - ruby-enum (~> 0.5) - concurrent-ruby (1.0.5) - dnsruby (1.61.2) - addressable (~> 2.5) - em-websocket (0.5.1) + commonmarker (0.23.10) + concurrent-ruby (1.2.2) + connection_pool (2.4.1) + console (1.23.3) + fiber-annotation + fiber-local + dnsruby (1.70.0) + simpleidn (~> 0.2.1) + drb (2.2.0) + ruby2_keywords + em-websocket (0.5.3) eventmachine (>= 0.12.9) - http_parser.rb (~> 0.6.0) - ethon (0.11.0) - ffi (>= 1.3.0) + http_parser.rb (~> 0) + ethon (0.16.0) + ffi (>= 1.15.0) eventmachine (1.2.7) - execjs (2.7.0) - faraday (0.15.3) - multipart-post (>= 1.2, < 3) - ffi (1.9.25) + execjs (2.9.1) + faraday (2.9.0) + faraday-net_http (>= 2.0, < 3.2) + faraday-net_http (3.1.0) + net-http + ffi (1.16.3-x64-mingw-ucrt) + fiber-annotation (0.2.0) + fiber-local (1.0.0) filesize (0.2.0) forwardable-extended (2.6.0) - gemoji (3.0.0) - github-pages (192) - activesupport (= 4.2.10) - github-pages-health-check (= 1.8.1) - jekyll (= 3.7.4) - jekyll-avatar (= 0.6.0) + gemoji (3.0.1) + github-pages (228) + github-pages-health-check (= 1.17.9) + jekyll (= 3.9.3) + jekyll-avatar (= 0.7.0) jekyll-coffeescript (= 1.1.1) - jekyll-commonmark-ghpages (= 0.1.5) + jekyll-commonmark-ghpages (= 0.4.0) jekyll-default-layout (= 0.1.4) - jekyll-feed (= 0.10.0) + jekyll-feed (= 0.15.1) jekyll-gist (= 1.5.0) - jekyll-github-metadata (= 2.9.4) - jekyll-mentions (= 1.4.1) - jekyll-optional-front-matter (= 0.3.0) + jekyll-github-metadata (= 2.13.0) + jekyll-include-cache (= 0.2.1) + jekyll-mentions (= 1.6.0) + jekyll-optional-front-matter (= 0.3.2) jekyll-paginate (= 1.1.0) - jekyll-readme-index (= 0.2.0) - jekyll-redirect-from (= 0.14.0) - jekyll-relative-links (= 0.5.3) - jekyll-remote-theme (= 0.3.1) + jekyll-readme-index (= 0.3.0) + jekyll-redirect-from (= 0.16.0) + jekyll-relative-links (= 0.6.1) + jekyll-remote-theme (= 0.4.3) jekyll-sass-converter (= 1.5.2) - jekyll-seo-tag (= 2.5.0) - jekyll-sitemap (= 1.2.0) - jekyll-swiss (= 0.4.0) - jekyll-theme-architect (= 0.1.1) - jekyll-theme-cayman (= 0.1.1) - jekyll-theme-dinky (= 0.1.1) - jekyll-theme-hacker (= 0.1.1) - jekyll-theme-leap-day (= 0.1.1) - jekyll-theme-merlot (= 0.1.1) - jekyll-theme-midnight (= 0.1.1) - jekyll-theme-minimal (= 0.1.1) - jekyll-theme-modernist (= 0.1.1) - jekyll-theme-primer (= 0.5.3) - jekyll-theme-slate (= 0.1.1) - jekyll-theme-tactile (= 0.1.1) - jekyll-theme-time-machine (= 0.1.1) - jekyll-titles-from-headings (= 0.5.1) - jemoji (= 0.10.1) - kramdown (= 1.17.0) - liquid (= 4.0.0) - listen (= 3.1.5) + jekyll-seo-tag (= 2.8.0) + jekyll-sitemap (= 1.4.0) + jekyll-swiss (= 1.0.0) + jekyll-theme-architect (= 0.2.0) + jekyll-theme-cayman (= 0.2.0) + jekyll-theme-dinky (= 0.2.0) + jekyll-theme-hacker (= 0.2.0) + jekyll-theme-leap-day (= 0.2.0) + jekyll-theme-merlot (= 0.2.0) + jekyll-theme-midnight (= 0.2.0) + jekyll-theme-minimal (= 0.2.0) + jekyll-theme-modernist (= 0.2.0) + jekyll-theme-primer (= 0.6.0) + jekyll-theme-slate (= 0.2.0) + jekyll-theme-tactile (= 0.2.0) + jekyll-theme-time-machine (= 0.2.0) + jekyll-titles-from-headings (= 0.5.3) + jemoji (= 0.12.0) + kramdown (= 2.3.2) + kramdown-parser-gfm (= 1.1.0) + liquid (= 4.0.4) mercenary (~> 0.3) - minima (= 2.5.0) - nokogiri (>= 1.8.2, < 2.0) - rouge (= 2.2.1) + minima (= 2.5.1) + nokogiri (>= 1.13.6, < 2.0) + rouge (= 3.26.0) terminal-table (~> 1.4) - github-pages-health-check (1.8.1) + github-pages-health-check (1.17.9) addressable (~> 2.3) dnsruby (~> 1.60) octokit (~> 4.0) - public_suffix (~> 2.0) + public_suffix (>= 3.0, < 5.0) typhoeus (~> 1.3) - html-pipeline (2.8.4) + hashery (2.1.2) + html-pipeline (2.14.3) activesupport (>= 2) nokogiri (>= 1.4) - html-proofer (3.9.2) - activesupport (>= 4.2, < 6.0) + html-proofer (5.0.8) addressable (~> 2.3) - colorize (~> 0.8) - mercenary (~> 0.3.2) - nokogiri (~> 1.8.1) - parallel (~> 1.3) + async (~> 2.1) + nokogiri (~> 1.13) + pdf-reader (~> 2.11) + rainbow (~> 3.0) typhoeus (~> 1.3) yell (~> 2.0) - http_parser.rb (0.6.0) + zeitwerk (~> 2.5) + http_parser.rb (0.8.0) httpclient (2.8.3) - i18n (0.9.5) + i18n (1.14.1) concurrent-ruby (~> 1.0) - jekyll (3.7.4) + io-event (1.4.1) + jekyll (3.9.3) addressable (~> 2.4) colorator (~> 1.0) em-websocket (~> 0.5) - i18n (~> 0.7) + i18n (>= 0.7, < 2) jekyll-sass-converter (~> 1.0) jekyll-watch (~> 2.0) - kramdown (~> 1.14) + kramdown (>= 1.17, < 3) liquid (~> 4.0) mercenary (~> 0.3.3) pathutil (~> 0.9) rouge (>= 1.7, < 4) safe_yaml (~> 1.0) - jekyll-algolia (1.4.7) + jekyll-algolia (1.7.1) algolia_html_extractor (~> 2.6) - algoliasearch (~> 1.18) + algoliasearch (~> 1.26) filesize (~> 0.1) - jekyll (~> 3.0) + jekyll (>= 3.6, < 5.0) json (~> 2.0) nokogiri (~> 1.6) progressbar (~> 1.9) verbal_expressions (~> 0.1.5) - jekyll-avatar (0.6.0) - jekyll (~> 3.0) + jekyll-avatar (0.7.0) + jekyll (>= 3.0, < 5.0) jekyll-coffeescript (1.1.1) coffee-script (~> 2.2) coffee-script-source (~> 1.11.1) - jekyll-commonmark (1.2.0) - commonmarker (~> 0.14) - jekyll (>= 3.0, < 4.0) - jekyll-commonmark-ghpages (0.1.5) - commonmarker (~> 0.17.6) - jekyll-commonmark (~> 1) - rouge (~> 2) + jekyll-commonmark (1.4.0) + commonmarker (~> 0.22) + jekyll-commonmark-ghpages (0.4.0) + commonmarker (~> 0.23.7) + jekyll (~> 3.9.0) + jekyll-commonmark (~> 1.4.0) + rouge (>= 2.0, < 5.0) jekyll-default-layout (0.1.4) jekyll (~> 3.0) - jekyll-feed (0.10.0) - jekyll (~> 3.3) + jekyll-feed (0.15.1) + jekyll (>= 3.7, < 5.0) jekyll-gist (1.5.0) octokit (~> 4.2) - jekyll-github-metadata (2.9.4) - jekyll (~> 3.1) + jekyll-github-metadata (2.13.0) + jekyll (>= 3.4, < 5.0) octokit (~> 4.0, != 4.4.0) - jekyll-last-modified-at (1.0.1) - jekyll (~> 3.3) + jekyll-include-cache (0.2.1) + jekyll (>= 3.7, < 5.0) + jekyll-last-modified-at (1.3.0) + jekyll (>= 3.7, < 5.0) posix-spawn (~> 0.3.9) - jekyll-mentions (1.4.1) + jekyll-mentions (1.6.0) html-pipeline (~> 2.3) - jekyll (~> 3.0) - jekyll-optional-front-matter (0.3.0) - jekyll (~> 3.0) + jekyll (>= 3.7, < 5.0) + jekyll-optional-front-matter (0.3.2) + jekyll (>= 3.0, < 5.0) jekyll-paginate (1.1.0) - jekyll-readme-index (0.2.0) - jekyll (~> 3.0) - jekyll-redirect-from (0.14.0) - jekyll (~> 3.3) - jekyll-relative-links (0.5.3) - jekyll (~> 3.3) - jekyll-remote-theme (0.3.1) - jekyll (~> 3.5) - rubyzip (>= 1.2.1, < 3.0) + jekyll-readme-index (0.3.0) + jekyll (>= 3.0, < 5.0) + jekyll-redirect-from (0.16.0) + jekyll (>= 3.3, < 5.0) + jekyll-relative-links (0.6.1) + jekyll (>= 3.3, < 5.0) + jekyll-remote-theme (0.4.3) + addressable (~> 2.0) + jekyll (>= 3.5, < 5.0) + jekyll-sass-converter (>= 1.0, <= 3.0.0, != 2.0.0) + rubyzip (>= 1.3.0, < 3.0) jekyll-sass-converter (1.5.2) sass (~> 3.4) - jekyll-seo-tag (2.5.0) - jekyll (~> 3.3) - jekyll-sitemap (1.2.0) - jekyll (~> 3.3) - jekyll-swiss (0.4.0) - jekyll-theme-architect (0.1.1) - jekyll (~> 3.5) + jekyll-seo-tag (2.8.0) + jekyll (>= 3.8, < 5.0) + jekyll-sitemap (1.4.0) + jekyll (>= 3.7, < 5.0) + jekyll-swiss (1.0.0) + jekyll-theme-architect (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-cayman (0.1.1) - jekyll (~> 3.5) + jekyll-theme-cayman (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-dinky (0.1.1) - jekyll (~> 3.5) + jekyll-theme-dinky (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-hacker (0.1.1) - jekyll (~> 3.5) + jekyll-theme-hacker (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-leap-day (0.1.1) - jekyll (~> 3.5) + jekyll-theme-leap-day (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-merlot (0.1.1) - jekyll (~> 3.5) + jekyll-theme-merlot (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-midnight (0.1.1) - jekyll (~> 3.5) + jekyll-theme-midnight (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-minimal (0.1.1) - jekyll (~> 3.5) + jekyll-theme-minimal (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-modernist (0.1.1) - jekyll (~> 3.5) + jekyll-theme-modernist (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-primer (0.5.3) - jekyll (~> 3.5) + jekyll-theme-primer (0.6.0) + jekyll (> 3.5, < 5.0) jekyll-github-metadata (~> 2.9) jekyll-seo-tag (~> 2.0) - jekyll-theme-slate (0.1.1) - jekyll (~> 3.5) + jekyll-theme-slate (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-tactile (0.1.1) - jekyll (~> 3.5) + jekyll-theme-tactile (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-theme-time-machine (0.1.1) - jekyll (~> 3.5) + jekyll-theme-time-machine (0.2.0) + jekyll (> 3.5, < 5.0) jekyll-seo-tag (~> 2.0) - jekyll-titles-from-headings (0.5.1) - jekyll (~> 3.3) - jekyll-watch (2.0.0) + jekyll-titles-from-headings (0.5.3) + jekyll (>= 3.3, < 5.0) + jekyll-watch (2.2.1) listen (~> 3.0) - jemoji (0.10.1) + jemoji (0.12.0) gemoji (~> 3.0) html-pipeline (~> 2.2) - jekyll (~> 3.0) - json (2.1.0) - kramdown (1.17.0) - launchy (2.4.3) - addressable (~> 2.3) - liquid (4.0.0) - listen (3.1.5) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - ruby_dep (~> 1.2) + jekyll (>= 3.0, < 5.0) + json (2.7.1) + kramdown (2.3.2) + rexml + kramdown-parser-gfm (1.1.0) + kramdown (~> 2.0) + launchy (2.5.2) + addressable (~> 2.8) + liquid (4.0.4) + listen (3.8.0) + rb-fsevent (~> 0.10, >= 0.10.3) + rb-inotify (~> 0.9, >= 0.9.10) mercenary (0.3.6) - mini_portile2 (2.3.0) - minima (2.5.0) - jekyll (~> 3.5) + minima (2.5.1) + jekyll (>= 3.5, < 5.0) jekyll-feed (~> 0.9) jekyll-seo-tag (~> 2.1) - minitest (5.11.3) - multipart-post (2.0.0) - nokogiri (1.8.4) - mini_portile2 (~> 2.3.0) - octokit (4.12.0) - sawyer (~> 0.8.0, >= 0.5.3) - parallel (1.12.1) - pathutil (0.16.1) + minitest (5.21.1) + mutex_m (0.2.0) + net-http (0.4.1) + uri + nokogiri (1.16.0-x64-mingw-ucrt) + racc (~> 1.4) + octokit (4.25.1) + faraday (>= 1, < 3) + sawyer (~> 0.9) + pathutil (0.16.2) forwardable-extended (~> 2.6) - posix-spawn (0.3.13) - progressbar (1.10.0) - public_suffix (2.0.5) - rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - rouge (2.2.1) - ruby-enum (0.7.2) - i18n - ruby_dep (1.5.0) - rubyzip (1.2.2) - safe_yaml (1.0.4) - sass (3.6.0) + pdf-reader (2.12.0) + Ascii85 (~> 1.0) + afm (~> 0.2.1) + hashery (~> 2.0) + ruby-rc4 + ttfunk + posix-spawn (0.3.15) + progressbar (1.13.0) + public_suffix (4.0.7) + racc (1.7.3) + rainbow (3.1.1) + rb-fsevent (0.11.2) + rb-inotify (0.10.1) + ffi (~> 1.0) + rexml (3.2.6) + rouge (3.26.0) + ruby-rc4 (0.1.5) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + safe_yaml (1.0.5) + sass (3.7.4) sass-listen (~> 4.0.0) sass-listen (4.0.0) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) - sawyer (0.8.1) - addressable (>= 2.3.5, < 2.6) - faraday (~> 0.8, < 1.0) + sawyer (0.9.2) + addressable (>= 2.3.5) + faraday (>= 0.17.3, < 3) + simpleidn (0.2.1) + unf (~> 0.1.4) terminal-table (1.8.0) unicode-display_width (~> 1.1, >= 1.1.1) - thread_safe (0.3.6) - typhoeus (1.3.0) + timers (4.3.5) + ttfunk (1.7.0) + typhoeus (1.4.1) ethon (>= 0.9.0) - tzinfo (1.2.5) - thread_safe (~> 0.1) - unicode-display_width (1.4.0) + tzinfo (2.0.6) + concurrent-ruby (~> 1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.9.1-x64-mingw-ucrt) + unicode-display_width (1.8.0) + uri (0.13.0) verbal_expressions (0.1.5) - yell (2.0.7) + wdm (0.1.1) + webrick (1.8.1) + yell (2.2.2) + zeitwerk (2.6.12) PLATFORMS - ruby + x64-mingw-ucrt DEPENDENCIES devdocs! @@ -294,6 +343,8 @@ DEPENDENCIES jekyll-algolia (~> 1.0) jekyll-last-modified-at launchy + wdm + webrick (~> 1.8) BUNDLED WITH - 1.16.5 + 2.5.4 diff --git a/_config.checks.yml b/_config.checks.yml index a8e62a17ef..2d75873856 100644 --- a/_config.checks.yml +++ b/_config.checks.yml @@ -13,7 +13,7 @@ html-proofer: :parallel: :in_processes: 3 :file_ignore: - - !ruby/regexp /guides\/m1x/ + - !ruby/regexp /guides\/v19.x/ - !ruby/regexp /template\.html/ - !ruby/regexp /whats-new\.html/ :url_ignore: diff --git a/_config.stage.yml b/_config.stage.yml index 4c25d9eead..3e63d19284 100644 --- a/_config.stage.yml +++ b/_config.stage.yml @@ -1 +1 @@ -url: "https://devdocs.magedevteam.com" \ No newline at end of file +url: "https://devdocs.magedevteam.com" diff --git a/_config.yml b/_config.yml index 806c3b871c..727bd755bc 100644 --- a/_config.yml +++ b/_config.yml @@ -33,10 +33,14 @@ defaults: feedback_link: true - scope: - path: guides/m1x + path: guides/v19.x + values: + layout: null + - + scope: + path: guides/v1.8 values: layout: null - - scope: path: mftf/2.2 @@ -94,8 +98,8 @@ algolia: index_name: devdocs api_key: d2d0f33ab73e291ef8d88d8b565e754c files_to_exclude: - - guides/m1x/**/*.html - - guides/m1x/**/*.md + - guides/v19.x/**/*.html + - guides/v19.x/**/*.md - swagger - redoc @@ -111,8 +115,12 @@ check_links: true ############# # # 1.x variables -m1xgdeurl: /guides/m1x/ -m1xgithuburl: https://github.com/OpenMage/devdocs/blob/master/ + +v1xgdeurl: /guides/v19.x +v1xgithuburl: https://github.com/OpenMage/devdocs/tree/master +v18xgdeurl: /guides/v1.8/ + +gdeurl23: https://devdocs.magento.com/redoc/2.3/ ########## # Ignore # @@ -136,3 +144,4 @@ exclude: - rakelib - README.md - _plugins + diff --git a/_data/footer-links.yml b/_data/footer-links.yml index b00b0689fe..ccf34ea047 100644 --- a/_data/footer-links.yml +++ b/_data/footer-links.yml @@ -2,16 +2,7 @@ url: https://github.com/OpenMage/devdocs/blob/master/.github/CONTRIBUTING.md - label: Glossary - url: https://magento.github.io/glossary/index.html?audience=developer - -- label: Privacy Policy - url: https://magento.com/legal/terms/privacy/ - -- label: Terms of Service - url: https://magento.com/legal/terms/ - -- label: License/Trademark FAQ - url: https://magento.com/legal/licensing/ + url: https://glossary.magento.com/ - label: Release Notes url: /release-notes/bk-release-notes.html diff --git a/_data/main-nav.yml b/_data/main-nav.yml index 2612022b96..91e83f575b 100644 --- a/_data/main-nav.yml +++ b/_data/main-nav.yml @@ -1,55 +1,12 @@ -- label: Cloud - children: - - - label: Cloud Guide - url: /cloud/bk-cloud.html - - - label: Cloud Architecture - url: /cloud/architecture/cloud-architecture.html - - - label: Local Development - url: /cloud/setup/first-time-setup.html - - - label: Docker quick reference - url: /cloud/docker/docker-quick-reference.html - - - label: Configure Environments - url: /cloud/env/environments.html - - - label: Upgrades and Patches - url: /cloud/project/project-upgrade-parent.html - - - label: Release Notes - url: /cloud/release-notes/cloud-tools.html - exclude_versions: ['2.0'] - - label: Setup children: - label: Installation Guide - url: /install-gde/bk-install-guide.html - - - label: Extension Update and System Upgrade Guide - url: /comp-mgr/bk-compman-upgrade-guide.html - exclude_versions: ['2.0', '2.1'] - - - label: Component Manager and System Upgrade Guide - url: /comp-mgr/bk-compman-upgrade-guide.html - include_versions: ['2.0', '2.1'] - - - label: Configuration Guide - url: /config-guide/bk-config-guide.html - - - label: Performance Best Practices - url: /performance-best-practices/introduction.html - exclude_versions: ['2.0','2.1'] + url: /install-gde/install-flow-diagram.html - label: Migration Guide url: /migration/bk-migration-guide.html - - label: Magento Commerce (Cloud) Guide - url: /cloud/bk-cloud.html - - label: Release Information url: /release-notes/bk-release-notes.html @@ -60,107 +17,54 @@ children: - label: Architecture - url: /architecture/bk-architecture.html + url: / - label: PHP Developer Guide - url: /extension-dev-guide/bk-extension-dev-guide.html + url: / - label: Extension Developer Best Practices - url: /ext-best-practices/bk-ext-best-practices.html + url: / - label: Module Reference Guide - url: /mrg/intro.html + url: / - label: Coding Standards - url: /coding-standards/bk-coding-standards.html + url: / - - label: Contributor Guide - url: /contributor-guide/contributing.html + - label: Contribute! + url: https://github.com/OpenMage/magento-lts - label: Frontend children: - label: Frontend Developer Guide - url: /frontend-dev-guide/bk-frontend-dev-guide.html - - - label: UI Components - url: /ui-components/ui-component.html - include_versions: ['2.0'] - - - label: UI Components Guide - url: /ui_comp_guide/bk-ui_comps.html - exclude_versions: ['2.0'] - - - label: JavaScript Developer Guide - url: /javascript-dev-guide/bk-javascript-dev-guide.html - - - label: Admin Design Pattern Library - url: /pattern-library/bk-pattern.html - - - label: Admin Style Guide - url: /design-styleguide/bk-styleguide.html - - - label: Magento PWA Documentation Site - url: https://magento-research.github.io/pwa-studio/ - include_versions: ['2.3'] + url: / - label: API children: - label: Get Started with Magento Web APIs - url: /get-started/bk-get-started-api.html + url: / - label: REST API Reference - url: /rest/bk-rest.html + url: /api/rest-api-index.html - label: SOAP API Reference - url: /soap/bk-soap.html - - - label: GraphQL Developer Guide - url: /graphql/ - include_versions: ['2.3'] - - - label: Marketplace EQP API Reference - url: /marketplace/eqp/api.html - exclude_versions: ['2.0'] - - - label: Magento BI Import REST API - url: https://developers.rjmetrics.com/ - exclude_versions: ['2.0'] + url: /api/soap-api-index.html - label: Testing children: - - label: Magento Testing Guide - url: /test/testing.html - - label: Functional Acceptance Testing (MFTF) url: /mftf/2.3/introduction.html exclude_versions: ['2.0', '2.1'] versionless: true - - label: Functional Testing - url: /mtf/mtf_introduction.html - - - label: Integration Testing - url: /test/integration/integration_test_execution.html - - - label: JavaScript Unit Testing - url: /test/js/jasmine.html - - - label: PHP Unit Testing - url: /test/unit/unit_test_execution.html - - - label: Web API Functional Testing - url: /get-started/web-api-functional-testing.html - -- - - label: Functional Areas children: - label: Advanced Reporting - url: /advanced-reporting/overview.html + url: exclude_versions: ['2.0','2.1'] - label: Checkout @@ -173,27 +77,7 @@ - label: Order Management url: http://omsdocs.magento.com/en/ - - label: Payment Integrations - url: /payments-integrations/bk-payments-integrations.html - - - label: Staging - url: /extension-dev-guide/staging.html - exclude_versions: ['2.0'] - -- label: Tutorials +- label: Old Documantation children: - - - label: Rest Tutorials - url: /rest/tutorials/index.html - exclude_versions: ['2.0'] - - - label: Customize Product Creation Form - url: /howdoi/customize_product.html - exclude_versions: ['2.0'] - - - label: Customize Checkout - url: /howdoi/checkout/checkout_overview.html - - - label: Magento Support - url: /community/resources/support.html - versionless: true + - label: Magento 1 Docs + url: / diff --git a/_data/toc/frontend-developer-guide.yml b/_data/toc/frontend-developer-guide.yml index 70cdcdd31e..f483872c85 100644 --- a/_data/toc/frontend-developer-guide.yml +++ b/_data/toc/frontend-developer-guide.yml @@ -4,6 +4,7 @@ pages: url: /frontend-dev-guide/bk-frontend-dev-guide.html - label: Conventional notations used in this Guide + include_versions: ["1.x"] url: /frontend-dev-guide/conventions.html - label: Magento cache overview @@ -16,9 +17,6 @@ pages: url: /frontend-dev-guide/themes/theme-general.html children: - - label: Themes overview - url: /frontend-dev-guide/themes/theme-overview.html - - label: Install a third-party storefront theme url: /frontend-dev-guide/themes/theme-install.html @@ -43,8 +41,8 @@ pages: - label: Magento theme structure url: /frontend-dev-guide/themes/theme-structure.html - - label: Theme inheritance - url: /frontend-dev-guide/themes/theme-inherit.html + - label: Theme fallback model + url: /frontend-dev-guide/themes/theme-fallback.html - label: Adding custom favicons url: /frontend-dev-guide/themes/favicon.html @@ -176,7 +174,7 @@ pages: url: /frontend-dev-guide/translations/translate_practice.html - label: Tools - include_versions: ["2.2", "2.3"] + include_versions: ["2.2", "2.3","1.x"] url: /frontend-dev-guide/tools/tools_overview.html children: diff --git a/_data/toc/installation-guide.yml b/_data/toc/installation-guide.yml index aefd73aec2..2ceb36c355 100644 --- a/_data/toc/installation-guide.yml +++ b/_data/toc/installation-guide.yml @@ -27,89 +27,34 @@ pages: - label: What is a docroot? url: /install-gde/basics/basics_docroot.html - - label: Getting Started - children: - - label: Helpful resources - url: /install-gde/install-resources-parent.html - children: - - - label: Installation quick reference (tutorial) - url: /install-gde/install-quick-ref.html - - - label: Installation flow diagram - url: /install-gde/install-resource-diagram.html - - - label: Installation roadmap (reference) - url: /install-gde/install-roadmap_part1.html - - label: Magento system requirements - url: /install-gde/system-requirements2.html - children: + - label: Prerequisites + url: /install-gde/prereq/prereq-overview.html + children: - - label: Magento technology stack requirements - url: /install-gde/system-requirements-tech.html + - label: Apache + url: /install-gde/prereq/apache.html - - label: Supported browsers - url: /install-gde/system-requirements_browsers.html + - label: nginx + url: /install-gde/prereq/nginx.html - - label: Transport Layer Security (TLS) requirements - children: + - label: PHP + url: /install-gde/prereq/php-settings.html - - label: TLS 1.2 requirement for PayPal - url: /install-gde/system-requirements_tls1-2.html + - label: MySQL + url: /install-gde/prereq/mysql.html - - label: TLS requirement for repo.magento.com - url: /install-gde/system-requirements_repo-tls1-2.html + - label: Get your authentication keys + url: /install-gde/prereq/connect-auth.html - - label: Prerequisites - url: /install-gde/prereq/prereq-overview.html + - label: Magento file system ownership and permissions children: - - label: Apache - url: /install-gde/prereq/apache.html - - - label: nginx - url: /install-gde/prereq/nginx.html - - - label: PHP - url: /install-gde/prereq/php-centos-ubuntu.html - include_versions: ["2.3"] - children: - - - label: Required PHP settings - url: /install-gde/prereq/php-settings.html - include_versions: ["2.3"] - - - label: PHP - include_versions: ["2.1", "2.2"] - children: - - - label: PHP for Centos - url: /install-gde/prereq/php-centos.html - include_versions: ["2.1", "2.2"] - - - label: PHP for Ubuntu - url: /install-gde/prereq/php-ubuntu.html - include_versions: ["2.1", "2.2"] - - - label: Required PHP settings - url: /install-gde/prereq/php-settings.html - include_versions: ["2.1", "2.2"] - - - label: MySQL - url: /install-gde/prereq/mysql.html - - - label: Get your authentication keys - url: /install-gde/prereq/connect-auth.html - - - label: Magento file system ownership and permissions - children: - - - label: Overview of ownership and permissions - url: /install-gde/prereq/file-sys-perms-over.html + - label: Overview of ownership and permissions + url: /install-gde/prereq/file-sys-perms-over.html - - label: Set pre-installation ownership and permissions - url: /install-gde/prereq/file-system-perms.html + - label: Set pre-installation ownership and permissions + url: /install-gde/prereq/file-system-perms.html - label: RabbitMQ url: /install-gde/prereq/install-rabbitmq.html @@ -159,11 +104,11 @@ pages: - label: Update installation dependencies url: /install-gde/install/prepare-install.html - - label: Get help with your installation - url: /install-gde/install/get-help.html + - label: Get help with your installation + url: /install-gde/install/get-help.html - - label: Install options - url: /install-gde/continue-to-install.html + - label: Install options + url: /install-gde/continue-to-install.html - label: Setup Wizard Install children: diff --git a/_data/toc/rest-api.yml b/_data/toc/rest-api.yml index daa9c75134..15fc1b0142 100644 --- a/_data/toc/rest-api.yml +++ b/_data/toc/rest-api.yml @@ -1,40 +1,17 @@ label: REST API Reference pages: - - label: Overview - url: /rest/bk-rest.html + - label: Introduction + url: api/rest/introduction.html - - label: Quick reference + - label: Authentication children: - - label: REST Endpoints (Swagger) - include_versions: ["2.0"] - url: http://devdocs.magento.com/swagger/index_20.html + - label: Authentication + url: /api/rest/authentication/oauth_authentication.html - - label: REST Endpoints (Swagger) - include_versions: ["2.1"] - url: http://devdocs.magento.com/swagger/index_21.html - - - label: REST Endpoints (Swagger) - include_versions: ["2.2"] - url: http://devdocs.magento.com/swagger/index_22.html - - - label: REST Endpoints (ReDoc) - include_versions: ["2.3"] - url: /redoc/2.3/ + - label: OAuth Configuration + url: /api/rest/authentication/oauth_configuration.html versionless: true - children: - - - label: Admin REST endpoints - url: /redoc/2.3/admin-rest-api.html - versionless: true - - - label: Customer REST endpoints - url: /redoc/2.3/customer-rest-api.html - versionless: true - - - label: Guest REST endpoints - url: /redoc/2.3/guest-rest-api.html - versionless: true - + - label: List of REST endpoints by module url: /rest/list.html @@ -44,36 +21,6 @@ pages: - label: Generate a local API reference url: /rest/generate-local.html - - label: Use REST endpoints - children: - - label: Search using REST - url: /rest/performing-searches.html - - - label: Retrieve filtered search responses - url: /rest/retrieve-filtered-responses.html - - - label: Restricting access to anonymous web APIs - url: /rest/anonymous-api-security.html - - - label: Asynchronous web endpoints - include_versions: ["2.3"] - url: /rest/asynchronous-web-endpoints.html - - - label: Bulk endpoints - include_versions: ["2.3"] - url: /rest/bulk-endpoints.html - - - label: Bulk operation status endpoints - include_versions: ["2.3"] - url: /rest/operation-status-endpoints.html - - - label: Search for the status of a bulk operation - include_versions: ["2.3"] - url: /rest/operation-status-search.html - - - label: Parameters in URLs - url: /rest/notes.html - - label: Tutorials url: /rest/tutorials/index.html include_versions: ["2.1", "2.2", "2.3"] diff --git a/_data/var.yml b/_data/var.yml index 1e23a8cc99..b9da503435 100644 --- a/_data/var.yml +++ b/_data/var.yml @@ -12,7 +12,7 @@ #NOTE: The new product name variables use the old product name abbreviations (e.g., ce, ee, ece, b2b). # Product Name variables - +om: OpenMage Magento-LTS ce: Magento Open Source ee: Magento Commerce b2b: Magento Commerce for B2B diff --git a/_includes/config/locate-session.md b/_includes/config/locate-session.md index 64d25fa8f0..f193612bb9 100644 --- a/_includes/config/locate-session.md +++ b/_includes/config/locate-session.md @@ -2,7 +2,7 @@ This topic discusses how to locate where your session files are stored. The Magento application uses the following logic to store session files: -* If you configured memcached, sessions are stored in RAM; for more information, see [Use memcached for session storage]({{ page.baseurl }}/config-guide/memcache/memcache.html). +* If you configured memcached, sessions are stored in RAM; for more information, see [Use memcached for session storage]({{ page.baseurl }}/). * If you configured Redis, sessions are stored on the Redis server; for more information, see [Use Redis for page caching or session storage]({{ page.baseurl }}/config-guide/redis/config-redis.html). * If you're using the default file-based session storage, we store sessions in the following locations in the order shown: diff --git a/_includes/install/flow-diagram.md b/_includes/install/flow-diagram.md index b95847b68f..3c08db5501 100644 --- a/_includes/install/flow-diagram.md +++ b/_includes/install/flow-diagram.md @@ -1,25 +1,22 @@ -{:width="1100px"} + The diagram shows the following: 1. Set up your server environment. - Install the prerequisite software, including PHP, Apache, and MySQL. Consult the system requirements for specific information: + Install the prerequisite software, including PHP, Apache, and MySQL. Consult the [system requirements]({{ site.v1xgdeurl }}/system-requirements.html) for specific information: - * [2.0.x system requirements]({{ site.gdeurl }}install-gde/system-requirements.html) - * [2.1.x system requirements]({{ site.gdeurl21 }}install-gde/system-requirements-tech.html) - * [2.2.x system requirements]({{ site.gdeurl22 }}install-gde/system-requirements-tech.html) +2. Get the Magento LTS software. -2. Get the Magento software. + * Download the latest archive and extract it, clone the repo, or add a composer dependency to your existing project like so: +```json +"openmage/magento-lts": "1.9.4.x" +``` - * For simplicity, get a compressed {{site.data.var.ce}} or {{site.data.var.ee}} [archive]({{ page.baseurl }}/install-gde/prereq/zip_install.html), extract it on your Magento server, and start your installation. + * Use one of the two compose install - * If you are more technical and you are familiar with Composer, get a {{site.data.var.ce}} or {{site.data.var.ee}} {% if page.guide_version == "2.0" %} [metapackage]({{page.baseurl}}/install-gde/prereq/integrator_install.html) {% else %} [metapackage]({{page.baseurl}}/install-gde/composer.html). {% endif %} + * If you want to contribute to the {{site.data.var.om}} codebase, customize the Magento application or fix and test your own code, [fork]({{ page.baseurl }}/install-gde/prereq/dev_install.html) the Magento-LTS GitHub repository. (This method requires familiarity with both GitHub.) Follow [Contributor] - * If you want to contribute to the {{site.data.var.ce}} codebase or customize the Magento application, [clone]({{ page.baseurl }}/install-gde/prereq/dev_install.html) the Magento 2 GitHub repository. (This method requires familiarity with both GitHub and Composer.) - - {:.bs-callout .bs-callout-info} - To be able to use the Web Setup Wizard to install or upgrade the Magento software, or to manage extensions you get from Magento Marketplace, you must either get a compressed archive or a Composer metapackage. If you clone the GitHub repository, you *cannot* use the Web Setup Wizard to upgrade the Magento software and extensions. You must upgrade using [Composer and Git commands]({{ page.baseurl }}/install-gde/install/cli/dev_options.html). 3. Install the Magento software using either the Web Setup Wizard or command line. @@ -27,6 +24,6 @@ The diagram shows the following: At each step, the Web Setup Wizard validates the information you entered. As shown in the preceding diagram, if validation fails, you must manually fix the issues before you proceed. - If the step fails because prerequisite software isn't set up correctly, review our [Prerequisites]({{ page.baseurl }}/install-gde/prereq/prereq-overview.html). + If the step fails because prerequisite software isn't set up correctly, review our [Prerequisites]({{ site.v1xgdeurl}}/install-gde/prereq/prereq-overview.html). 4. Verify the installation by viewing your storefront and the Magento Admin. diff --git a/_includes/install/php-extensions-template.md b/_includes/install/php-extensions-template.md new file mode 100644 index 0000000000..023dba619e --- /dev/null +++ b/_includes/install/php-extensions-template.md @@ -0,0 +1,25 @@ +* ext-ctype + +* ext-curl + +* ext-gd + +* ext-iconv + +* ext-json + +* ext-intl + +* ext-mbstring + +* ext-openssl + +* ext-pdo + +* ext-pdo_mysqli + +* ext-soap + +* ext-simplexml + +* ext-sockets \ No newline at end of file diff --git a/_includes/install/php-versions-1.9.md b/_includes/install/php-versions-1.9.md new file mode 100644 index 0000000000..f24d94e775 --- /dev/null +++ b/_includes/install/php-versions-1.9.md @@ -0,0 +1,4 @@ +Magento LTS supports PHP 7.3. + +{:.bs-callout-warning} +PHP 7.1 has reached [End of Life](https://www.php.net/supported-versions.php). To maintain PCI compliance, Magento should not be run on unsupported software. diff --git a/_includes/layout/header-styles.html b/_includes/layout/header-styles.html index 4502aeb6e6..554ce13322 100644 --- a/_includes/layout/header-styles.html +++ b/_includes/layout/header-styles.html @@ -1,2 +1,3 @@ + diff --git a/_includes/layout/header.html b/_includes/layout/header.html new file mode 100644 index 0000000000..ade522baa8 --- /dev/null +++ b/_includes/layout/header.html @@ -0,0 +1,34 @@ + + +
+ + + + +- For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported. -
-- For Magento Open Source 1.5 to 1.9, Magento is providing software security patches through June 2020 to ensure those sites remain secure and compliant. Visit our information page for more details about our software maintenance policy and other considerations for your business. -
-+ For Magento Commerce 1, Magento is providing software support through June 2020. Depending on your Magento Commerce 1 version, software support may include both quality fixes and security patches. Please review our Magento Software Lifecycle Policy to see how your version of Magento Commerce 1 is supported. +
++After its End of Life, Magento 1 will not be available for the general public. Adobe will remove all download links, links to the documentation and will stop releasing patches even for critical bugs and security issues. That’s where OpenMage comes in, keeping Magento CE healthy and up to the current standards.
+OpenMage LTS is designed to take place of Magento 1 and benefit its community. Please visit us at OpenMage Project
+Welcome to the Magento 1.x REST API home page.
- -\ No newline at end of file diff --git a/guides/m1x/api/rest/Resources/Orders/order_addresses.html b/guides/m1x/api/rest/Resources/Orders/order_addresses.html deleted file mode 100644 index ce36d34a85..0000000000 --- a/guides/m1x/api/rest/Resources/Orders/order_addresses.html +++ /dev/null @@ -1,288 +0,0 @@ ---- -layout: m1x_rest -title: Order Addresses ---- - - -
Allows you to retrieve information about billing and shipping addresses of the required order.
- -URL Structure: http://magentohost/api/rest/orders/:orderid/addresses
-Version: 1
Description: Allows you to retrieve information on billing and shipping addresses from the required order.
-Notes: Customers can retrieve addresses only from their orders.
Authentication: Admin, Customer
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/orders/32/addresses |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <region>Palau</region> - <postcode>19103</postcode> - <lastname>Doe</lastname> - <street>2356 Jody Road Philadelphia -844 Jefferson Street; 4510 Willis Avenue</street> - <city>PA</city> - <telephone>610-634-1181</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>billing</address_type> - <prefix>Dr.</prefix> - <middlename></middlename> - <suffix>Jr.</suffix> - <company></company> - </data_item> - <data_item> - <region>Massachusetts</region> - <postcode>01852</postcode> - <lastname>Doe</lastname> - <street>1073 Smith Street</street> - <city>Lowell</city> - <telephone>508-857-6870</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>shipping</address_type> - <prefix></prefix> - <middlename></middlename> - <suffix></suffix> - <company></company> - </data_item> -</magento_api>-
Description: Not allowed.
- -Description: Not allowed.
- -Description: Not allowed.
- -Description: Allows you to retrieve information on the order billing address.
-Notes: Customers can retrieve information on billing addresses only from their own orders.
Authentication: Admin, Customer
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/orders/32/addresses/billing |
Response example:
-<?xml version="1.0"?> -<magento_api> - <region>Palau</region> - <postcode>19103</postcode> - <lastname>Doe</lastname> - <street>2356 Jody Road Philadelphia -844 Jefferson Street; 4510 Willis Avenue</street> - <city>PA</city> - <telephone>610-634-1181</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>billing</address_type> - <prefix>Dr.</prefix> - <middlename></middlename> - <suffix>Jr.</suffix> - <company></company> -</magento_api>-
Description: Not allowed.
- -Description: Not allowed.
- -Description: Not allowed.
- - -Description: Allows you to retrieve information on the order shipping address.
-Notes: Customers can retrieve information on shipping addresses only from their own orders.
Authentication: Admin, Customer
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/orders/32/addresses/shipping |
Response example:
-<?xml version="1.0"?> -<magento_api> - <region>Massachusetts</region> - <postcode>01852</postcode> - <lastname>Doe</lastname> - <street>1073 Smith Street</street> - <city>Lowell</city> - <telephone>508-857-6870</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>shipping</address_type> - <prefix></prefix> - <middlename></middlename> - <suffix></suffix> - <company></company> -</magento_api>-
Description: Not allowed.
- -Description: Not allowed.
- -Description: Not allowed.
- -| Attribute Name | -Attribute Description | -
|---|---|
| Customer Last Name | -Customer last name | -
| Customer First Name |
-Customer first name | -
| Customer Middle Name |
-Customer middle name or initial | -
| Customer Prefix |
-Customer prefix | -
| Customer Suffix |
-Customer suffix | -
| Company |
-Company name | -
| Street |
-Street address | -
| City |
-City | -
| State |
-State | -
| ZIP/Postal Code |
-ZIP or postal code | -
| Country |
-Country name | -
| Phone Number |
-Customer phone number | -
| Address Type |
-Address type. Can have the following values: billing or shipping | -
Allows you to retrieve information about comments of the required order.
- -URL Structure: http://magentohost/api/rest/orders/:orderid/comments
-Version: 1
Description: Allows you to retrieve information about comments of the required order.
- -Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/orders/33/comments |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <created_at>2012-03-09 11:20:49</created_at> - <comment></comment> - <is_customer_notified>1</is_customer_notified> - <is_visible_on_front>0</is_visible_on_front> - <status>pending</status> - </data_item> - <data_item> - <created_at>2012-03-09 11:21:32</created_at> - <comment>This is a new order for John Doe.</comment> - <is_customer_notified>1</is_customer_notified> - <is_visible_on_front>1</is_visible_on_front> - <status>pending</status> - </data_item> -</magento_api>-
Authentication: Customer
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/orders/33/comments |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <created_at>2012-03-09 11:21:32</created_at> - <comment>This is a new order for John Doe.</comment> - </data_item> -</magento_api>-
Description: Not allowed.
- -Description: Not allowed.
- -Description: Not allowed.
- - - -| Attribute Name | -Attribute Description | -Notes | -
|---|---|---|
| Comment Date | -Date when the comment was added | -Admin and Customer | -
| Comment Text | -Comment text | -Admin and Customer | -
| Is Customer Notified | -Defines whether the customer is notified about the comment. Can have the following values: 0 - Customer is not notified, 1 - Customer is notified. | -Admin only | -
| Is Comment Visible on Frontend | -Defines whether the comment is visible on the frontend. Can have the following values: 0 - Comment is not visible, 1 - Comment is visible. | - Admin only |
-
| Comment Status | -Comment status. | - Admin only |
-
Allows you to retrieve information about order items.
- -URL Structure: http://magentohost/api/rest/orders/:orderId/items
-Version: 1
Description: Allows you to retrieve the list of existing order items with detailed items information.
-Notes: The list of attributes that will be returned for order items is configured in the Magento Admin Panel.
Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
Response Example: XML
- -| GET http://magentohost/api/rest/orders/410/items |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <item_id>43</item_id> - <parent_item_id></parent_item_id> - <sku>Sunglasses_1</sku> - <name>Sunglasses 1</name> - <qty_canceled>0.0000</qty_canceled> - <qty_invoiced>0.0000</qty_invoiced> - <qty_ordered>3.0000</qty_ordered> - <qty_refunded>0.0000</qty_refunded> - <qty_shipped>0.0000</qty_shipped> - <price>74.9137</price> - <base_price>106.0050</base_price> - <original_price>106.0050</original_price> - <base_original_price>150.0000</base_original_price> - <tax_percent>8.2500</tax_percent> - <tax_amount>26.2500</tax_amount> - <base_tax_amount>37.1400</base_tax_amount> - <discount_amount>212.0100</discount_amount> - <base_discount_amount>300.0000</base_discount_amount> - <row_total>318.0300</row_total> - <base_row_total>450.0000</base_row_total> - <price_incl_tax>114.7550</price_incl_tax> - <base_price_incl_tax>162.3800</base_price_incl_tax> - <row_total_incl_tax>344.2650</row_total_incl_tax> - <base_row_total_incl_tax>487.1400</base_row_total_incl_tax> - <status>Ordered</status> - </data_item> - <data_item> - <item_id>44</item_id> - <parent_item_id></parent_item_id> - <sku>test_simple_product</sku> - <name>test simple product</name> - <qty_canceled>0.0000</qty_canceled> - <qty_invoiced>0.0000</qty_invoiced> - <qty_ordered>10.0000</qty_ordered> - <qty_refunded>0.0000</qty_refunded> - <qty_shipped>0.0000</qty_shipped> - <price>249.7124</price> - <base_price>353.3500</base_price> - <original_price>353.3500</original_price> - <base_original_price>500.0000</base_original_price> - <tax_percent>8.2500</tax_percent> - <tax_amount>291.5000</tax_amount> - <base_tax_amount>412.5000</base_tax_amount> - <discount_amount>706.7000</discount_amount> - <base_discount_amount>1000.0000</base_discount_amount> - <row_total>3533.5000</row_total> - <base_row_total>5000.0000</base_row_total> - <price_incl_tax>382.5000</price_incl_tax> - <base_price_incl_tax>541.2500</base_price_incl_tax> - <row_total_incl_tax>3825.0000</row_total_incl_tax> - <base_row_total_incl_tax>5412.5000</base_row_total_incl_tax> - <status>Ordered</status> - </data_item> -</magento_api>-
Authentication: Customer
-Default Format: XML
-Parameters:
-No Parameters
Response Example: XML
- -| GET http://magentohost/api/rest/orders/410/items |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <item_id>43</item_id> - <parent_item_id></parent_item_id> - <sku>Sunglasses_1</sku> - <name>Sunglasses 1</name> - <qty_canceled>0.0000</qty_canceled> - <qty_invoiced>0.0000</qty_invoiced> - <qty_ordered>3.0000</qty_ordered> - <qty_refunded>0.0000</qty_refunded> - <qty_shipped>0.0000</qty_shipped> - <price>74.9137</price> - <row_total>318.0300</row_total> - <price_incl_tax>114.7550</price_incl_tax> - <row_total_incl_tax>344.2650</row_total_incl_tax> - </data_item> - <data_item> - <item_id>44</item_id> - <parent_item_id></parent_item_id> - <sku>test_simple_product</sku> - <name>test simple product</name> - <qty_canceled>0.0000</qty_canceled> - <qty_invoiced>0.0000</qty_invoiced> - <qty_ordered>10.0000</qty_ordered> - <qty_refunded>0.0000</qty_refunded> - <qty_shipped>0.0000</qty_shipped> - <price>249.7124</price> - <row_total>3533.5000</row_total> - <price_incl_tax>382.5000</price_incl_tax> - <row_total_incl_tax>3825.0000</row_total_incl_tax> - </data_item> -</magento_api>-
Description: Not allowed.
- -Description: Not allowed.
- -Description: Not allowed.
- - - - diff --git a/guides/m1x/api/rest/Resources/Orders/sales_orders.html b/guides/m1x/api/rest/Resources/Orders/sales_orders.html deleted file mode 100644 index 74247b8cc1..0000000000 --- a/guides/m1x/api/rest/Resources/Orders/sales_orders.html +++ /dev/null @@ -1,367 +0,0 @@ ---- -layout: m1x_rest -title: Sales Orders ---- - - -Allows you to retrieve information on existing order/orders.
- -URL Structure: http://magentohost/api/rest/orders
-Version: 1
Description: Allows you to retrieve the list of existing orders. Each order contains the following information: general order information, information on ordered items, order comments, and order addresses (both billing and shipping).
-The list of attributes that will be returned for the order is configured in the Magento Admin Panel.
Authentication: Admin, Customer, Guest
-Default Format: XML
Response Example: XML
- -| GET http://magentohost/api/rest/orders |
<?xml version="1.0"?> -<magento_api> - <data_item_1> - <customer_id>3</customer_id> - <base_discount_amount>0.0000</base_discount_amount> - <base_shipping_amount>455.0000</base_shipping_amount> - <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> - <base_subtotal>13650.0000</base_subtotal> - <base_tax_amount>0.0000</base_tax_amount> - <base_total_paid></base_total_paid> - <base_total_refunded></base_total_refunded> - <tax_amount>0.0000</tax_amount> - <total_paid></total_paid> - <total_refunded></total_refunded> - <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> - <base_subtotal_incl_tax>13650.0000</base_subtotal_incl_tax> - <base_total_due>14105.0000</base_total_due> - <total_due>14105.0000</total_due> - <base_currency_code>USD</base_currency_code> - <tax_name></tax_name> - <tax_rate></tax_rate> - <addresses> - <data_item> - <region>Palau</region> - <postcode>19103</postcode> - <lastname>Doe</lastname> - <street>2356 Jody Road Philadelphia, PA 19103</street> - <city>PA</city> - <telephone>610-634-1181</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>billing</address_type> - <prefix></prefix> - <middlename></middlename> - <suffix></suffix> - <company></company> - </data_item> - <data_item> - <region>Palau</region> - <postcode>19103</postcode> - <lastname>Doe</lastname> - <street>2356 Jody Road Philadelphia, PA 19103</street> - <city>PA</city> - <telephone>610-634-1181</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>shipping</address_type> - <prefix></prefix> - <middlename></middlename> - <suffix></suffix> - <company></company> - </data_item> - </addresses> - <order_items> - <data_item> - <sku>Sunglasses_1</sku> - <price>150.0000</price> - <base_price>150.0000</base_price> - <base_original_price>150.0000</base_original_price> - <tax_percent>0.0000</tax_percent> - <tax_amount>0.0000</tax_amount> - <base_tax_amount>0.0000</base_tax_amount> - <base_discount_amount>0.0000</base_discount_amount> - <base_row_total>13650.0000</base_row_total> - <base_price_incl_tax>150.0000</base_price_incl_tax> - <base_row_total_incl_tax>13650.0000</base_row_total_incl_tax> - </data_item> - </order_items> - </data_item_1> - <data_item_2> - <customer_id>3</customer_id> - <base_discount_amount>0.0000</base_discount_amount> - <base_shipping_amount>95.0000</base_shipping_amount> - <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> - <base_subtotal>3350.0000</base_subtotal> - <base_tax_amount>0.0000</base_tax_amount> - <base_total_paid>2445.0000</base_total_paid> - <base_total_refunded>1845.0000</base_total_refunded> - <tax_amount>0.0000</tax_amount> - <total_paid>2445.0000</total_paid> - <total_refunded>1845.0000</total_refunded> - <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> - <base_subtotal_incl_tax>3350.0000</base_subtotal_incl_tax> - <base_total_due>1000.0000</base_total_due> - <total_due>1000.0000</total_due> - <base_currency_code>USD</base_currency_code> - <tax_name></tax_name> - <tax_rate></tax_rate> - <addresses> - <data_item> - <region>Palau</region> - <postcode>19103</postcode> - <lastname>Doe</lastname> - <street>2356 Jody Road Philadelphia, PA 19103</street> - <city>PA</city> - <telephone>610-634-1181</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>billing</address_type> - <prefix></prefix> - <middlename></middlename> - <suffix></suffix> - <company></company> - </data_item> - <data_item> - <region>Palau</region> - <postcode>19103</postcode> - <lastname>Doe</lastname> - <street>2356 Jody Road Philadelphia, PA 19103</street> - <city>PA</city> - <telephone>610-634-1181</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>shipping</address_type> - <prefix></prefix> - <middlename></middlename> - <suffix></suffix> - <company></company> - </data_item> - </addresses> - <order_items> - <data_item> - <sku>Sunglasses_1</sku> - <price>150.0000</price> - <base_price>150.0000</base_price> - <base_original_price>150.0000</base_original_price> - <tax_percent>0.0000</tax_percent> - <tax_amount>0.0000</tax_amount> - <base_tax_amount>0.0000</base_tax_amount> - <base_discount_amount>0.0000</base_discount_amount> - <base_row_total>1350.0000</base_row_total> - <base_price_incl_tax>150.0000</base_price_incl_tax> - <base_row_total_incl_tax>1350.0000</base_row_total_incl_tax> - </data_item> - <data_item> - <sku>Sun_glasses</sku> - <price>200.0000</price> - <base_price>200.0000</base_price> - <base_original_price>200.0000</base_original_price> - <tax_percent>0.0000</tax_percent> - <tax_amount>0.0000</tax_amount> - <base_tax_amount>0.0000</base_tax_amount> - <base_discount_amount>0.0000</base_discount_amount> - <base_row_total>2000.0000</base_row_total> - <base_price_incl_tax>200.0000</base_price_incl_tax> - <base_row_total_incl_tax>2000.0000</base_row_total_incl_tax> - </data_item> - </order_items> - </data_item_2> -</magento_api>-
Description: Not implemented.
- - -Description: Not implemented.
- - -Description: Not implemented.
- -Allows you to retrieve information on a single order.
-The list of attributes that will be returned for the order is configured in the Magento Admin Panel.
URL Structure: http://magentohost/api/rest/orders/:id
-Version: 1
Description: Allows you to retrieve the order information.
-Authentication: Admin, Customer
-Default Format: XML
Response Example: XML
- -| GET http://magentohost/api/rest/orders/32 |
<?xml version="1.0"?> -<magento_api> - <customer_id>3</customer_id> - <base_discount_amount>0.0000</base_discount_amount> - <base_shipping_amount>0.0000</base_shipping_amount> - <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> - <base_subtotal>5220.0000</base_subtotal> - <base_tax_amount>430.6500</base_tax_amount> - <base_total_paid></base_total_paid> - <base_total_refunded></base_total_refunded> - <tax_amount>304.3300</tax_amount> - <total_paid></total_paid> - <total_refunded></total_refunded> - <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> - <base_subtotal_incl_tax></base_subtotal_incl_tax> - <base_total_due></base_total_due> - <total_due></total_due> - <base_currency_code>USD</base_currency_code> - <tax_name>US-CA-*-Rate 1</tax_name> - <tax_rate>8.2500</tax_rate> - <addresses> - <data_item> - <region>Palau</region> - <postcode>19103</postcode> - <lastname>Doe</lastname> - <street>2356 Jody Road Philadelphia -844 Jefferson Street; 4510 Willis Avenue</street> - <city>PA</city> - <telephone>610-634-1181</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>billing</address_type> - <prefix>Dr.</prefix> - <middlename></middlename> - <suffix>Jr.</suffix> - <company></company> - </data_item> - <data_item> - <region>Palau</region> - <postcode>19103</postcode> - <lastname>Doe</lastname> - <street>2356 Jody Road Philadelphia -844 Jefferson Street; 4510 Willis Avenue</street> - <city>PA</city> - <telephone>610-634-1181</telephone> - <country_id>US</country_id> - <firstname>John</firstname> - <address_type>shipping</address_type> - <prefix>Dr.</prefix> - <middlename></middlename> - <suffix>Jr.</suffix> - <company></company> - </data_item> - </addresses> - <order_items> - <data_item> - <sku>Sun_glasses</sku> - <price>141.3400</price> - <base_price>200.0000</base_price> - <base_original_price>200.0000</base_original_price> - <tax_percent>8.2500</tax_percent> - <tax_amount>11.6600</tax_amount> - <base_tax_amount>16.5000</base_tax_amount> - <base_discount_amount>0.0000</base_discount_amount> - <base_row_total>200.0000</base_row_total> - <base_price_incl_tax>216.5000</base_price_incl_tax> - <base_row_total_incl_tax>216.5000</base_row_total_incl_tax> - </data_item> - <data_item> - <sku>Virtual_product</sku> - <price>14.1340</price> - <base_price>20.0000</base_price> - <base_original_price>20.0000</base_original_price> - <tax_percent>8.2500</tax_percent> - <tax_amount>1.1700</tax_amount> - <base_tax_amount>1.6500</base_tax_amount> - <base_discount_amount>0.0000</base_discount_amount> - <base_row_total>20.0000</base_row_total> - <base_price_incl_tax>21.6500</base_price_incl_tax> - <base_row_total_incl_tax>21.6500</base_row_total_incl_tax> - </data_item> - <data_item> - <sku>test_simple_product</sku> - <price>353.3500</price> - <base_price>500.0000</base_price> - <base_original_price>500.0000</base_original_price> - <tax_percent>8.2500</tax_percent> - <tax_amount>291.5000</tax_amount> - <base_tax_amount>412.5000</base_tax_amount> - <base_discount_amount>0.0000</base_discount_amount> - <base_row_total>5000.0000</base_row_total> - <base_price_incl_tax>541.2500</base_price_incl_tax> - <base_row_total_incl_tax>5412.5000</base_row_total_incl_tax> - </data_item> - </order_items> -</magento_api>-
Description: Not implemented.
- - -Description: Not implemented.
- - -Description: Not implemented.
- - - - diff --git a/guides/m1x/api/rest/Resources/Products/product_categories.html b/guides/m1x/api/rest/Resources/Products/product_categories.html deleted file mode 100644 index 4366fd409c..0000000000 --- a/guides/m1x/api/rest/Resources/Products/product_categories.html +++ /dev/null @@ -1,155 +0,0 @@ ---- -layout: m1x_rest -title: Product Categories ---- - - -Allows you to retrieve information about assigned categories, assign, and unassign a category from/to a product.
- -URL Structure: http://magentohost/api/rest/products/productid/categories
-Version: 1
Description: Allows you to retrieve information about categories assigned to the specified product.
- - -Authentication: Admin, Customer
-Default Format: JSON
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/products/8/categories |
Response Body:
-{
- category_id: 8
-}
- Description: Allows you to assign a category to a specified product.
- - -Authentication: Admin
-Default Format: JSON
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| category_id | -The category ID | -required | -int | -2 | -
Example:
- -| POST http://magentohost/api/rest/products/8/categories |
Request Body:
-{
-"category_id":"2"
-}
- As a result, the category with ID equal to 2 will be assigned to the specified product.
- - -Description: Allows you to unassign a category from a specified product.
- - -Authentication: Admin
-Default Format: JSON
-Parameters:
-No Parameters
Example:
- -| DELETE http://magentohost/api/rest/products/8/categories/2 |
| Status Code | -Message | -Description | -
|---|---|---|
| 400 | -Product <product ID> is already assigned to category <category ID> | -The message is returned when the required category is already assigned to the product | -
| 400 | -Category not found | -The specified category is not found | -
| 405 | -Resource method not implemented yet | -The specified method is not implemented yet | -
Allows you to manage images of the required product.
- -URL Structure: http://magentohost/api/rest/products/:product_id/images
-Version: 1
Description: Allows you to retrieve information about all images of a specified product.
-Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/products/8/images |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <id>5</id> - <label></label> - <position>1</position> - <exclude>0</exclude> - <url>http://magento/media/catalog/product/v/e/ve2011.jpg</url> - <types> - <data_item>image</data_item> - <data_item>thumbnail</data_item> - </types> - </data_item> - <data_item> - <id>7</id> - <label>second dress</label> - <position>2</position> - <exclude>1</exclude> - <url>http://magento/media/catalog/product/1/2/12.jpg</url> - <types> - <data_item>small_image</data_item> - </types> - </data_item> -</magento_api>-
Description: Allows you to add an image for the required product.
- - -Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| file_mime_type | -File mime type. Can have the following values: image/jpeg, image/png, etc. | -required | -string | -image/jpeg | -
| file_content | -Graphic image file content (base_64 encoded) | -required | -string | -iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg== | -
| file_name | -Name for the added image file | -optional | -string | -new image | -
Note: If the file_name parameter is not defined, the original file name is set for the image. The first created image will be called "image", the second created image will be called "image_2", etc.
- -Example:
- -| POST http://magentohost/api/rest/products/1/images |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <file_mime_type>image/jpeg</file_mime_type> <file_content>iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==</file_content> -</magento_api>-
Allows you to manage product images for a specified store.
- -URL Structure: http://magentohost/api/rest/products/:product_id/images/store/:store_id
-Version: 1
Description: Allows you to retrieve information about product images for a specified store view.
-Notes: Images can have different labels for different stores. For example, image label "flower" in the English store view can be set as "fleur" in the French store view. If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/products/8/images/store/2 |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <id>6</id> - <label>white dress</label> - <position>1</position> - <exclude>0</exclude> - <url>http://magento/media/catalog/product/1/2/12.jpg</url> - <types> - <data_item>image</data_item> - <data_item>small_image</data_item> - <data_item>thumbnail</data_item> - </types> - </data_item> -</magento_api>-
Description: Allows you to add an image for the required product with image settings for a specific store.
-Notes: The image is added on the Global level; specified image parameters are set for a specific store.
Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| file_mime_type | -File mime type. Can have the following values: image/jpeg, image/png, etc. | -required | -string | -image/png | -
| file_content | -Graphic image file content (base_64 encoded) | -required | -string | -iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg== | -
| file_name | -Name for the added image file | -optional | -string | -test image | -
Note: If the file_name parameter is not defined, the original file name is set for the image. The first created image will be called "image", the second created image will be called "image_2", etc.
- -Example:
- -| POST http://magentohost/api/rest/products/8/images/store/3 |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <file_mime_type>image/jpeg</file_mime_type> <file_content>iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==</file_content> -</magento_api>-
Allows you to manage a specified product image.
- -URL Structure: http://magentohost/api/rest/products/:product_id/images/:image_id
-Version: 1
Description: Allows you to retrieve information about a specified product image.
-Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/products/8/images/7 |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <id>7</id> - <label>second dress</label> - <position>2</position> - <exclude>1</exclude> - <url>http://magento/media/catalog/product/1/2/12.jpg</url> - <types> - <data_item>small_image</data_item> - </types> -</magento_api>-
Description: Allows you to update information for the specified product image.
-Notes: When updating information, you need to pass only those parameters that you want to be updated. Parameters that were not passed in the request, will preserve the previous values.
Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example | -
|---|---|---|---|---|
| exclude | -Defines whether the image will associate only to one of the three image types. | -optional | -int | -0 | -
| file_content | -Image file content (base_64 encoded). | -optional | -string | -base_64 encoded file content | -
| file_mime_type | -File mime type. Can have the following values: image/jpeg, image/png, etc. | -optional | -string | -image/png | -
| file_name | -Image file name. | -optional | -string | -test name | -
| label | -A label that will be displayed on the frontend when pointing to the image | -optional | -string | -test label | -
| position | -The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. | -optional | -int | -1 | -
| types | -Array of image types. Can have the following values: image, small_image, and thumbnail. | -optional | -array | -thumbnail | -
Example:
- -| PUT http://magentohost/api/rest/products/8/images/7 |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <label>English store image</label> - <position>3</position> - <exclude>0</exclude> - <types> - <data_item>image</data_item> - <data_item>small_image</data_item> - <data_item>thumbnail</data_item> - </types> -</magento_api>-
Description: Allows you to remove the specified image from a product.
-Notes: The image will not be deleted physically, the image parameters will be set to No Image.
Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| DELETE http://magentohost/api/rest/products/14/images/6 |
Allows you to manage a specified product image for a specified store.
- -URL Structure: http://magentohost/api/rest/products/:product_id/images/:image_id/store/:store_id
-Version: 1
Description: Allows you to retrieve information about the specified product image from a specified store.
-Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/products/8/images/7/store/3 |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <id>10</id> - <label></label> - <position>5</position> - <exclude>1</exclude> - <url>http://magento/media/catalog/product/n/e/new_image.gif</url> - <types/> -</magento_api>-
Description: Allows you to update the specified product image information for s specified store.
-Notes: When updating information, you need to pass only those parameters that you want to be updated. Parameters that were not passed in the request will preserve the previous values.
Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example | -
|---|---|---|---|---|
| exclude | -Defines whether the image will associate only to one of the three image types. | -optional | -int | -0 | -
| file_content | -Image file content (base_64 encoded). | -optional | -string | -base_64 encoded file content | -
| file_mime_type | -File mime type. Can have the following values: image/jpeg, image/png, etc. | -optional | -string | -image/png | -
| file_name | -Image file name. | -optional | -string | -test name | -
| label | -A label that will be displayed on the frontend when pointing to the image | -optional | -string | -test label | -
| position | -The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. | -optional | -int | -1 | -
| types | -Array of image types. Can have the following values: image, small_image, and thumbnail. | -optional | -array | -thumbnail | -
Example:
- -| PUT http://magentohost/api/rest/products/8/images/7/store/3 |
Request Body:
-<?xml version="1.0"?> -<magento_api> -Â <position>3</position> -Â <exclude>0</exclude> -Â <types> -Â Â Â <data_item>image</data_item> -Â Â </types> -</magento_api>-
Description: Allows you to remove an image from the required product in the specified store.
-Notes: The image will not be deleted physically, the image parameters will be set to No Image for the current store.
Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| DELETE http://magentohost/api/rest/products/14/images/6/store/3 |
| Status Code | -Message | -Description | -
|---|---|---|
| 400 | - Requested store is invalid |
-The specified store is not valid or does not exist | -
| 404 | -Resource not found | -The specified resource is not found or does not exist | -
| 404 | -Product image not found | -The specified product image is not found or does not exist | -
| 400 | -Resource data pre-validator error | -Resource validation error | -
| 400 | - The image content must be valid base64 encoded data |
-The image file content must be in the base_64 encoded format (when image content does not contain supported letters and symbols) | -
| 400 | - Requested product does not support images |
-The specified product does not support images adding | -
| 400 | - Unsupported image MIME type |
-The image MIME type is not supported (e.g., image/bmp) | -
| 400 | - Resource unknown error |
-Resource unknown error | -
| 500 | - Resource internal error |
-Resource internal error | -
| - | - The image is not specified |
-The image is not specified during the POST request. | -
Allows you to retrieve information about websites assigned to a product, assign a website to a product, and copy data for a product from a specified store view.
- -URL Structure: http://magentohost/api/rest/products/:product_id/websites
-Version: 1
Description: Allows you to retrieve information about websites assigned to the specified product.
- - -Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/products/8/websites |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <website_id>2</website_id> - </data_item> -</magento_api>-
Description: Allows you to assign a website to a specified product.
- - -Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| website_id | -The website ID | -required | -int | -2 | -
Example:
- -| POST http://magentohost/api/rest/products/8/websites |
Request Body:
-<?xml version="1.0"?> -<magento_api> -Â Â <website_id>1</website_id> -</magento_api>-
Response Body:
- -<?xml version="1.0"?> -<magento_api> - <success> - <data_item> - <website_id>1</website_id> - <product_id>8</product_id> - <message>Resource updated successful.</message> - <code>200</code> - </data_item> - </success> -</magento_api>-
-
Description: Allows you to assign a website and copy product data from the attached store to the one being attached. Only product data that is set on the Store View level is copied. All other data set on the Website or Global levels is not copied.
- - -Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| website_id | -The website ID | -required | -int | -2 | -
| store_from | -The store ID from which data will be copied | -required | -int | -1 | -
| store_to | -The store ID to which data will be copied | -required | -int | -2 | -
Notes: The store_to parameter must belong to the website which we want to assign to a product.
- -Example:
- -| POST http://magentohost/api/rest/products/8/websites |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <website_id>2</website_id> - <copy_to_stores> - <data_item> - <store_from>1</store_from> - <store_to>2</store_to> - </data_item> - </copy_to_stores> -</magento_api>-
-
Description: Allows you to assign multiple websites to a product.
- - -Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| website_id | -The website ID | -required | -int | -2 | -
Example:
- -| POST http://magentohost/api/rest/products/8/websites |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <website_id>1</website_id> - </data_item> - <data_item> - <website_id>3</website_id> - </data_item> -</magento_api>-
Response Body:
- -<?xml version="1.0"?> -<magento_api> - <success> - <data_item> - <website_id>1</website_id> - <product_id>8</product_id> - <message>Resource updated successful.</message> - <code>200</code> - </data_item> - <data_item> - <website_id>3</website_id> - <product_id>8</product_id> - <message>Resource updated successful.</message> - <code>200</code> - </data_item> - </success> -</magento_api>-
-
Description: Allows you to assign multiple websites to a product together with copying product data from the attached store to the one being attached. Only product data that is set on the Store View level is copied. All other data set on the Website or Global levels is not copied.
- - -Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| website_id | -The website ID | -required | -int | -2 | -
| store_from | -The store ID from which data will be copied | -required | -int | -1 | -
| store_to | -The store ID to which data will be copied | -required | -int | -2 | -
Example:
- -| POST http://magentohost/api/rest/products/8/websites |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <website_id>2</website_id> - <copy_to_stores> - <data_item> - <store_from>1</store_from> - <store_to>2</store_to> - </data_item> - </copy_to_stores> - </data_item> - <data_item> - <website_id>3</website_id> - <copy_to_stores> - <data_item> - <store_from>1</store_from> - <store_to>5</store_to> - </data_item> - </copy_to_stores> - </data_item> -</magento_api>-
Response Body:
- -<?xml version="1.0"?> -<magento_api> - <success> - <data_item> - <website_id>2</website_id> - <product_id>8</product_id> - <message>Resource updated successful.</message> - <code>200</code> - </data_item> - <data_item> - <website_id>3</website_id> - <product_id>8</product_id> - <message>Resource updated successful.</message> - <code>200</code> - </data_item> - </success> -</magento_api>-
-
Allows you to unassign a website from a specified product.
- -URL Structure: http://magentohost/api/rest/products/:product_id/websites/:website_id
-Version: 1
Description: Allows you to unassign a website from a specified product.
- - -Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| DELETE http://magentohost/api/rest/products/8/websites/1 |
| Status Code | -Message | -Description | -
|---|---|---|
| 404 | -Product not found | -The specified product is not found or does not exist. | -
| 404 | -Website not found | -The specified website is not found or does not exist. | -
| 400 | -Invalid value for "store_from" for the website with ID <ID value>. | -The entered value for "store_from" is not valid. | -
| 400 | - Invalid value for "store_to" for the website with ID <ID value>. |
-The entered value for "store_to" is not valid. | -
| 400 | -Store not found <store ID> for website <website ID>. | -The specified store is not found or does not exist. | -
| 400 | -Store <store ID> from which we will copy the information does not belong to the product <product ID> being edited. | -The specified store is not assigned to the product. | -
| 400 | -Store <store ID> to which we will copy the information does not belong to the website <website ID> being added. | -The specified store does not belong to the website. | -
| 400 | -Product <product ID> isn't assigned to website <website ID>. | -The specified product is not assigned to the website. | -
| 400 | -Invalid value for "website_id" in request. | -The value for "website_id" is not valid. | -
Allows you to retrieve the list of all products with detailed information.
- -URL Structure: http://magentohost/api/rest/products
-Version: 1
Description: Allows you to retrieve the list of all products with detailed information.
-Notes: The list of attributes that will be returned in the response is configured in the Magento Admin Panel. The list of attributes differs for each type of user.
Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
| GET http://magentohost/api/rest/products |
Response Example: XML
- -<?xml version="1.0"?> -<magento_api> - <data_item> - <entity_id>1</entity_id> - <type_id>simple</type_id> - <sku>dress_test</sku> - <status>1</status> - <visibility>4</visibility> - <tax_class_id>2</tax_class_id> - <weight>1.0000</weight> - <price>1500.0000</price> - <special_price>1000.0000</special_price> - <name>Wedding dress</name> - <url_key>dress</url_key> - <country_of_manufacture>AO</country_of_manufacture> - <msrp_display_actual_price_type>2</msrp_display_actual_price_type> - <gift_message_available>1</gift_message_available> - <news_from_date>2012-03-21 00:00:00</news_from_date> - <news_to_date>2012-03-24 00:00:00</news_to_date> - <special_from_date>2012-03-21 00:00:00</special_from_date> - <special_to_date>2012-03-24 00:00:00</special_to_date> - <description>White wedding dress</description> - </data_item> - <data_item> - <entity_id>2</entity_id> - <type_id>simple</type_id> - <sku>black_sunglasses</sku> - <status>1</status> - <visibility>4</visibility> - <tax_class_id>2</tax_class_id> - <weight>0.2000</weight> - <price>500.0000</price> - <special_price>300.0000</special_price> - <name>Sunglasses</name> - <url_key>sunglasses</url_key> - <country_of_manufacture>AR</country_of_manufacture> - <msrp_display_actual_price_type>2</msrp_display_actual_price_type> - <gift_message_available></gift_message_available> - <news_from_date></news_from_date> - <news_to_date></news_to_date> - <special_from_date>2012-03-21 00:00:00</special_from_date> - <special_to_date>2012-03-24 00:00:00</special_to_date> - <description>Black sunglasses</description> - </data_item> -</magento_api>-
Response Example: JSON
- -{"1":{"entity_id":"1","type_id":"simple","sku":"dress_test","status":"1","visibility":"4","tax_class_id":"2","weight":"1.0000","price":"1500.0000","special_price":"1000.0000","name":"Wedding dress","url_key":"dress","country_of_manufacture":"AO","msrp_display_actual_price_type":"2","gift_message_available":"1","news_from_date":"2012-03-21 00:00:00","news_to_date":"2012-03-24 00:00:00","special_from_date":"2012-03-21 00:00:00","special_to_date":"2012-03-24 00:00:00","description":"White wedding dress"},"2":{"entity_id":"2","type_id":"simple","sku":"black_sunglasses","status":"1","visibility":"4","tax_class_id":"2","weight":"0.2000","price":"500.0000","special_price":"300.0000","name":"Sunglasses","url_key":"sunglasses","country_of_manufacture":"AR","msrp_display_actual_price_type":"2","gift_message_available":null,"news_from_date":null,"news_to_date":null,"special_from_date":"2012-03-21 00:00:00","special_to_date":"2012-03-24 00:00:00","description":"Black sunglasses"}}
- Authentication: Customer, Guest
-Default Format: XML
-Parameters:
-No Parameters
| GET http://magentohost/api/rest/products |
Response Example: XML
- -<?xml version="1.0"?> -<magento_api> - <data_item> - <entity_id>1</entity_id> - <type_id>simple</type_id> - <sku>dress_test</sku> - <description>White wedding dress</description> - <short_description>dress</short_description> - <meta_keyword>white, dress</meta_keyword> - <name>Wedding dress</name> - <meta_title>dress</meta_title> - <meta_description>A nice wedding dress</meta_description> - <regular_price_with_tax>1500</regular_price_with_tax> - <regular_price_without_tax>1500</regular_price_without_tax> - <final_price_with_tax>1000</final_price_with_tax> - <final_price_without_tax>1000</final_price_without_tax> - <is_saleable>1</is_saleable> - <image_url>http://magentohost/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/1/2/wedding_dress.jpg</image_url> - </data_item> - <data_item> - <entity_id>2</entity_id> - <type_id>simple</type_id> - <sku>black_sunglasses</sku> - <description>Black sunglasses</description> - <short_description>Black sunglasses</short_description> - <meta_keyword>sunglasses, black</meta_keyword> - <name>Sunglasses</name> - <meta_title>sunglasses</meta_title> - <meta_description>black sunglasses</meta_description> - <regular_price_with_tax>500</regular_price_with_tax> - <regular_price_without_tax>500</regular_price_without_tax> - <final_price_with_tax>300</final_price_with_tax> - <final_price_without_tax>300</final_price_without_tax> - <is_saleable>1</is_saleable> - <image_url>http://magentohost/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/a/l/sunglasses-1.jpg</image_url> - </data_item> -</magento_api>-
Response Example: JSON
- -{"1":{"entity_id":"1","type_id":"simple","sku":"dress_test","description":"White wedding dress","short_description":"dress","meta_keyword":"white, dress","name":"Wedding dress","meta_title":"dress","meta_description":"A nice wedding dress","regular_price_with_tax":1500,"regular_price_without_tax":1500,"final_price_with_tax":1000,"final_price_without_tax":1000,"is_saleable":"1","image_url":"http:\/\/magentohost\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/1\/2\/wedding_dress.jpg"},"2":{"entity_id":"2","type_id":"simple","sku":"black_sunglasses","description":"Black sunglasses","short_description":"Black sunglasses","meta_keyword":"sunglasses, black","name":"Sunglasses","meta_title":"sunglasses","meta_description":"black sunglasses","regular_price_with_tax":500,"regular_price_without_tax":500,"final_price_with_tax":300,"final_price_without_tax":300,"is_saleable":"1","image_url":"http:\/\/magentohost\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/a\/l\/sunglasses-1.jpg"}}
- Description: Allows you to retrieve the list of products of a specified category. These products will be returned in the product position ascending order.
- -In the following example, product with ID=4 has position equal to 7 and the product with ID=3 has position equal to 1. The list of products, therefore, is sorted by the product position in the category.
- -| GET http://magentohost/api/rest/products?category_id=5 |
Response Example: XML
- -<?xml version="1.0"?> -<magento_api> - <data_item> - <entity_id>4</entity_id> - <attribute_set_id>4</attribute_set_id> - <type_id>simple</type_id> - <tax_class_id>2</tax_class_id> - <weight>1.0000</weight> - <price>329.9900</price> - </data_item> - <data_item> - <entity_id>3</entity_id> - <attribute_set_id>4</attribute_set_id> - <type_id>simple</type_id> - <tax_class_id>2</tax_class_id> - <weight>1.0000</weight> - <price>550.0000</price> - </data_item> -</magento_api>-
Description: Allows you to create a new simple product.
- -Authentication: Admin
-Default Format: JSON
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| type_id | -Product type. Can have the "simple" value. | -required | -string | -simple | -
| attribute_set_id | -Attribute set for the product. | -required | -int | -4 | -
| sku | -Product SKU | -required | -string | -new_product | -
| name | -Product name | - required |
-string | -New product | -
| meta_title | -Product meta title | -optional | -string | -new product | -
| meta_description |
-Product meta description | -optional | -string | -This is a new product | -
| url_key |
-A friendly URL path for the product | -optional | -string | -new-product | -
| custom_design |
-Custom design applied for the product page | -optional | -string | -enterprise/default | -
| page_layout |
-Page template that can be applied to the product page | -optional | -string | -one_column | -
| options_container |
-Defines how the custom options for the product will be displayed. Can have the following values: Block after Info Column or Product Info Column | -optional | -string | -container2 | -
| country_of_manufacture |
-Product country of manufacture | -optional | -string | -AD | -
| msrp_enabled |
-The Apply MAP option. Defines whether the price in the catalog in the frontend is substituted with a Click for price link | -optional | -int | -1 | -
| msrp_display_actual_price_type |
-Defines how the price will be displayed in the frontend. Can have the following values: In Cart, Before Order Confirmation, and On Gesture | -optional | -int | -2 | -
| gift_message_available |
-Defines whether the gift message is available for the product | -optional | -int | -1 | -
| price | -Product price | - required |
-string | -2000 | -
| special_price |
-Product special price | -optional | -string | -150 | -
| weight | -Product weight | - required |
-string | -0.5 | -
| msrp |
-The Manufacturer's Suggested Retail Price option. The price that a manufacturer suggests to sell the product at | -optional | -string | -140 | -
| status | -Product status. Can have the following values: 1- Enabled, 2 - Disabled. | - required |
-int | -1 | -
| visibility | -Product visibility. Can have the following values: 1 - Not Visible Individually, 2 - Catalog, 3 - Search, 4 - Catalog, Search. | - required |
-int | -4 | -
| enable_googlecheckout |
-Defines whether the product can be purchased with the help of the Google Checkout payment service. Can have the following values: Yes and No | -optional | -int | -1 | -
| tax_class_id | -Product tax class. Can have the following values: 0 - None, 2 - taxable Goods, 4 - Shipping, etc., depending on created tax classes. | - required |
-int | -7 | -
| description | -Product description. | - required |
-string | -This is a new product. | -
| short_description | -Product short description. | - required |
-string | -A new product. | -
| meta_keyword |
-Product meta keywords | -optional | -string | -new | -
| custom_layout_update |
-An XML block to alter the page layout | -optional | -string | -XML body | -
| special_from_date |
-Date starting from which the special price will be applied to the product | -optional | -string | -2012-03-15 00:00:00 | -
| special_to_date |
-Date till which the special price will be applied to the product | -optional | -string | -2012-03-15 00:00:00 | -
| news_from_date |
-Date starting from which the product is promoted as a new product | -optional | -string | -2012-03-15 00:00:00 | -
| news_to_date |
-Date till which the product is promoted as a new product | -optional | -string | -2012-03-15 00:00:00 | -
| custom_design_from |
-Date starting from which the custom design will be applied to the product page | -optional | -string | -2012-03-15 00:00:00 | -
| custom_design_to |
-Date till which the custom design will be applied to the product page | -optional | -string | -2012-03-15 00:00:00 | -
| group_price |
-Product group price | -optional | -array | -array of group price | -
| tier_price |
-Product tier price | -optional | -array | -array of tier price | -
| stock_data |
-Product inventory data | -optional | -array | -array of stock data | -
Array of Group Price attributes is as follows:
- -| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| website_id | -Website ID | -optional | -int | -0 | -
| cust_group | -Customer group | -optional | -int | -1 | -
| price |
-Group price | -optional | -string | -140 | -
Array of Tier Price attributes is as follows:
- -| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| website_id | -Website ID | -optional | -int | -0 | -
| cust_group | -Customer group | -optional | -int | -1 | -
| price | -Tier price | -optional | -string | -140 | -
| price_qty | -Price quantity | -optional | -string | -10 | -
Array of Stock Data attributes is as follows:
- -| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| qty | -Quantity of stock items for the current product | -optional | -string | -99 | -
| min_qty | -Quantity for stock items to become out of stock | -optional | -string | -5 | -
| use_config_min_qty | -Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock option | -optional | -int | -1 | -
| is_qty_decimal | -Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) | -optional | -int | -1 | -
| backorders |
- Defines whether the customer can place the order for products that are out of stock at the moment. |
- optional |
-int | -0 | -
| use_config_backorders |
-Choose whether the Config settings will be applied for the Backorders option | - optional |
-int | -1 | -
| min_sale_qty |
- Minimum number of items in the shopping cart to be sold |
- optional |
-string | -10 | -
| use_config_min_sale_qty |
-Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option | - optional |
-int | -1 | -
| max_sale_qty |
- Maximum number of items in the shopping cart to be sold |
- optional |
-string | -50 | -
| use_config_max_sale_qty |
-Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option | - optional |
-int | -1 | -
| is_in_stock |
-Defines whether the product is available for selling. | - optional |
-int | -1 | -
| notify_stock_qty |
-The number of inventory items below which the customer will be notified | - optional |
-string | -5 | -
| use_config_notify_stock_qty |
-Choose whether the Config settings will be applied for the Notify for Quantity Below option | - optional |
-int | -1 | -
| manage_stock |
-Choose whether to view and specify the product quantity and availability and whether the product is in stock management. | - optional |
-int | -1 | -
| use_config_manage_stock |
-Choose whether the Config settings will be applied for the Manage Stock option | - optional |
-int | -1 | -
| use_config_qty_increments |
-Choose whether the Config settings will be applied for the Qty Increments option | - optional |
-int | -1 | -
| qty_increments |
-The product quantity increment value | - optional |
-string | -3 | -
| use_config_enable_qty_inc |
-Choose whether the Config settings will be applied for the Enable Qty Increments option | - optional |
-int | -1 | -
| enable_qty_increments |
-Defines whether the customer can add products only in increments to the shopping cart | - optional |
-int | -0 | -
| is_decimal_divided |
-Defines whether the stock items can be divided into multiple boxes for shipping | - optional |
-int | -0 | -
| POST http://magentohost/api/rest/products |
Request Example: JSON
- -{
- "custom_design" : "default/blank",
- "custom_design_from" : "02/16/2012",
- "custom_design_to" : "05/01/2012",
- "description" : "Test description",
- "gift_message_available" : 1,
- "meta_description" : "Test meta",
- "meta_keyword" : "Test keyword",
- "meta_title" : "Test title",
- "msrp" : 11.015000000000001,
- "msrp_display_actual_price_type" : 1,
- "msrp_enabled" : 1,
- "name" : "Test",
- "news_from_date" : "02/16/2012",
- "news_to_date" : "16.02.2012",
- "options_container" : "container1",
- "page_layout" : "one_column",
- "price" : 25.5,
- "attribute_set_id" : "4",
- "short_description" : "Test short description",
- "sku" : "simple4f5490f31959f",
- "special_from_date" : "02/16/2012",
- "special_price" : 11.199999999999999,
- "special_to_date" : "03/17/2012",
- "status" : 1,
- "stock_data" : { "backorders" : 1,
- "enable_qty_increments" : 0,
- "is_in_stock" : 0,
- "is_qty_decimal" : 0,
- "manage_stock" : 1,
- "max_sale_qty" : 1,
- "min_qty" : 1.5600000000000001,
- "min_sale_qty" : 1,
- "notify_stock_qty" : -50.990000000000002,
- "qty" : 1,
- "use_config_manage_stock" : 1,
- "use_config_min_qty" : 1,
- "use_config_min_sale_qty": 1,
- "use_config_max_sale_qty" : 1,
- "use_config_backorders": 1,
- "use_config_enable_qty_inc":1,
- "use_config_notify_stock_qty":1 },
- "tax_class_id" : "2",
- "type_id" : "simple",
- "use_config_gift_message_available" : 0,
- "visibility" : "4",
- "weight" : 125
-}
- Request Example: XML
- -<?xml version="1.0"?> -<magento_api> - <attribute_set_id>4</attribute_set_id> - <type_id>simple</type_id> - <sku>test_dress</sku> - <name>Test_dress</name> - <country_of_manufacture>AD</country_of_manufacture> - <price>2000.0000</price> - <special_price>1500.0000</special_price> - <weight>0.5000</weight> - <status>1</status> - <visibility>4</visibility> - <tax_class_id>7</tax_class_id> - <description>dress</description> - <short_description>Wedding dress</short_description> -</magento_api>-
Allows you to retrieve, update, and delete a specified product in Magento.
- -URL Structure: http://magentohost/api/rest/products/:id
-Version: 1
Description: Allows you to retrieve information on a required simple product.
-Notes: The list of attributes that will be returned in the response is configured in the Magento Admin Panel. The list of attributes differs for each type of user.
Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
| GET http://magentohost/api/rest/products/8 |
Response Example: XML
- -<?xml version="1.0"?> -<magento_api> - <entity_id>8</entity_id> - <attribute_set_id>4</attribute_set_id> - <type_id>simple</type_id> - <sku>dress</sku> - <name>Dress</name> - <url_key>my-new-dress</url_key> - <country_of_manufacture>AD</country_of_manufacture> - <msrp_display_actual_price_type>2</msrp_display_actual_price_type> - <gift_message_available>1</gift_message_available> - <price>2000.0000</price> - <weight>0.5000</weight> - <status>1</status> - <visibility>4</visibility> - <tax_class_id>7</tax_class_id> - <description>dress</description> - <group_price> - <data_item> - <website_id>0</website_id> - <cust_group>1</cust_group> - <price>1400.0000</price> - </data_item> - </group_price> - <tier_price> - <data_item> - <website_id>0</website_id> - <cust_group>1</cust_group> - <price>1300.0000</price> - <price_qty>1.0000</price_qty> - </data_item> - </tier_price> - <stock_data> - <qty>50.0000</qty> - <min_qty>0.0000</min_qty> - <use_config_min_qty>1</use_config_min_qty> - <is_qty_decimal>0</is_qty_decimal> - <backorders>0</backorders> - <use_config_backorders>1</use_config_backorders> - <min_sale_qty>1.0000</min_sale_qty> - <use_config_min_sale_qty>1</use_config_min_sale_qty> - <max_sale_qty>0.0000</max_sale_qty> - <use_config_max_sale_qty>1</use_config_max_sale_qty> - <is_in_stock>1</is_in_stock> - <notify_stock_qty></notify_stock_qty> - <use_config_notify_stock_qty>1</use_config_notify_stock_qty> - <manage_stock>0</manage_stock> - <use_config_manage_stock>1</use_config_manage_stock> - <use_config_qty_increments>1</use_config_qty_increments> - <qty_increments>0.0000</qty_increments> - <use_config_enable_qty_inc>1</use_config_enable_qty_inc> - <enable_qty_increments>0</enable_qty_increments> - <is_decimal_divided>0</is_decimal_divided> - <use_config_enable_qty_increments>1</use_config_enable_qty_increments> - </stock_data> -</magento_api>-
Response Example: JSON
- -{"entity_id":"8","attribute_set_id":"4","type_id":"simple","sku":"dress","name":"Dress","url_key":"my-new-dress","country_of_manufacture":"AD","msrp_display_actual_price_type":"2","gift_message_available":"1","price":"2000.0000","weight":"0.5000","status":"1","visibility":"4","tax_class_id":"7","description":"dress","group_price":[{"website_id":"0","cust_group":"1","price":"1400.0000"}],"tier_price":[{"website_id":"0","cust_group":"1","price":"1300.0000","price_qty":"1.0000"}],"stock_data":{"qty":"50.0000","min_qty":"0.0000","use_config_min_qty":"1","is_qty_decimal":"0","backorders":"0","use_config_backorders":"1","min_sale_qty":"1.0000","use_config_min_sale_qty":"1","max_sale_qty":"0.0000","use_config_max_sale_qty":"1","is_in_stock":"1","notify_stock_qty":null,"use_config_notify_stock_qty":"1","manage_stock":"0","use_config_manage_stock":"1","use_config_qty_increments":"1","qty_increments":"0.0000","use_config_enable_qty_inc":"1","enable_qty_increments":"0","is_decimal_divided":"0","use_config_enable_qty_increments":"1"}}
- Authentication: Customer, Guest
-Default Format: XML
-Parameters:
-No Parameters
| GET http://magentohost/api/rest/products/8 |
Response Example: XML
- -<?xml version="1.0"?> -<magento_api> - <entity_id>1</entity_id> - <type_id>simple</type_id> - <sku>dress_test</sku> - <name>Wedding dress</name> - <meta_title>dress</meta_title> - <meta_description>A nice wedding dress</meta_description> - <description>White wedding dress</description> - <short_description>dress</short_description> - <meta_keyword>white, dress</meta_keyword> - <tier_price/> - <is_in_stock>1</is_in_stock> - <regular_price_with_tax>1500</regular_price_with_tax> - <regular_price_without_tax>1500</regular_price_without_tax> - <final_price_with_tax>1000</final_price_with_tax> - <final_price_without_tax>1000</final_price_without_tax> - <is_saleable>1</is_saleable> - <image_url>http://magento/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/1/2/wedding_dress.jpg</image_url> - <url>http://magento/index.php/catalog/product/view/id/1/s/dress/</url> - <buy_now_url>http://magento/index.php/checkout/cart/add/uenc/aHR0cDovLzEyNy4wLjAuMS9Tb3VyY2VzL2FwaS9yZXN0L3Byb2R1Y3RzLzE,/product/1/</buy_now_url> - <total_reviews_count>0</total_reviews_count> - <has_custom_options></has_custom_options> -</magento_api>-
Response Example: JSON
- -{"entity_id":"1","type_id":"simple","sku":"dress_test","name":"Wedding dress","meta_title":"dress","meta_description":"A nice wedding dress","description":"White wedding dress","short_description":"dress","meta_keyword":"white, dress","tier_price":[],"is_in_stock":"1","regular_price_with_tax":1500,"regular_price_without_tax":1500,"final_price_with_tax":1000,"final_price_without_tax":1000,"is_saleable":"1","image_url":"http:\/\/magento\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/1\/2\/wedding_dress.jpg","url":"http:\/\/magento\/index.php\/catalog\/product\/view\/id\/1\/s\/dress\/","buy_now_url":"http:\/\/magento\/index.php\/checkout\/cart\/add\/uenc\/aHR0cDovLzEyNy4wLjAuMS9Tb3VyY2VzL2FwaS9yZXN0L3Byb2R1Y3RzLzE,\/product\/1\/","total_reviews_count":"0","has_custom_options":false}
- Description: Allows you to update an existing product.
- - -Authentication: Admin
-Default Format: JSON
-Parameters:
-Enter only those parameters which you want to update.
| PUT http://magentohost/api/rest/products/8 -PUT for specific store http://magentohost/api/rest/products/8/store/3 |
Request Example: JSON
- -{
-"attribute_set_id":"4",
-"type_id":"simple",
-"sku":"wedding dress",
-"name":"Dress_test",
-"meta_title":"dress",
-"meta_description":"a wedding dress",
-"price":"2000.0000",
-"weight":"0.5000",
-"status":"1",
-"visibility":"4",
-"enable_googlecheckout":"1",
-"tax_class_id":"7",
-"description":"dress",
-"meta_keyword":"dress, wedding"
-}
- Request Example: XML
- -<?xml version="1.0"?> -<magento_api> - <attribute_set_id>4</attribute_set_id> - <type_id>simple</type_id> - <sku>wedding dress</sku> - <name>Dress_test</name> - <meta_title>dress</meta_title> - <price>2000.0000</price> - <weight>0.5000</weight> - <status>1</status> - <visibility>4</visibility> - <enable_googlecheckout>1</enable_googlecheckout> - <tax_class_id>7</tax_class_id> - <description>dress</description> - <meta_keyword>dress, wedding</meta_keyword> -</magento_api>-
Description: Allows you to delete an existing product.
- - -Authentication: Admin
-Default Format: JSON
-Parameters: no parameters
-Request Example:
| DELETE http://magentohost/api/rest/products/1 |
| Status Code | -Message | -Description | -
|---|---|---|
| 404 | -Resource not found. | -The required resource is not found. | -
| 405 | -Resource method not implemented yet. | -The required method is not implemented yet. | -
| 405 | -Resource does not support method. | -The current resource does not support the specified method. | -
Some requests use GET parameters in the URL. These are as follows:
- -If the attribute value consists of several words separated by a whitespace, the '%20' sign is used:
- - - -For example, to filter products with the description equal to simple01:
- - - - - diff --git a/guides/m1x/api/rest/Resources/inventory.html b/guides/m1x/api/rest/Resources/inventory.html deleted file mode 100644 index faa28767c5..0000000000 --- a/guides/m1x/api/rest/Resources/inventory.html +++ /dev/null @@ -1,626 +0,0 @@ ---- -layout: m1x_rest -title: Inventory ---- - - -Allows you to manage existing stock items. Inventory management is available only for Admin.
- -URL Structure: http://magentohost/api/rest/stockitems
Version: 1
Description: Allows you to retrieve the list of existing stock items.
- Notes: The list of attributes that will be returned for stock items is configured in the Magento Admin Panel.
-
Authentication: Admin
- Default Format: JSON
- Parameters :
- No Parameters
Response Example: XML
- -| GET http://magentohost/api/rest/stockitems | -
<?xml version="1.0"?> -<magento_api> - <data_item> - <item_id>1</item_id> - <qty>100.0000</qty> - <backorders>0</backorders> - <min_sale_qty>1.0000</min_sale_qty> - <max_sale_qty>0.0000</max_sale_qty> - <low_stock_date></low_stock_date> - <manage_stock>0</manage_stock> - <stock_status_changed_auto>0</stock_status_changed_auto> - <enable_qty_increments>0</enable_qty_increments> - </data_item> - <data_item> - <item_id>2</item_id> - <qty>100.0000</qty> - <backorders>0</backorders> - <min_sale_qty>1.0000</min_sale_qty> - <max_sale_qty>0.0000</max_sale_qty> - <low_stock_date></low_stock_date> - <manage_stock>0</manage_stock> - <stock_status_changed_auto>0</stock_status_changed_auto> - <enable_qty_increments>0</enable_qty_increments> - </data_item> - <data_item> - <item_id>3</item_id> - <qty>1.0000</qty> - <backorders>0</backorders> - <min_sale_qty>1.0000</min_sale_qty> - <max_sale_qty>0.0000</max_sale_qty> - <low_stock_date></low_stock_date> - <manage_stock>0</manage_stock> - <stock_status_changed_auto>0</stock_status_changed_auto> - <enable_qty_increments>0</enable_qty_increments> - </data_item> - <data_item> - <item_id>4</item_id> - <qty>0.0000</qty> - <backorders>0</backorders> - <min_sale_qty>1.0000</min_sale_qty> - <max_sale_qty>0.0000</max_sale_qty> - <low_stock_date></low_stock_date> - <manage_stock>0</manage_stock> - <stock_status_changed_auto>1</stock_status_changed_auto> - <enable_qty_increments>0</enable_qty_increments> - </data_item> -</magento_api>-
Response Example: JSON
- -| GET http://magentohost/api/rest/stockitems | -
[{"item_id":"1","qty":"100.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"2","qty":"100.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"3","qty":"1.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"4","qty":"0.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"1","enable_qty_increments":"0"}]
- Description: Allows you to update existing stock items.
- - -Authentication: Admin
- Default Format: JSON
Notes: The Content-Type: text/xml parameter must be added to the request header.
- -Parameters:
- -| Name | -Description | -Type | -Example Value | -
|---|---|---|---|
| item_id | -Item ID | -int | -1 | -
| product_id | -Product ID | -int | -1 | -
| stock_id | -Stock ID | -int | -1 | -
| qty | -Quantity of stock items for the current product | -string | -20 | -
| min_qty | -Quantity for stock items to become out of stock | -string | -0 | -
| use_config_min_qty | -Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock - option - | -int | -1 | -
| is_qty_decimal | -Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) | -int | -0 | -
| backorders | -The customer can place the order for products that are out of stock at the moment (0 - No Backorders, 1 - - Allow Qty Below 0, and 2 - Allow Qty Below 0 and Notify Customer) - | -int | -0 | -
| use_config_backorders | -Choose whether the Config settings will be applied for the Backorders option | -int | -1 | -
| min_sale_qty | -Minimum number of items in the shopping cart to be sold | -string | -10 | -
| use_config_min_sale_qty | -Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option | -int | -0 | -
| max_sale_qty | -Maximum number of items in the shopping cart to be sold | -string | -100 | -
| use_config_max_sale_qty | -Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option | -int | -0 | -
| is_in_stock | -Defines whether the product is available for selling (0 - Out of Stock, 1 - In Stock) | -int | -1 | -
| low_stock_date | -Date when the number of stock items became lower than the number defined in the Notify for Quantity Below - option - | -string | -2012-02-24 12:37:51 | -
| notify_stock_qty | -The number of inventory items below which the customer will be notified via the RSS feed | -string | -10 | -
| use_config_notify_stock_qty | -Choose whether the Config settings will be applied for the Notify for Quantity Below option | -int | -0 | -
| manage_stock | -Choose whether to view and specify the product quantity and availability and whether the product is in - stock management( 0 - No, 1 - Yes) - | -int | -0 | -
| use_config_manage_stock | -Choose whether the Config settings will be applied for the Manage Stock option | -int | -1 | -
| stock_status_changed_auto | -Defines whether products can be automatically returned to stock when the refund for an order is created - | -int | -0 | -
| use_config_qty_increments | -Choose whether the Config settings will be applied for the Enable Qty Increments option | -int | -1 | -
| qty_increments | -The product quantity increment value | -string | -5 | -
| use_config_enable_qty_inc | -Choose whether the Config settings will be applied for the Qty Increments option | -int | -1 | -
| enable_qty_increments | -Defines whether the customer can add products only in increments to the shopping cart | -int | -0 | -
| is_decimal_divided | -Defines whether the stock items can be divided into multiple boxes for shipping. | -int | -0 | -
Example: XML
- -| PUT http://magentohost/api/rest/stockitems | -
Request Body:
-<?xml version="1.0"?> -<magento_api> - <data_item item_id="157"> - <product_id>262</product_id> - <stock_id>1</stock_id> - <qty>100.0000</qty> - <min_qty>0.0000</min_qty> - </data_item> - <data_item item_id="158"> - <product_id>263</product_id> - <stock_id>1</stock_id> - <qty>100.0000</qty> - <min_qty>0.0000</min_qty> - </data_item> - <data_item item_id="159"> - <product_id>264</product_id> - <stock_id>1</stock_id> - <qty>120.0000</qty> - <min_qty>0.0000</min_qty> - </data_item> - <data_item item_id="153"> - <product_id> </product_id> - <qty>110.0000</qty> - <min_qty>0.0000</min_qty> - </data_item> -</magento_api>-
Response Body:
-<?xml version="1.0"?> -<magento_api> - <success> - <data_item> - <message>Resource updated successful.</message> - <code>200</code> - <item_id>157</item_id> - </data_item> - </success> - <error> - <data_item> - <message>Resource not found.</message> - <code>404</code> - <item_id>158</item_id> - </data_item> - <data_item> - <message>Resource not found.</message> - <code>404</code> - <item_id>159</item_id> - </data_item> - <data_item> - <message>Empty value for "product_id" in request.</message> - <code>400</code> - <item_id>153</item_id> - </data_item> - </error> -</magento_api>-
Allows you to update, delete, or retrieve information on a single stock item.
- Notes: The list of attributes that will be returned for stock items is configured in the Magento Admin Panel.
-
URL Structure: http://magentohost/api/rest/stockitems/:id
- Version: 1
Description: Allows you to retrieve the stock item information.
- Authentication: Admin
- Default Format: JSON
Response Example: XML
- -| GET http://magentohost/api/rest/stockitems/1 | -
Response Body:
-<?xml version="1.0"?> -<magento_api> - <item_id>1</item_id> - <product_id>1</product_id> - <stock_id>1</stock_id> - <qty>200.0000</qty> - <min_qty>0.0000</min_qty> - <use_config_min_qty>1</use_config_min_qty> - <is_qty_decimal>1</is_qty_decimal> - <backorders>0</backorders> - <use_config_backorders>1</use_config_backorders> - <min_sale_qty>1.0000</min_sale_qty> - <use_config_min_sale_qty>1</use_config_min_sale_qty> - <max_sale_qty>0.0000</max_sale_qty> - <use_config_max_sale_qty>1</use_config_max_sale_qty> - <is_in_stock>1</is_in_stock> - <low_stock_date></low_stock_date> - <notify_stock_qty>10.0000</notify_stock_qty> - <use_config_notify_stock_qty>0</use_config_notify_stock_qty> - <manage_stock>0</manage_stock> - <use_config_manage_stock>1</use_config_manage_stock> - <stock_status_changed_auto>0</stock_status_changed_auto> - <use_config_qty_increments>1</use_config_qty_increments> - <qty_increments>0.0000</qty_increments> - <use_config_enable_qty_inc>1</use_config_enable_qty_inc> - <enable_qty_increments>0</enable_qty_increments> - <is_decimal_divided>1</is_decimal_divided> -</magento_api>-
Response Example: JSON
- -| GET http://magentohost/api/rest/stockitems/157 - | -
Response Body:
-{"item_id":"1","product_id":"1","stock_id":"1","qty":"200.0000","min_qty":"0.0000","use_config_min_qty":"1","is_qty_decimal":"1","backorders":"0","use_config_backorders":"1","min_sale_qty":"1.0000","use_config_min_sale_qty":"1","max_sale_qty":"0.0000","use_config_max_sale_qty":"1","is_in_stock":"1","low_stock_date":null,"notify_stock_qty":"10.0000","use_config_notify_stock_qty":"0","manage_stock":"0","use_config_manage_stock":"1","stock_status_changed_auto":"0","use_config_qty_increments":"1","qty_increments":"0.0000","use_config_enable_qty_inc":"1","enable_qty_increments":"0","is_decimal_divided":"1"}
- Description: Allows you to update existing stock item data.
- Notes: The Content-Type: text/xml parameter must be added to the request header.
- Authentication: Admin
- Default Format: JSON
- Parameters:
- Enter only those parameters which you want to update.
Example: XML
- -| PUT http://magentohost/api/rest/stockitems/1 | -
Request Body:
-<?xml version="1.0"?> -<magento_api> - <qty>99</qty> -</magento_api>-
Example: JSON
- -| PUT http://magentohost/api/rest/stockitems/1 | -
Request Body:
-{
-"qty":"99"
-}
- Description: Not allowed. The DELETE method is not allowed because you cannot delete a stock item. The - required stock item is deleted together with the product which it is associated to.
- - -Possible HTTP Status Codes:
- -| Error Code | -Error Message | -Error Description | -
|---|---|---|
| 200 | -Resource updated successful. | -The required resource was successfully updated. | -
| 404 | -Resource not found. | -The required resource is not found or does not exist. | -
| 400 | -Empty value for <name of the parameter> in request. | -Value is not defined for the specified parameter in the request body. | -
| 400 | -Invalid value for "item_id" in request. | -The specified value for "item_id" is not valid. | -
| 400 | -Missing <name of the parameter> in request. | -The specified parameter is missing in the request body. | -
| 500 | -Resource internal error. | -Resource internal error. | -
Allows you to manage existing customer addresses.
- -URL Structure: http://magentohost/api/rest/customers/:customer_id/addresses
-Version: 1
Description: Allows you to retrieve the list of existing customer addresses.
-Notes: The list of attributes that will be returned for customer addresses is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses. Also, Admin can add additional non-system customer address attributes by selecting Customers > Attributes > Manage Customer Address Attributes (available only in Magento Enterprise Edition). If these attributes are set as visible on frontend, they will be returned in the response.
Authentication: Admin, Customer
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/customers/1/addresses |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <entity_id>2</entity_id> - <firstname>John</firstname> - <lastname>Doe</lastname> - <city>PA</city> - <region>Palau</region> - <postcode>19103</postcode> - <country_id>US</country_id> - <telephone>610-634-1181</telephone> - <prefix>Dr.</prefix> - <middlename></middlename> - <suffix>Jr.</suffix> - <company></company> - <fax></fax> - <vat_id>123456789</vat_id> - <street> - <data_item>2356 Jody Road Philadelphia</data_item> - <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> - </street> - <is_default_billing>1</is_default_billing> - <is_default_shipping>1</is_default_shipping> - </data_item> -</magento_api>-
response body: json:
-
-
-[
- {
- "entity_id": "98",
- "firstname": "John",
- "middlename": null,
- "lastname": "Doe",
- "company": null,
- "city": "Philly",
- "country_id": "US",
- "region": "California",
- "postcode": "94131",
- "telephone": "888-555-1212",
- "fax": null,
- "street": [
- "123 Center St"
- ],
- "is_default_billing": 0,
- "is_default_shipping": 1
- },
- {
- "entity_id": "99",
- "firstname": "John",
- "lastname": "Doe",
- "city": "San Jose",
- "country_id": "US",
- "region": "California",
- "postcode": "94070",
- "telephone": "898-555-1212",
- "street": [
- "123 Easy St"
- ],
- "is_default_billing": 1,
- "is_default_shipping": 0
- }
-]
-
- Notes: If the customer has more than two street addresses, they will be returned in the following form: first address in the first string and all other addresses in the second string separated with a semicolon (like in the example above).
- -Description: Allows you to create a new address for the required customer.
-Notes: The Customer user type can create addresses only for themselves.
When adding a street address for the customer, it should look like the following:
-<street> - <data_item>street address 1</data_item> - <data_item>street address 2</data_item> - <data_item>street address 3</data_item> -</street>-
Authentication: Admin, Customer
-Default Format: XML
Parameters:
- -| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| firstname | -Customer first name | -required | -string | -John | -
| lastname | -Customer last name | - required |
-string | -Doe | -
| street |
-Customer street address. There can be more than one street address. | - required |
-string | - 2800 Watson Lane |
-
| city |
-Name of the city | - required |
-string | - Asheville |
-
| country_id |
-Name of the country | - required |
-string | - US |
-
| region | -Region name or code | -required for countries with regions (USA, Canada, etc.) | -string | -Palau | -
| postcode |
-Customer ZIP/postal code | - required |
-string | - 28803 |
-
| telephone |
-Customer phone number | - required |
-string | - 828-775-0519 |
-
Example:
- -| POST http://magentohost/api/rest/customers/1/addresses |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <firstname>Johny</firstname> - <lastname>Doe</lastname> - <city>PA</city> - <region>Palau</region> - <postcode>19103</postcode> - <country_id>US</country_id> - <telephone>611-634-1181</telephone> - <street> - <data_item>2354 Jody Road Philadelphia</data_item> - <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> - </street> -</magento_api>-
Update Customer Address: not allowed.
- - -Description: Not allowed.
- - - -Allows you to manage an existing customer address.
- -URL Structure: http://magentohost/api/rest/customers/addresses/:address_id
-Version: 1
Description: Allows you to retrieve an existing customer address.
-Notes: The list of attributes that will be returned for customer address is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses. Also, Admin can add additional non-system customer address attributes by selecting Customers > Attributes > Manage Customer Address Attributes (available only in Magento Enterprise Edition). If these attributes are set as visible on frontend, they will be returned in the response.
Authentication: Admin, Customer
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| GET http://magentohost/api/rest/customers/addresses/2 |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <entity_id>2</entity_id> - <firstname>John</firstname> - <lastname>Doe</lastname> - <city>PA</city> - <region>Palau</region> - <postcode>19103</postcode> - <country_id>US</country_id> - <telephone>610-634-1181</telephone> - <prefix>Dr.</prefix> - <middlename></middlename> - <suffix>Jr.</suffix> - <company></company> - <fax></fax> - <vat_id>123456789</vat_id> - <street> - <data_item>2356 Jody Road Philadelphia</data_item> - <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> - </street> - <is_default_billing>1</is_default_billing> - <is_default_shipping>1</is_default_shipping> -</magento_api>-
response body: json:
-
-
-{
- "entity_id": "2",
- "firstname": "John",
- "lastname": "Doe",
- "city": "San Jose",
- "country_id": "US",
- "region": "California",
- "postcode": "94070",
- "telephone": "898-555-1212",
- "street": [
- "123 Easy St"
- ],
- "is_default_billing": 1,
- "is_default_shipping": 0
-}
- Description: Not allowed.
- -Description: Allows you to update an existing customer address.
-Notes: The list of attributes that will be updated for customer address is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses.
If you want to add more addresses, it should look like the following:
-<street> -Â Â <data_item>street address 1</data_item> -Â Â <data_item>street address 2</data_item> -Â Â <data_item>street address 3</data_item> -</street>-
Authentication: Admin, Customer
-Default Format: XML
Example:
- -| PUT http://magentohost/api/rest/customers/addresses/7 |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <firstname>Johny</firstname> - <lastname>Doe</lastname> - <city>PA</city> - <region>Palau</region> - <postcode>19103</postcode> - <country_id>US</country_id> - <telephone>610-634-1181</telephone> - <street> - <data_item>2356 Jody Road Philadelphia</data_item> - <data_item>844 Jefferson Street</data_item> - </street> - <is_default_billing>1</is_default_billing> - <is_default_shipping>1</is_default_shipping> -</magento_api>-
request body: json:
-
-
-{
- "entity_id": "99",
- "firstname": "John",
- "lastname": "Doe",
- "city": "San Jose",
- "country_id": "US",
- "region": "California",
- "postcode": "94070",
- "telephone": "898-555-1212",
- "street": [
- "123 Easy St"
- ],
- "is_default_billing": 1,
- "is_default_shipping": 0
-}
- Description: Allows you to delete an existing customer address.
-Notes: The Customer user type can delete only his/her own addresses.
Authentication: Admin, Customer
-Default Format: XML
-Parameters:
-No Parameters
Example:
- -| DELETE http://magentohost/api/rest/customers/addresses/7 |
| Status Code | -Message | -Description | -
|---|---|---|
| 405 | -Resource method not implemented yet. | -The required method is not implemented or not allowed. | -
| 404 | - Resource not found. |
-The specified resource is not found or does not exist. | -
| 400 | -Invalid country identifier type | -The <country_id> value is passed not as a string type. | -
| 400 | - <value name> is a required value. |
-The specified value is a required one. | -
| 400 | - Country does not exist |
-The specified country does not exist. | -
| 400 | -Country is required | -The <country_id> value is required. | -
| 400 | - Country is not between '2' and '3' inclusively. |
-The country code is not in the range of 2 and 3 symbols inclusively. | -
| 400 | - Invalid State/Province type |
-The <region> value is invalid (value is empty or passed as an array) | -
| 400 | - State/Province is required |
-The <region> value is required for the specified country. | -
| 400 | - State/Province is invalid |
-The entered value for <region> is invalid. It must be the region code (TX) or region name (Texas). | -
| 400 | - State/Province does not exist |
-The specified region does not exist (only for the country with predefined regions). | -
| 400 | - Address is default for customer so is not allowed to be deleted |
-The address cannot be deleted because it is set as a default one for billing or shipping. | -
Allows you to create and retrieve customers.
- -URL Structure: http://magentohost/api/rest/customers
-Version: 1
Description: Allows you to retrieve the list of existing customers.
-Notes:: Only Admin user can retrieve the list of customers with all their attributes.
Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
Example
-| GET http://magentohost/api/rest/customers |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <entity_id>2</entity_id> - <website_id>1</website_id> - <email>test@example.com</email> - <group_id>1</group_id> - <created_at>2012-03-22 14:15:54</created_at> - <disable_auto_group_change>1</disable_auto_group_change> - <firstname>john</firstname> - <lastname>Doe</lastname> - <created_in>Default Store View</created_in> - </data_item> - <data_item> - <entity_id>4</entity_id> - <website_id>1</website_id> - <email>earl@example.com</email> - <group_id>1</group_id> - <created_at>2012-03-28 13:54:04</created_at> - <disable_auto_group_change>0</disable_auto_group_change> - <firstname>Earl</firstname> - <lastname>Hickey</lastname> - <created_in>Admin</created_in> - </data_item> -</magento_api>-
response example: json
-| get http://magentohost/api/rest/customers |
response body:
-
-
-{
- "2": {
- "entity_id": "2",
- "website_id": "1",
- "email": "test@example.com",
- "group_id": "1",
- "created_at": "2012-03-22 14:15:54",
- "disable_auto_group_change": "1",
- "firstname": "john",
- "lastname": "Doe",
- "created_in": "Admin",
- "prefix": null,
- "suffix": null,
- "taxvat": null,
- "dob": "2001-01-03 00:00:00",
- "reward_update_notification": "1",
- "reward_warning_notification": "1",
- "gender": "1"
- },
- "4": {
- "entity_id": "4",
- "website_id": "1",
- "email": "earl@example.com",
- "group_id": "1",
- "created_at": "2013-03-28 18:59:41",
- "disable_auto_group_change": "0",
- "firstname": "Earl",
- "lastname": "Hickey",
- "created_in": "Admin",
- "prefix": null,
- "suffix": null,
- "taxvat": null,
- "dob": "2012-03-28 13:54:04",
- "reward_update_notification": "1",
- "reward_warning_notification": "1",
- "gender": "1"
- }
-
- Description: Allows you to create a new customer.
-Authentication: Admin
-Default Format: XML
-Parameters:
| Name | -Description | -Required | -Type | -Example Value | -
|---|---|---|---|---|
| firstname | -The customer first name | -required | -string | -John | -
| lastname | -The customer last name | -required | -string | -Doe | -
| The customer email address | -required | -string | -johny@example.com | -|
| password | -The customer password. The password must contain minimum 7 characters | -required | -string | -123123q | -
| website_id | -Website ID | -required | -int | -1 | -
| group_id | -Customer group ID | -required | -int | -1 | -
| disable_auto_group_change | -Defines whether the automatic group change for the customer will be disabled | -optional | -int | -0 | -
| prefix |
-Customer prefix | - optional |
-string | -Mr. | -
| middlename |
-Customer middle name or initial | - optional |
-string | -R. | -
| suffix |
-Customer suffix | - optional |
-string | -Sr. | -
| taxvat |
-Customer Tax or VAT number | - optional |
-string | - GB999 9999 73 |
-
Notes: The list of parameters may change depending on the attributes settings in Customers > Attributes > Manage Customer Attributes page in Magento Admin Panel. For example, a required status of the middlename attribute (Middle Name/Initial) may be changed to 'YES". Please note that managing customer attributes is available only in Magento Enterprise Edition.
- -Example:
-| POST http://magentohost/api/rest/customers |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <firstname>Earl</firstname> - <lastname>Hickey</lastname> - <password>123123q</password> - <email>earl@example.com</email> - <website_id>1</website_id> - <group_id>1</group_id> -</magento_api>-
Response:
-If the customer was created successfully, we receive Response HTTP Code = 200, empty Response Body and Location header like '/api/rest/customers/555' where '555' - an entity id of the new customer.
Description: Not allowed
- -Description: Not allowed
- -Allows you to manage existing customers.
- -URL Structure: http://magentohost/api/rest/customers/:customerId
-Version: 1
Description: Allows you to retrieve information on an existing customer.
-Notes:: The list of attributes that will be returned for customers is configured in the Magento Admin Panel. The Customer user type has access only to his/her own information. Also, Admin can add additional non-system customer attributes by selecting Customers > Attributes > Manage Customer Attributes. If these attributes are set as visible on frontend, they will be returned in the response. Also, custom attributes will be returned in the response only after the customer information is updated in the Magento Admin Panel or the specified custom attribute is updated via API (see the PUT method below). Please note that managing customer attributes is available only in Magento Enterprise Edition.
Authentication: Admin, Customer
-Default Format: XML
-Parameters:
-No Parameters
Example:
-| GET http://magentohost/api/rest/customers/2 |
Response Body:
-<?xml version="1.0"?> -<magento_api> - <entity_id>2</entity_id> - <website_id>1</website_id> - <email>test@example.com</email> - <group_id>1</group_id> - <created_at>2012-03-22 14:15:54</created_at> - <disable_auto_group_change>1</disable_auto_group_change> - <created_in>Default Store View</created_in> - <firstname>john</firstname> - <lastname>Doe</lastname> - <last_logged_in>2012-03-22 14:15:56</last_logged_in> -</magento_api>-
response example: json
- - -response body:
-
-
-{
- "entity_id": "2",
- "website_id": "1",
- "email": "test@example.com",
- "group_id": "1",
- "created_at": "2012-03-22 14:15:54",
- "disable_auto_group_change": "1",
- "created_in": "English",
- "firstname": "john",
- "lastname": "Doe"
-}
-
- Description: Not allowed.
- -Description: Allows you to update an existing customer.
-Notes: The list of attributes that will be updated for customer is configured in the Magento Admin Panel. The Customer user type has access only to his/her own information.
Authentication: Admin, Customer
-Default Format: XML
-Parameters:
-You must specify only those parameters which you want to update. Parameters that are not defined in the request body will preserve the previous values. The website_id and created_in attributes are not allowed for updating.
Example:
-| PUT http://magentohost/api/rest/customers/2 |
Request Body:
-<?xml version="1.0"?> -<magento_api> - <firstname>Earl</firstname> - <lastname>Hickey</lastname> - <email>customerss@example.com</email> - <group_id>1</group_id> -</magento_api>-
Description: Allows you to delete an existing customer.
-Notes: Admin only can delete a customer.
Authentication: Admin
-Default Format: XML
-Parameters:
-No Parameters
Example:
-| DELETE http://magentohost/api/rest/customers/2 |
The Magento REST API allows you to manage customers, customer addresses, sales orders, inventory, and products. REST API is organized into the following categories:
- - - -Retrieve the list of products, create, update, delete a product.
- -Resource Structure: http://magentohost/api/rest/products
- -Retrieve the list of categories assigned to a product, assign and unassign the category from a product.
- -Resource Structure: http://magentohost/api/rest/products/:id/categories
- -Retrieve the list of images assigned to a product, add, update, remove an image to/from a product.
- -Resource Structure: http://magentohost/api/rest/products/:id/images
- -Retrieve the list of websites assigned to a product, assign, unassign a website to/from a product.
- -Resource Structure: http://magentohost/api/rest/products/:id/websites
- -Retrieve the list of customers, create, delete a customer, and update the customer information.
- -Resource Structure: http://magentohost/api/rest/customers
- -Retrieve the list of customer addresses, create, update, and delete the customer address.
- -Resource Structure: http://magentohost/api/rest/customers/:id/addresses
- -Retrieve the list of stock items, update required stock items.
- -Resource Structure: http://magentohost/api/rest/stockitems
- -Retrieve the list of sales orders with detailed information on order addresses, items, and comments.
- -Resource Structure: http://magentohost/api/rest/orders
- -Retrieve information on order billing and shipping addresses.
- -Resource Structure: http://magentohost/api/rest/orders/:id/addresses
- -Retrieve information on the specified order comments.
- -Resource Structure: http://magentohost/api/rest/orders/:id/comments
- -Retrieve information on specified order items.
- -Resource Structure: http://magentohost/api/rest/orders/:id/items
- - - - diff --git a/guides/m1x/api/rest/authentication/oauth_authentication.html b/guides/m1x/api/rest/authentication/oauth_authentication.html deleted file mode 100644 index 1813a932df..0000000000 --- a/guides/m1x/api/rest/authentication/oauth_authentication.html +++ /dev/null @@ -1,469 +0,0 @@ ---- -layout: m1x_rest -title: Authentication ---- - -In most cases, the third-party application must be authenticated to use the Magento API. But users never reveal their credentials to the application to preserve their privacy. So, the question is as follows: how is your application going to authenticate users if it does not know user credentials. OAuth is the solution.
- -Magento authentication is based on OAuth, an open standard for secure API authentication. OAuth is a token-passing mechanism that allows users to control which applications have access to their data without revealing their passwords or other credentials.
- -The OAuth concept lies in three basic elements that can be easily described in the following picture:
- - -
-
-To learn more about OAuth, you can visit the official OAuth site.
- - -The current API supports OAuth 1.0a.
- -The OAuth authentication works by asking the user to authorize their application. When the user authorizes the application, the application can access that user protected resources by using an access token. This token will be used in each further request. Access tokens are long-lived and will not expire unless the user revokes access to the application.
- -OAuth is completely invisible for the site visitors.
- -Magento uses OAuth to allow access to its data. You need to use OAuth if you want to use any of the following Magento APIs:
- -There are some definitions you need to get familiar with before you start using OAuth. These are as follows:
-The OAuth process consists of several steps:
-
-
-The application that requires access to data is known as the Consumer and Magento is the Service Provider.
- - -Before starting to make API requests, you need to register the application. After the registration, you will receive the Consumer Key that will identify you in Magento. Also, you will receive a Consumer Secret. This secret will be used when requesting for a Request Token.
- -You can register your application by selecting System > Web Services > REST - OAuth Consumers and clicking Add New in the Admin Panel.
- -When registering the application, you also need to define the callback URL, to which the user will be redirected after he/she successfully authorizes your application.
- -The authentication endpoints include the following ones:
- -Also, the simple form can be used for authentication. To use a simple form, add the /simple endpoint to the authentication endpoint. For example: /oauth/authorize/simple
- - -The first step to authenticate the user is to retrieve a Request Token from Magento. This is a temporary token that will be exchanged for the Access Token.
- - - -| Endpoint: | -/oauth/initiate | -
|---|---|
| Description: | -The first step of authentication. Allows you to obtain the Request Token used for the rest of the authentication process. | -
| Method: | -POST | -
| Returns: | -Request Token | -
| Sample Response: | -oauth_token=4cqw0r7vo0s5goyyqnjb72sqj3vxwr0h&oauth_token_secret=rig3x3j5a9z5j6d4ubjwyf9f1l21itrr&oauth_callback_confirmed=true | -
The following request parameters should be present in the Authorization header:
-The second step is to request user authorization. After receiving the Request Token from Magento, the application provides an authorization page to the user. The only required parameter for this step is the Request Token (oauth_token value) received from the previous step. The endpoint is followed by an oauth_token parameter with the value set to the oauth_token value.
- -After this, the user is asked to enter their credentials and authorize. When the user is granted the access, he/she is redirected to the URL specified in the oauth_callback parameter. This URL is followed by two parameters:
-| Endpoint: | -/oauth/authorize | -
|---|---|
| Description: | -The second step of authentication. Without the user authorization in this step, it is impossible for your application to obtain an Access Token. | -
| Method: | -GET | -
| Sample Response: | -/callback?oauth_token=tz2kmxyf3lagl3o95xnox9ia15k6mpt3&oauth_verifier=cbwwh03alr5huiz5c76wi4l21zf05eb0 | -
The final third authentication step. After the application access is authorized, the application needs to exchange the Request Token for an Access Token. For this step, you will need the Request Token (the oauth_token and oauth_token_secret values) and the oauth_verifier value from the previous step.
- - - -| Endpoint: | -/oauth/token | -
|---|---|
| Description: | -The third step of authentication. Getting an Access Token. | -
| Method: | -POST | -
| Returns: | -An access token and the corresponding access token secret, URL-encoded. | -
| Sample Response: | -oauth_token=0lnuajnuzeei2o8xcddii5us77xnb6v0&oauth_token_secret=1c6d2hycnir5ygf39fycs6zhtaagx8pd | -
The following components should be present in the Authorization header:
-The response will contain the following response parameters:
-When the third-party application performs invalid requests to Magento, the following errors related to OAuth can occur:
- - -| HTTP Code | -Error Code | -Text Representation | -Description | -
|---|---|---|---|
| 400 | -1 | -version_rejected | -This error is used when the oauth_version parameter does not correspond to the "1.0a" value. | -
| 400 | -2 | - parameter_absent |
-This error is used there is no required parameter in the request. The name of the missing parameter is specified additionally in the response. | -
| 400 | -3 | - parameter_rejected |
-This error is used when the type of the parameter or its value does not meet the protocol requirements (e.g., array is passed instead of the string). | -
| 400 | -4 | - timestamp_refused |
-This error is used if there is incorrect value of the timestamp in the oauth_timestamp parameter. | -
| 401 | -5 | - nonce_used |
-This error is used if the nonce-timestamp combination has already been used. | -
| 400 | -6 | - signature_method_rejected |
-This error is used for unsupported signature method. The following methods are supported: HMAC-SHA1, RSA-SHA1, and PLAINTEXT. | -
| 401 | -7 | - signature_invalid |
-This error is used if the signature is invalid. | -
| 401 | -8 | - consumer_key_rejected |
-This error is used if the Consumer Key has incorrect length or does not exist. | -
| 401 | -9 | - token_used |
-This error is used if there is an attempt of authorization of an already authorized token or an attempt to exchange a not temporary token for a permanent one. | -
| 401 | -10 | - token_expired |
-This error is used if the temporary token has expired. At the moment, the mechanism of expiration of temporary tokens is not implemented and the current error is not used. | -
| 401 | -11 | - token_revoked |
-This error is used if the token is revoked by the user who authorized it. | -
| 401 | -12 | - token_rejected |
-This error is used if the token is not valid, or does not exist, or is not valid for using in the current type of request. | -
| 401 | -13 | - verifier_invalid |
-This error is used if the confirmation string does not correspond to the token. | -
<?php
-/**
- * Example of retrieving the products list using Customer account via Magento REST API. OAuth authorization is used
- * Preconditions:
- * 1. Install php oauth extension
- * 2. If you were authorized as an Admin before this step, clear browser cookies for 'yourhost'
- * 3. Create at least one product in Magento and enable it for viewing in the frontend
- * 4. Configure resource permissions for Customer REST user for retrieving all product data for Customer
- * 5. Create a Consumer
- */
-// $callbackUrl is a path to your file with OAuth authentication example for the Customer user
-$callbackUrl = "http://yourhost/oauth_customer.php";
-$temporaryCredentialsRequestUrl = "http://yourhost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
-$customerAuthorizationUrl = 'http://yourhost/oauth/authorize';
-$accessTokenRequestUrl = 'http://yourhost/oauth/token';
-$apiUrl = 'http://yourhost/api/rest';
-$consumerKey = 'yourconsumerkey';
-$consumerSecret = 'yourconsumersecret';
-
-session_start();
-if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
- $_SESSION['state'] = 0;
-}
-try {
- $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
- $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
- $oauthClient->enableDebug();
-
- if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
- $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
- $_SESSION['secret'] = $requestToken['oauth_token_secret'];
- $_SESSION['state'] = 1;
- header('Location: ' . $customerAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
- exit;
- } else if ($_SESSION['state'] == 1) {
- $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
- $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
- $_SESSION['state'] = 2;
- $_SESSION['token'] = $accessToken['oauth_token'];
- $_SESSION['secret'] = $accessToken['oauth_token_secret'];
- header('Location: ' . $callbackUrl);
- exit;
- } else {
- $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
-
- $resourceUrl = "$apiUrl/products";
- $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json'));
- $productsList = json_decode($oauthClient->getLastResponse());
- print_r($productsList);
- }
-} catch (OAuthException $e) {
- print_r($e->getMessage());
- echo "<br/>";
- print_r($e->lastResponse);
-}
-
diff --git a/guides/m1x/api/rest/authentication/oauth_configuration.html b/guides/m1x/api/rest/authentication/oauth_configuration.html
deleted file mode 100644
index 4a57245088..0000000000
--- a/guides/m1x/api/rest/authentication/oauth_configuration.html
+++ /dev/null
@@ -1,261 +0,0 @@
----
-layout: m1x_rest
-title: OAuth Configuration
----
-
-
-Before starting to use OAuth, you need to perform several steps in the Magento Admin Panel. These steps allow you to enable the OAuth functionality for further actions.
- -First, you need to create a Consumer in the Admin Panel. Creating a new consumer means registering the application. To do this, perform the following steps:
- -
To edit an existing consumer, perform the following steps:
- -| The Key and Secret fields cannot be edited. |
To delete the required consumer, perform the following steps:
-You can search for a required consumer by several parameters: ID, consumer name, and date of creation.
-To search for a consumer, perform the following steps:
To view authorized tokens in the Admin panel, perform the following steps:
- -From the Authorized OAuth Tokens page, you can enable, revoke, or delete the required token.
- -To view the list of applications, perform the following steps:
-If a token is revoked (the Yes value in the Revoked column on the Authorized OAuth Tokens page), you can enable it. To do this, perform the following steps:
-| You can select more than one token with the Revoked status and enable all of them by using the mass action. |
If a token is enabled (the No value in the Revoked column), you can revoke it. To do this, perform the following steps:
-| You can select more than one token with the Revoked status set to No and revoke all of them by using the mass action. |
To delete the required token, perform the following steps:
-| You can select more than one token and delete all of them by using the mass action. |
To view the authorized applications from the frontend, perform the following steps:
- -
From this page, you can enable, revoke, or delete the required token.
- -| If the token is revoked, there will be the Disabled status next to it. |
| If the token is enabled, there will be the Enabled status next to it. |
You can set the email template that will be used for user notification if the token status changes. Also, you can set different email templates for different store views. For example, you have two store views: English and German. Magento allows you to set one email template for the English store view and another one for the German store view.
-To set the email template, perform the following steps:

You can also create your own email template that will be used for user notification if the token status changes.
-To create a new template, perform the following steps:
You can configure the cleanup functionality for temporary tokens. These tokens can be deleted after a certain period of time or after a certain number of OAuth requests.
-To configure cleanup, perform the following steps:

HTTP status codes are an essential part of the REST concept. You can get familiar with all of them on Wikipedia.
- -The Magento API attempts to return appropriate HTTP status codes for all requests. Any information is returned in the form of a standard HTTP response with an HTTP status code describing the error and the body message.
- -The following table contains possible common HTTP status codes:
- -| Status Code | -Message | -
|---|---|
| 200 OK | -- | -
| 201 Created | - Resource was partially created - |
-
| 207 Multi-Status | -- | -
| 400 Bad Request | - Resource data pre-validation error. -Resource data invalid. -Resource unknown error. -The request data is invalid. -Resource collection paging error. -The paging limit exceeds the allowed number. -Resource collection ordering error. -Resource collection filtering error. -Resource collection including additional attributes error. |
-
| 403 Forbidden | -Access denied. | -
| 404 Not Found | - Resource not found. |
-
| 405 Method Not Allowed | - Resource does not support method. -Resource method not implemented yet. |
-
| 500 Internal Error | - Unhandled simple errors. -Resource internal error. |
-
When the Magento API returns an error message, it returns it in your requested format. For example, an error in the XML format might look like the following:
-<?xml version="1.0"?> -<magento_api> - <messages> - <error> - <data_item> - <code>404</code> - <message>Resource not found.</message> - </data_item> - </error> - </messages> -</magento_api>-
An error in the JSON format might look like the following:
- -{"messages":{"error":[{"code":404,"message":"Resource not found."}]}}
- Some requests use GET parameters in the URL. These are as follows:
- -If the attribute value consists of several words separated by a whitespace, the '%20' sign is used:
- - - -For example, to filter products with the description equal to simple01:
- - - -To filter customers by email address:
- -http://magentohost/api/rest/customers?filter[1][attribute]=email&filter[1][in][0]=ryan@test.com
- - diff --git a/guides/m1x/api/rest/http_methods.html b/guides/m1x/api/rest/http_methods.html deleted file mode 100644 index 94397f2445..0000000000 --- a/guides/m1x/api/rest/http_methods.html +++ /dev/null @@ -1,90 +0,0 @@ ---- -layout: m1x_rest -title: HTTP Methods ---- - - -Accessing API is performed via HTTP. When you enter a URL into a web browser address bar, the browser performs an HTTP GET request to the URL. This usually returns a web page in the form of an HTTP response that the browser displays. But the GET method is one of several HTTP request methods. Magento REST API uses the four main HTTP methods: GET, POST, PUT, and DELETE. The most widespread methods are GET and POST. The other methods are less known but they became widely known due to the popularity of REST web services. An important concept of the REST architecture is that different HTTP request methods perform different actions when applied to the same URL.
- -For example:
- - - -will retrieve information about the specified customer;
- - - -will delete the specified customer.
- -Retrieving Resources with the HTTP GET Method
- -The HTTP GET method is defined in section 9.3 of the RFC2616 document:
- ---The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.
You can retrieve a representation of a resource by getting its URL.
- - - -Creating or Updating Resources with the HTTP POST and PUT Methods
- -The POST method is defined in section 9.5 of the RFC2616 document:
- --- - -The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:
- --
- - -- Annotation of existing resources;
--
- - -- Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;
--
- - -- Providing a block of data, such as the result of submitting a form, to a data-handling process;
--
- -- Extending a database through an append operation.
-
The PUT method is defined in section 9.6 of the RFC2616 document:
- -- - -The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.
Creating or updating a resource involves performing an HTTP POST or HTTP PUT to a resource URL.
- - - -Deleting Resources with the HTTP DELETE Method
- -The DELETE method is defined in section 9.7 of the RFC2616 document:
- -- - -The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server.
Deleting a resource is performed by means of making an HTTP DELETE request to the resource URL.
- - - diff --git a/guides/m1x/api/rest/introduction.html b/guides/m1x/api/rest/introduction.html deleted file mode 100644 index 0f666856b0..0000000000 --- a/guides/m1x/api/rest/introduction.html +++ /dev/null @@ -1,510 +0,0 @@ ---- -layout: m1x_rest -title: Introduction to the Magento 1.x REST API ---- - - -What is REST API? To make it simple, REST API defines a set of functions to which the developers can perform requests - and receive responses. The interaction is performed via the HTTP protocol. An advantage of such an approach is the - wide usage of HTTP. That is why REST API can be used practically for any programming language.
- -Common characteristics of Magento REST API resources are as follows: (magentohost is your domain)
- -Magento REST API allows managing a number of features, namely:
- -Magento REST API uses 3-legged OAuth 1.0a protocol to authenticate - the application to access the Magento service.
- - -The REST API supports the response in two formats, which are XML and JSON.
- -HTTP verbs are used to manage the state of resources. In Magento REST API, there are four verbs used to manage - resources: GET, POST, PUT, and DELETE. You can get the contents of the data using HTTP GET, delete the data using - HTTP DELETE, and create or update the data using POST/PUT.
- -All URLs in REST API have the following base URL.
- -http://magentohost/api/rest/
- - -Example
- -Supposing, you want to retrieve the list of customers from Magento. To do this, you need to use the GET HTTP method. - The GET request to retrieve the list of customers will look as follows:
- -http://magentohost/api/rest/customers
-where
- -The Magento REST API allows you to manage customers, customer addresses, sales orders, inventory, and products. REST - API is organized into the following categories:
- -These steps are required for utilizing REST API resources:
- -
<?php
-/**
-* Example of simple product POST using Admin account via Magento REST API. OAuth authorization is used.
-*
-* This file is a stand-alone OAuth client PHP file, which handles everything with the OAuth three-legged authentication.
-* It uses PHP session to persist the current authentication state (step), the OAuth request token with its secret
-* and the OAuth access token with its secret.
-*
-* Create this file oauth_admin.php in your Magento 1.x instance root folder to run this oauth authentication example.
-*
-* oauth_admin.php
-*
-*/
-
-$callbackUrl = "http://yourhost/oauth_admin.php";
-$temporaryCredentialsRequestUrl = "http://magentohost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
-$adminAuthorizationUrl = 'http://magentohost/admin/oauth_authorize';
-$accessTokenRequestUrl = 'http://magentohost/oauth/token';
-$apiUrl = 'http://magentohost/api/rest';
-$consumerKey = 'yourconsumerkey';
-$consumerSecret = 'yourconsumersecret';
-
-session_start();
-if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
- $_SESSION['state'] = 0;
-}
-try {
- $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
- $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
- $oauthClient->enableDebug();
-
- if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
- // step 1 (state 1) - Get the initial temporary request token.
- $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
-
- // persist the request token secret in the session variable for step 3 to get the access token and secret.
- $_SESSION['secret'] = $requestToken['oauth_token_secret'];
- $_SESSION['state'] = 1;
-
- // step 2 (state 2) - redirect to the Oauth admin authorization url to validate and confirm / reject the admin Oauth authorization request.
- // variable $requestToken['oauth_token'] has the temporary request token
- header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
- exit;
- } elseif ($_SESSION['state'] == 1) {
- //step 3 (state 3) Exchange the temporary request token and secret to get the final access token and secret.
- $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
- $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
-
- // persist the access token and its secret in the session variable
- $_SESSION['state'] = 2;
- $_SESSION['token'] = $accessToken['oauth_token'];
- $_SESSION['secret'] = $accessToken['oauth_token_secret'];
-
- // redirect back to the callback url which is the same file
- header('Location: ' . $callbackUrl);
- exit;
- } else {
-
- // send a POST request to create a simple product
- $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
- $resourceUrl = "$apiUrl/products";
- $productData = json_encode(array(
- 'type_id' => 'simple',
- 'attribute_set_id' => 4,
- 'sku' => 'simple' . uniqid(),
- 'weight' => 1,
- 'status' => 1,
- 'visibility' => 4,
- 'name' => 'Simple Product',
- 'description' => 'Simple Description',
- 'short_description' => 'Simple Short Description',
- 'price' => 99.95,
- 'tax_class_id' => 0,
- ));
- $headers = array('Content-Type' => 'application/json');
- $oauthClient->fetch($resourceUrl, $productData, OAUTH_HTTP_METHOD_POST, $headers);
- print_r($oauthClient->getLastResponseInfo());
- }
-} catch (OAuthException $e) {
- print_r($e);
-}
- <?php
-/**
-* Example of products list retrieve using Customer account via Magento REST API. OAuth authorization is used
-*
-* This file is a stand-alone Oauth client PHP file, which handles everything with the Oauth three-legged authentication.
-* It uses PHP session to persist the current authentication state (step), the oauth request token with its secret
-* and the oauth access token with its secret.
-*
-* Create this file oauth_customer in your Magento 1.x instance root folder to run this oauth authentication example.
-*
-* oauth_customer.php
-*
-*/
-$callbackUrl = "http://yourhost/oauth_customer.php";
-$temporaryCredentialsRequestUrl = "http://magentohost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
-$adminAuthorizationUrl = 'http://magentohost/oauth/authorize';
-$accessTokenRequestUrl = 'http://magentohost/oauth/token';
-$apiUrl = 'http://magentohost/api/rest';
-$consumerKey = 'yourconsumerkey';
-$consumerSecret = 'yourconsumersecret';
-
-session_start();
-if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
- $_SESSION['state'] = 0;
-}
-try {
- $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
- $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
- $oauthClient->enableDebug();
-
- if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
- // step 1 (state 1) - Get the initial temporary request token.
- $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
-
- // persist the request token secret in the session variable for step 3 to get the access token and secret.
- $_SESSION['secret'] = $requestToken['oauth_token_secret'];
- $_SESSION['state'] = 1;
-
- // step 2 (state 2) - redirect to the Oauth customer authorization url.
- // variable $requestToken['oauth_token'] has the temporary request token
- header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
- exit;
- } elseif ($_SESSION['state'] == 1) {
- //step 3 (state 3) Exchange the temporary request token and secret to get the final access token and secret.
- $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
- $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
-
- // persist the access token and its secret in the session variable to access the products resource
- $_SESSION['state'] = 2;
- $_SESSION['token'] = $accessToken['oauth_token'];
- $_SESSION['secret'] = $accessToken['oauth_token_secret'];
-
- // redirect back to the callback url which is the same file
- header('Location: ' . $callbackUrl);
- exit;
- } else {
- // send a GET request to list all the products
- $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
- $resourceUrl = "$apiUrl/products";
- $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => '*/*'));
- $productsList = json_decode($oauthClient->getLastResponse());
- print_r($productsList);
- }
-} catch (OAuthException $e) {
- print_r($e);
-}
- Retrieving the list of Products as a Guest
- -Example: XML
-<?xml version="1.0"?> -<magento_api> - <data_item> - <entity_id>16</entity_id> - <type_id>simple</type_id> - <sku>n2610</sku> - <description>The Nokia 2610 is an easy to use device that combines multiple messaging options including email, instant messaging, and more. You can even download MP3 ringtones, graphics, and games straight to the phone, or surf the Internet with Cingular's MEdia Net service. It's the perfect complement to Cingular service for those even remotely interested in mobile Web capabilities in an affordable handset. -Design -Compact and stylish, the 2610 features a candybar design sporting a bright 128 x 128 pixel display capable of displaying over 65,000 colors. Most of the phone's features and on-screen menus are controlled by a center toggle on the control pad. A standard hands-free headphone jack is provided, as are volume control keys, and there's even a "Go-To" button that can be assigned by the user for quick access to favorite applications. Lastly, the included speakerphone allows you to talk handsfree, and because the phone sports an internal antenna, there's nothing to snag or break off. -</description> - <meta_keyword>Nokia 2610, cell, phone, </meta_keyword> - <short_description>The words "entry level" no longer mean "low-end," especially when it comes to the Nokia 2610. Offering advanced media and calling features without breaking the bank</short_description> - <name>Nokia 2610 Phone</name> - <meta_title>Nokia 2610</meta_title> - <meta_description>Offering advanced media and calling features without breaking the bank, The Nokia 2610 is an easy to use</meta_description> - <regular_price_with_tax>149.99</regular_price_with_tax> - <regular_price_without_tax>149.99</regular_price_without_tax> - <final_price_with_tax>149.99</final_price_with_tax> - <final_price_without_tax>149.99</final_price_without_tax> - <is_saleable>1</is_saleable> - <image_url>http://magentohost/imageulr/nokia.jpg</image_url> - </data_item> - <data_item> - <entity_id>17</entity_id> - <type_id>simple</type_id> - <sku>bb8100</sku> - <description> Like the BlackBerry 7105t, the BlackBerry 8100 Pearl is -The BlackBerry 8100 Pearl sports a large 240 x 260 screen that supports over 65,000 colors-- plenty of real estate to view your e-mails, Web browser content, messaging sessions, and attachments. The venerable BlackBerry trackwheel has been replaced on this model with an innovative four-way trackball placed below the screen. On the rear of the handheld, you'll find a 1.3-megapixel camera and a self portrait mirror. The handheld's microSD memory card slot is located inside the device, behind the battery. There's also a standard 2.5mm headset jack that can be used with the included headset, as well as a mini-USB port for data connectivity.</description> - <meta_keyword>Blackberry, 8100, pearl, cell, phone</meta_keyword> - <short_description>The BlackBerry 8100 Pearl is a departure from the form factor of previous BlackBerry devices. This BlackBerry handset is far more phone-like, and RIM's engineers have managed to fit a QWERTY keyboard onto the handset's slim frame.</short_description> - <name>BlackBerry 8100 Pearl</name> - <meta_title>BlackBerry 8100 Pearl</meta_title> - <meta_description>BlackBerry 8100 Pearl sports a large 240 x 260 screen that supports over 65,000 colors-- plenty of real estate to view your e-mails, Web browser content, messaging sessions, and attachments.</meta_description> - <regular_price_with_tax>349.99</regular_price_with_tax> - <regular_price_without_tax>349.99</regular_price_without_tax> - <final_price_with_tax>349.99</final_price_with_tax> - <final_price_without_tax>349.99</final_price_without_tax> - <is_saleable>1</is_saleable> - <image_url>http://magentohost/imageulr/blackberry.jpg</image_url> - </data_item> -</magento_api>-
Additional Information
- -You can define the limit of items returned in the response by passing the limit parameter. By default, 10 items are - returned and the maximum number is 100 items. You can also define the page number by passing the page parameter. - Example:
- -http://magentohost/api/rest/products?page=2&limit=20
-Authorization header will be required for Admin and Customer user types. The following parameters must be provided in - the Authorization header for the call:
-REST attributes allow specifying additional filters for different types of users. Attributes allow limiting user access more precisely.
- - -
-
-The REST attributes tree includes the following elements (as subnodes):
-The Resources tree may be too immense. To avoid scrolling down when searching for the required resource, you can fold the nodes for better representation.
- - - -This section provides some examples of limiting Guest and Customer access to certain resource elements.
- -To allow Guests (users that are not registered in the Magento system) view only product name and final price with tax, perform the following steps:
-To allow Customers (users that are registered in the Magento system) view only product name and final price with tax, perform the following steps:
-The following table describes REST attributes that can be managed in the Magento Admin Panel.
-To access these attributes, go to System > Web Services > REST Attributes and select the type of the user for which attributes will be managed.
| Attribute Name | -Attribute Description | -Notes | -
|---|---|---|
| Order ID | -Sales order ID | -- |
| Order Date |
-Date when the sales order was placed | -- |
| Order Status | -Sales order status. Can have the following values: Pending, Processing, Complete, Closed, Holded, Pending PayPal, and Payment Review. | -- |
| Shipping Method | -Shipping method selected during the checkout process (e.g., Flat rate - Fixed) | -- |
| Payment Method | -Payment method selected during the checkout process (e.g., Check/money order) | -- |
| Base Currency |
-Base currency code (e.g., USD) | -- |
| Order Currency | - Order currency code (e.g., EUR) |
-- |
| Store Name |
- Name of the store from which the order was placed |
-- |
| Placed from IP |
- IP address from which the order was placed |
-- |
| Store Currency to Base Currency Rate |
- Store currency to base currency rate |
-- |
| Subtotal |
- Subtotal amount in order currency (excluding shipping and tax) |
-- |
| Subtotal Including Tax |
- Subtotal amount including tax (in order currency) |
-- |
| Discount |
- Discount amount applied in the sales order in order currency |
-- |
| Grand Total to Be Charged |
- Total amount of money to be paid for the order in base currency (including tax) |
-- |
| Grand Total |
- Grand total amount in order currency (including tax and shipping) |
-- |
| Shipping |
- Shipping amount applied in the sales order in order currency |
-- |
| Shipping Including Tax |
- Shipping amount including tax (in order currency) |
-- |
| Shipping Tax |
- Tax amount for shipping in order currency |
-- |
| Tax Amount |
- Tax amount applied in the sales order in order currency |
-- |
| Tax Name |
-Name of the applied tax | -- |
| Tax Rate |
-Tax rate applied in the order (in order currency) | -- |
| Gift Cards Amount |
-Gift card pricing amount | -This attribute is available only in Magento EE | -
| Reward Points Balance |
-Reward points amount (that can be converted to currency) | - This attribute is available only in Magento EE |
-
| Reward Currency Amount |
-Reward currency amount | - This attribute is available only in Magento EE |
-
| Coupon Code |
- Coupon code that was applied in the order |
-- |
| Base Discount |
- Amount of applied discount in base currency |
-- |
| Base Subtotal |
- Subtotal amount for all products in the order in base currency (excluding tax and shipping) |
-- |
| Base Shipping |
- Amount of money to be paid for shipping in base currency |
-- |
| Base Shipping Tax |
- Tax amount for shipping in base currency |
-- |
| Base Tax Amount |
- Tax amount applied to the order items in base currency |
-- |
| Total Paid |
- Total amount paid for the order (in order currency) |
-- |
| Base Total Paid |
- Total amount paid for the order (in base currency) |
-- |
| Total Refunded |
- Total refunded amount in order currency |
-- |
| Base Total Refunded |
- Total amount refunded for the order (in base currency) |
-- |
| Base Subtotal Including Tax |
- Subtotal amount including tax but excluding the discount amount (in base currency) |
-- |
| Base Total Due |
- The rest of the money to be paid for the order in base currency (e.g., when partial invoice is applied) |
-- |
| Total Due |
- The rest of the money to be paid for the order in order currency (e.g., when partial invoice is applied) |
-- |
| Shipping Discount |
- Discount amount for shipping (in order currency) |
-- |
| Base Shipping Discount |
- Discount amount for shipping (in base currency) |
-- |
| Discount Description |
- Discount code (coupon code applied in the order) |
-- |
| Customer Balance |
-Customer balance (in order currency) | -- |
| Base Customer Balance |
-Customer balance (in base currency) | -- |
| Base Gift Cards Amount |
-Gift card pricing amount (in base currency) | - This attribute is available only in Magento EE |
-
| Base Rewards Currency |
-Reward currency amount (in base currency) | - This attribute is available only in Magento EE |
-
| Attribute Name | -Attribute Description | -
|---|---|
| Customer Last Name | -Customer last name | -
| Customer First Name |
-Customer first name | -
| Customer Middle Name |
-Customer middle name or initial | -
| Customer Prefix |
-Customer prefix | -
| Customer Suffix |
-Customer suffix | -
| Company |
-Company name | -
| Street |
-Street address | -
| City |
-City | -
| State |
-State | -
| ZIP/Postal Code |
-ZIP or postal code | -
| Country |
-Country name | -
| Phone Number |
-Customer phone number | -
| Address Type |
-Address type. Can have the following values: billing or shipping | -
| Attribute Name | -Attribute Description | -
|---|---|
| Base Discount Amount | -Discount amount applied to the row in base currency | -
| Base Item Subtotal | -Row subtotal in base currency | -
| Base Item Subtotal Including tax | - Row subtotal including tax in base currency |
-
| Base Original Price | - Original item price in base currency |
-
| Base Price | - Item price in base currency |
-
| Base Price Including tax | - Item price including tax in base currency |
-
| Base Tax Amount | - Tax amount applied to the row in base currency |
-
| Canceled Qty | - Number of canceled order items |
-
| Discount Amount | -Discount amount applied to the row in order currency | -
| Invoiced Qty | - Number of invoiced order items |
-
| Item Subtotal | -Row subtotal in order currency | -
| Item Subtotal Including Tax | -Row subtotal including tax in order currency | -
| Order Item ID | -Order item ID | -
| Ordered Qty | - Number of ordered items |
-
| Original Price | -Original item price in order currency | -
| Parent Order Item ID | -ID of the configurable product to which the simple product is assigned | -
| Price | - Item price in order currency |
-
| Price Including Tax | -Item price including tax in order currency | -
| Product and Custom Options Name | -Name of the product (custom options name) | -
| Refunded Qty | - Number of refunded order items |
-
| SKU | - Product SKU |
-
| Shipped Qty | - Number of shipped order items |
-
| Tax Amount | -Tax amount applied to the row in order currency | -
| Tax Percent | -Tax percent applied to the row | -
| Attribute Name | -Attribute Description | -
|---|---|
| Automatically Return Credit Memo Item to Stock | -Defines whether products can be automatically returned to stock when the refund for an order is created | -
| Backorders | -Defines whether the customer can place the order for products that are out of stock at the moment. Can have the following values: 0 - No Backorders, 1 - Allow Qty Below 0, and 2 - Allow Qty Below 0 and Notify Customer | -
| Can Be Divided into Multiple Boxes for Shipping | - Defines whether the stock items can be divided into multiple boxes for shipping |
-
| Enable Qty Increments | - Defines whether the customer can add products only in increments to the shopping cart |
-
| Item ID | - Stock item ID |
-
| Low Stock Date | - Date when the number of stock items became lower than the number defined in the Notify for Quantity Below option |
-
| Manage Stock | - Choose whether to view and specify the product quantity and availability and whether the product is in stock management. Can have the following values: 0 - No, 1 - Yes |
-
| Maximum Qty Allowed in Shopping Cart | - Maximum number of items in the shopping cart to be sold |
-
| Minimum Qty Allowed in Shopping Cart | - Minimum number of items in the shopping cart to be sold |
-
| Notify for Quantity Below | - The number of inventory items below which the customer will be notified via the RSS feed |
-
| Product ID | - Product ID |
-
| Qty | - Quantity of stock items for the current product |
-
| Qty Increments | - The product quantity increment value |
-
| Qty Uses Decimals | - Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) |
-
| Qty for Item's Status to Become Out of Stock | - Quantity for stock items to become out of stock |
-
| Stock Availability | - Defines whether the product is available for selling. Can have the following values: 0 - Out of Stock, 1 - In Stock |
-
| Stock ID | - Stock ID |
-
| Use Config Settings for Backorders | - Choose whether the Config settings will be applied for the Backorders option |
-
| Use Config Settings for Enable Qty Increments | - Choose whether the Config settings will be applied for the Enable Qty Increments option |
-
| Use Config Settings for Manage Stock | - Choose whether the Config settings will be applied for the Manage Stock option |
-
| Use Config Settings for Maximum Qty Allowed in Shopping Cart | - Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option |
-
| Use Config Settings for Minimum Qty Allowed in Shopping Cart | - Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option |
-
| Use Config Settings for Notify for Quantity Below | - Choose whether the Config settings will be applied for the Notify for Quantity Below option |
-
| Use Config Settings for Qty Increments | - Choose whether the Config settings will be applied for the Qty Increments option |
-
| Use Config Settings for Qty for Item's Status to Become Out of Stock | - Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock option |
-
Notes: The Admin user type has restrictions concerning the WRITE operations for definite stock item attributes. These are as follows:
- -| Attribute Name | -Admin | -
|---|---|
| Item ID | -No | -
| Product ID | -No | -
| Stock ID | -No | -
| Low Stock Date | -No | -
However, these attributes are available for READ operations.
- - - -| Attribute Name | -Attribute Description | -
|---|---|
| Customer ID | -Customer ID | -
| Last Logged In | -Date when the customer was logged in last | -
| Is Confirmed | -Defines whether the email confirmation is sent to the customer | -
| Created At | -Date when the customer was created | -
| Associate to Website | -Website ID to which the customer is associated | -
| Created From | -Store view from which the customer was created | -
| Group | -Customer group ID | -
| Disable automatic group change | -Defines whether the automatic group change will be applied to the customer | -
| Prefix | -Customer prefix | -
| First Name | -Customer first name | -
| Middle Name/Initial | -Customer middle name or initial | -
| Last Name | -Customer last name | -
| Suffix | -Customer suffix | -
| Customer email address | -|
| Date Of Birth | -Customer date of birth | -
| Tax/VAT Number | -Customer tax or VAT number | -
| Gender | -Customer gender (male or female) | -
| Attribute Name | -Attribute Description | -
|---|---|
| City | -City name | -
| Company | -Company name | -
| Country | -Country | -
| Customer Address ID | -Customer address ID | -
| Fax | -Fax number | -
| First Name | -Customer first name | -
| Is Default Billing Address | -Defines whether the address is a default one for billing | -
| Is Default Shipping Address | -Defines whether the address is a default one for shipping | -
| Last Name | -Customer last name | -
| Middle Name/Initial | -Customer middle name or initial | -
| Prefix | -Customer prefix | -
| State/Province | -Customer state/region | -
| Street Address | -Customer street address | -
| Suffix | -Customer suffix | -
| Telephone | -Customer phone number | -
| VAT Number | -Customer VAT number | -
| ZIP/Postal Code | -Customer ZIP or postal code | -
Attributes for the product resource are divided into those available for the Admin type of user and those available for the Customer and Guest types of user.
- - -| Attribute Name | -Attribute Description | -Notes | -
|---|---|---|
| Product ID | -Product ID | -Available only for Admin | -
| name | -Product Name | -- |
| Product Type | -Product type. Can have the following values: Simple, Grouped, Configurable, Virtual, Bundle, or Downloadable | -- |
| Attribute Set Name | -Name of the attribute set which the product is based on | - Available only for Admin |
-
| sku |
-Product SKU | -- |
| price | -Product price | -- |
| visibility | -Product visibility in the store. Can have the following values: Catalog, Search; Search; Catalog; Not Visible Individually | - Available only for Admin |
-
| description | -Product description | -- |
| short_description | -Product short description | -- |
| weight | -Product weight | - Available only for Admin |
-
| news_from_date | -Date starting from which the product is promoted as a new product | - Available only for Admin |
-
| news_to_date | -Date till which the product is promoted as a new product | - Available only for Admin |
-
| status | -Product status in the store. Can have the following values: Enabled or Disabled | - Available only for Admin |
-
| url_key | -A friendly URL path for the product | - Available only for Admin |
-
| Create Permanent Redirect for Old URL | -Defines whether the redirect to an original URL will be applied (when the existing URL for a product is edited) | - Available only for Admin; available only for product update |
-
| country_of_manufacture | -Product country of manufacture | - Available only for Admin |
-
| is_returnable | -Defines whether the product can be returned | - Available only for Admin |
-
| special_price | -Product special price | - Available only for Admin |
-
| special_from_date | -Date starting from which the special price will be applied for the product | - Available only for Admin |
-
| special_to_date | -Date till which the special price will be applied for the product | - Available only for Admin |
-
| group_price | -Product group price | - Available only for Admin |
-
| tier_price | -Product tier price | -- |
| msrp_enabled | -The Apply MAP option. Defines whether the price in the catalog in the frontend is substituted with a Click for price link | - Available only for Admin |
-
| msrp_display_actual_price_type | -Defines how the price will be displayed in the frontend. Can have the following values: In Cart, Before Order Confirmation, and On Gesture | - Available only for Admin |
-
| msrp | -The Manufacturer's Suggested Retail Price option. The price that a manufacturer suggests to sell the product at | - Available only for Admin |
-
| enable_googlecheckout | -Defines whether the product can be purchased with the help of the Google Checkout payment service. Can have the following values: Yes and No | - Available only for Admin |
-
| tax_class_id | -The product tax class to which the product will be associated | - Available only for Admin |
-
| meta_title | -Product meta title | -- |
| meta_keyword | -Product meta keywords | -- |
| meta_description | -Product meta description | -- |
| custom_design | -Custom design applied for the product page | - Available only for Admin |
-
| custom_design_from | -Date starting from which the custom design will be applied for the product page | - Available only for Admin |
-
| custom_design_to | -Date till which the custom design will be applied for the product page | - Available only for Admin |
-
| custom_layout_update | -An XML block to alter the page layout | - Available only for Admin |
-
| page_layout | -Page template that can be applied to the product page | - Available only for Admin |
-
| options_container | -Defines how the custom options for the product will be displayed. Can have the following values: Block after Info Column or Product Info Column | - Available only for Admin |
-
| gift_message_available | -Defines whether the gift message is available for the product | - Available only for Admin |
-
| Use Config Settings for Allow Gift Message | -Defines whether the configuration settings will be used for the Allow Gift Message option | - Available only for Admin |
-
| gift_wrapping_available | -Defines whether the gift wrapping is available for the product | -Available only for Admin. This attribute is available in Magento EE | -
| Use Config Settings for Allow Gift Wrapping | -Defines whether the configuration settings will be used for the Allow Gift Wrapping option | - Available only for Admin. This attribute is available in Magento EE |
-
| gift_wrapping_price | -Price for the gift wrapping (available in Magento EE) | - Available only for Admin |
-
| Inventory Data | -Product inventory data | - Available only for Admin |
-
| Custom attr | -Product custom attributes | -The customer can see only attributes that are set as visible on frontend | -
| Regular Price | -The original product price displayed in the frontend | - Available only for Customer and Guest |
-
| Final Price | -The final product price | - Available only for Customer and Guest |
-
| Final Price with Tax |
-The final product price with tax | - Available only for Customer and Guest |
-
| Final Price Without Tax |
-The final product price without tax | - Available only for Customer and Guest |
-
| Stock Status |
-The product stock status (availability) | - Available only for Customer and Guest |
-
| Product Is Saleable |
-Defines whether the product can be sold | - Available only for Customer and Guest |
-
| Total Reviews Number |
-The number of all reviews for a product | - Available only for Customer and Guest |
-
| Product URL Link |
-A link to the product without the assigned category | - Available only for Customer and Guest |
-
| Buy Now Link |
-A link that adds a product to the shopping cart | - Available only for Customer and Guest |
-
| Product Has Custom Options |
-Defines whether the product has custom options or not | - Available only for Customer and Guest |
-
| Default Product Image |
-Default product image | -Available only for Customer and Guest | -
| Attribute Name | -Attribute Description | -
|---|---|
| Category ID | -ID of the category to which the product is assigned | -
| Attribute Name | -Attribute Description | -Notes | -
|---|---|---|
| Exclude | -Defines whether the image will associate only to one of the three image types. | -- |
| ID | -Image file ID | -Available only for READ operations | -
| Label | - A label that will be displayed on the frontend when pointing to the image |
-- |
| Position | - The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. |
-- |
| Type | -Image type. Can have the following values: Base Image, Small Image, or Thumbnail. | -- |
| URL | -Image file URL path | - Available only for READ operations |
-
| File Content | -Image file content (base_64 encoded) | -Available only for WRITE operations | -
| File MIME Type | -File MIME type. Can have the following values: image/jpeg, image/png, image/gif, etc. | - Available only for WRITE operations |
-
| File Name | -Image file name | - Available only for WRITE operations |
-
After the authentication is complete successfully, the Access Token is received and will be used in every API call. This key allows identifying the client that accesses the API. With the help of this key, the following information about the user can be retrieved:
- -There is a three-level authorization approach in Magento REST API. These three levels are as follows:
-The following graphic describes the default rights for each access level with each level obtaining more rights up to Admin who has access to everything.
- -
-
-
-Each user type will be described below.
-Magento grants permissions for the following three types of users:
Guest
- -Guest can be a type of application that does not require authentication. This application has access only to public resources.
- -Customer
- -Customer can be a registered and logged in user. This type of user can have access only to its own resources as well as to public resources.
- -Admin
- -Admin can be the store owner. This type has full set of permissions.
- -Understanding of access levels is the basis of the ACL work.
- -Every user has a specific role and purpose. To accomplish their goals, each user must be able to access certain resources and perform specific actions. Allowing users to access the resources without any limits can compromise Magento security.
- -The Access Control List (ACL) is a set of permissions (access rights) that particular users have for certain resources. When a user wants to perform a specific action with a resource (for example, update the customer information), Magento checks the permission for this combination of user, resource, and action. If the action is allowed, the user can proceed. Otherwise, the action is denied.
- -Access control lists include two main things: a subject and an object. Usually, the subject is the user who wants to use the resource. The object is the resource that a certain user wants to have access to. So, ACL is used to decide when the subject can have access to object.
- -You should remember that ACL is not the same as authentication. ACL is the next step after the authentication is passed successfully. These two concepts are closely connected but the difference lies in the following: authentication is understanding who the user is and ACL is understanding what the user can do.
- - - -ACL is implemented in a tree structure. There is a tree of resources for each user type. Namely, Admin, Customer, and Guest have their own trees of resources.
-Each ACL entry specifies two instances: a subject and an action the subject can perform.
Example of the resource tree for the Admin role is as follows:
-
All REST resource attributes are divided into two categories: Read and Write. The Read category includes the operation of retrieving. So, when selecting the attributes in the Read category, you specify them for the resource retrieving. The Write category includes the operations of creating and updating. So, when selecting the attributes in the Write category, you specify them for the resource creation and updating. To illustrate the situation, let's take the following example:
-
Setting up ACL is performed on two levels:
- - - -REST roles in Magento are used to limit access to certain resources. Limiting access lies in configuration of a REST role and assigning a user to it. You can select which resources will be available for the user and which will not.
- -REST roles management consists in the role creation, editing, deleting, and user assignment. Note that REST role creation and deletion is available only for Admin role.
- -The REST Roles page initially includes two roles: Customer and Guest.
- -Only API Resources can be edited in the Guest and Customer roles. You cannot change the name or assigned users in these roles. Also, you cannot delete the Guest or Customer role. For example, when editing the Guest Role, the page looks as follows:
-
To view the list of REST roles, perform the following steps:
-To add a new REST role for Admin, perform the following steps:
- -To edit an existing Admin REST role, perform the following steps:
-To delete an existing Admin REST role, perform the following steps:
-To assign a REST role to admin, perform the following steps:
-To assign more than one user to an existing Admin REST role, perform the following steps:
-To view the list of users assigned to a REST role, perform the following steps:
-To unassign the Admin REST role from a user, perform the following steps:
-As it has been mentioned before, the Customer and Guest roles cannot be removed and can be only partially edited. You can edit only the resources and actions allowed for the user.
- -To edit the Guest REST role, perform the following steps:
-To edit the Customer REST role, perform the following steps:
-If you make a Magento API call, you are guaranteed to receive some kind of a response. If you make a successful call, you will receive an HTTP response with a 200 OK status.
- -You can view the response data from any Magento API call in one of the following two formats:
- -The format of returned data is defined in the request header. The format you choose depends on what you are familiar with most or tools available to you.
- - -The XML response format is a simple XML block.
-To set the response format to XML, add the Accept request header with the text/xml value.
A successful call will return the following response (example of retrieving information about stock items):
- -<?xml version="1.0"?> -<magento_api> - <data_item> - <item_id>1</item_id> - <product_id>1</product_id> - <stock_id>1</stock_id> - <qty>99.0000</qty> - <low_stock_date></low_stock_date> - </data_item> - <data_item> - <item_id>2</item_id> - <product_id>2</product_id> - <stock_id>1</stock_id> - <qty>100.0000</qty> - <low_stock_date></low_stock_date> - </data_item> -</magento_api>-
If an error occurs, the call may return the following response:
- -<?xml version="1.0"?> -<magento_api> - <messages> - <error> - <data_item> - <code>404</code> - <message>Resource not found.</message> - </data_item> - </error> - </messages> -</magento_api>-
JSON (JavaScript Object Notation) is a lightweight data-interchange format.
-To set the response format to JSON, add the Accept request header with the application/json value.
The JSON objects represent a direct mapping of the XML block from the XML response format.
- -A simple XML error
- -<messages> - <error> - <data_item> - <code>404</code> - <message>Resource not found.</message> - </data_item> - </error> - </messages>-
will be transformed to
- -{"messages":{"error":[{"code":404,"message":"Resource not found."}]}}
- A successful API call to the Stock Items resource will return the following XML response:
-<?xml version="1.0"?> -<magento_api> - <data_item> - <item_id>1</item_id> - <product_id>1</product_id> - <stock_id>1</stock_id> - <qty>99.0000</qty> - <low_stock_date></low_stock_date> - </data_item> - <data_item> - <item_id>2</item_id> - <product_id>2</product_id> - <stock_id>1</stock_id> - <qty>100.0000</qty> - <low_stock_date></low_stock_date> - </data_item> -</magento_api>-
The JSON equivalent will be as follows:
-[{"item_id":"1","product_id":"1","stock_id":"1","qty":"99.0000","low_stock_date":null},{"item_id":"2","product_id":"2","stock_id":"1","qty":"100.0000","low_stock_date":null}]
- The list of HTTP status codes that are returned in the API response is described in the Common HTTP Status Codes part of the documentation. There, you can find the list of codes themselves together with their description.
- - - diff --git a/guides/m1x/api/rest/testing_rest_resources.html b/guides/m1x/api/rest/testing_rest_resources.html deleted file mode 100644 index c41954252d..0000000000 --- a/guides/m1x/api/rest/testing_rest_resources.html +++ /dev/null @@ -1,170 +0,0 @@ ---- -layout: m1x_rest -title: Testing REST Resources ---- - -Three steps are required for utilizing REST API resources:
-The following headers are required for the call:
-The following parameters must be provided in the Authorization header for the call:
-
-
- An authorization header is created on the main page of REST Client.
-
-
- 

Example: Retrieving the List of Products
- -



- Example: Retrieving the list of customers
- -
Example: Creating a customer address
- -
Welcome to the Magento 1.x SOAP API home page.
- -The Mage_Catalog module allows you to manage categories and products.
- -Allows you to manage categories and how products are assigned to categories.
- -Resource Name: catalog_category
- -Aliases:
-Methods:
-Allows you to retrieve the list of category attributes and options.
- -Resource Name: catalog_category_attribute
- -Aliases:
-Methods:
-Allows you to manage products.
- -Resource Name: catalog_product
- -Aliases:
-Methods:
-Allows you to retrieve product attributes and options.
- -Resource Name: catalog_product_attribute
- -Aliases:
-Methods:
-Allows you to retrieve product attribute sets.
- -Resource Name: catalog_product_attribute_set
- -Aliases:
-Methods:
-Allows you to retrieve product types.
- -Resource Name: catalog_product_type
- -Aliases:
-Methods:
-Allows you to manage product images.
- -Resource Name: catalog_product_attribute_media
- -Aliases:
-Methods:
-Allows you to retrieve and update product tier prices.
- -Resource Name: catalog_product_attribute_tier_price
- -Aliases:
-Methods:
-Allows you to manage links for products, including related, cross-sells, up-sells, and grouped.
- -Resource Name: catalog_product_link
- -Aliases:
-Methods:
-Allows you to add, remove, and retrieve a link to a downloadable product.
- -Resource Name: product_downloadable_link
- - -Allows you to add, update, remove, and retrieve product tags.
- -Resource Name: catalog_product_tag
- -Aliases:
-Allows you to manage product custom options, including adding, updating, removing, and retrieving information.
- -Resource Name: catalog_product_custom_option
- -Aliases:
-Allows you to manage product custom option values, including adding, updating, removing, and retrieving information.
- -Resource Name: catalog_product_custom_option_value
- -Aliases:
-The Mage_Catalog module allows you to manage categories and products.
- -Allows you to manage categories and how products are assigned to categories.
- -Resource Name: catalog_category
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested store view not found. | -
| 101 | -Requested website not found. | -
| 102 | -Category not exists. | -
| 103 | -Invalid data given. Details in error message. | -
| 104 | -Category not moved. Details in error message. | -
| 105 | -Category not deleted. Details in error message. | -
| 106 | -Requested product is not assigned to category. | -
function getSomeRandomCategory(&$categories, $targetLevel, $currentLevel = 0) {
- if (count($categories)==0) {
- return false;
- }
- if ($targetLevel == $currentLevel) {
- return $categories[array_rand($categories)];
- } else {
- return getSomeRandomCategory($categories[array_rand($categories)]['children'], $targetLevel + 1);
- }
-}
-
-$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$allCategories = $proxy->call($sessionId, 'category.tree'); // Get all categories.
-
-// select random category from tree
-while (($selectedCategory = getSomeRandomCategory($allCategories, 3)) === false) {}
-
-// create new category
-$newCategoryId = $proxy->call(
- $sessionId,
- 'category.create',
- array(
- $selectedCategory['category_id'],
- array(
- 'name'=>'Newopenerp',
- 'is_active'=>1,
- 'include_in_menu'=>2,
- 'available_sort_by'=>'position',
- 'default_sort_by'=>'position'
- )
- )
-);
-
-$newData = array('is_active'=>1);
-// update created category on German store view
-$proxy->call($sessionId, 'category.update', array($newCategoryId, $newData, 'german'));
-
-$firstLevel = $proxy->call($sessionId, 'category.level', array(null, 'german', $selectedCategory['category_id']));
-
-var_dump($firstLevel);
-
-// If you wish remove category, uncomment next line
-//$proxy->call($sessionId, 'category.delete', $newCategoryId);
- $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$categoryId = 5; // Put here your category id
-$storeId = 1; // You can add store level
-
-$assignedProducts = $proxy->call($sessionId, 'category.assignedProducts', array($categoryId, $storeId));
-var_dump($assignedProducts); // Will output assigned products.
-
-// Assign product
-$proxy->call($sessionId, 'category.assignProduct', array($categoryId, 'someProductSku', 5));
-
-// Update product assignment position
-$proxy->call($sessionId, 'category.updateProduct', array($categoryId, 'someProductSku', 25));
-
-// Remove product assignment
-$proxy->call($sessionId, 'category.removeProduct', array($categoryId, 'someProductSku'));
- The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Assign a product to the required category.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -categoryId | -ID of the category | -
| string | -product/productId | -ID or SKU of the product to be assigned to the category | -
| string | -position | -Position of the assigned product in the category (optional) | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' argument | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the product is assigned to the specified category | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.assignProduct', array('categoryId' => '4', 'product' => '1'));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryAssignProduct($sessionId, '4', '3');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryAssignProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '5', 'productId' => '1', 'position' => '5'));
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Retrieve the list of products assigned to a required category.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -categoryId | -ID of the required category | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogAssignedProduct | -
The catalogAssignedProduct content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -product_id | -ID of the assigned product | -
| string | -type | -Product type | -
| int | -set | -Attribute set ID | -
| string | -sku | -Product SKU | -
| int | -position | -Position of the assigned product | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.assignedProducts', '4');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryAssignedProducts($sessionId, '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryAssignedProducts((object)array('sessionId' => $sessionId->result, 'categoryId' => '4'));
-var_dump($result->result);
- array - 0 => - array - 'product_id' => string '1' (length=1) - 'type' => string 'simple' (length=6) - 'set' => string '4' (length=1) - 'sku' => string 'n2610' (length=5) - 'position' => string '1' (length=1) - 1 => - array - 'product_id' => string '2' (length=1) - 'type' => string 'simple' (length=6) - 'set' => string '4' (length=1) - 'sku' => string 'b8100' (length=5) - 'position' => string '1' (length=1)-
The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Create a new category and return its ID.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -parentId | -Parent category ID | -
| array | -categoryData | -Array of catalogCategoryEntityCreate | -
| string | -storeView | -Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - attribute_id |
-ID of the created category | -
The categoryData content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -name | -Name of the created category | -
| int | -is_active | -Defines whether the category will be visible in the frontend | -
| int | -position | -Position of the created category (optional) | -
| ArrayOfString | -available_sort_by | -All available options by which products in the category can be sorted | -
| string | -custom_design | -The custom design for the category (optional) | -
| int | - custom_apply_to_products |
-Apply the custom design to all products assigned to the category (optional) | -
| string | -custom_design_from | -Date starting from which the custom design will be applied to the category (optional) | -
| string | -custom_design_to | -Date till which the custom design will be applied to the category (optional) | -
| string | -custom_layout_update | -Custom layout update (optional) | -
| string | -default_sort_by | -The default option by which products in the category are sorted | -
| string | -description | -Category description (optional) | -
| string | -display_mode | -Content that will be displayed on the category view page (optional) | -
| int | -is_anchor | -Defines whether the category will be anchored (optional) | -
| int | -landing_page | -Landing page (optional) | -
| string | -meta_description | -Category meta description (optional) | -
| string | -meta_keywords | -Category meta keywords (optional) | -
| string | -meta_title | -Category meta title (optional) | -
| string | -page_layout | -Type of page layout that the category should use (optional) | -
| string | -url_key | -A relative URL path which can be entered in place of the standard target path (optional) | -
| int | -include_in_menu | -Defines whether the category is visible on the top menu bar | -
| string | -filter_price_range | - Price range of each price level displayed in the layered navigation block (optional) |
-
| int | - custom_use_parent_settings |
- Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No (optional) |
-
Notes: The position parameter is deprecated, the category will be positioned anyway in the end of the list and you can not set the position directly. You should use the catalog_category.move method instead. You cannot also assign a root category to the specified store.
- -$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->call($session, 'catalog_category.create', array(2, array(
- 'name' => 'Category name',
- 'is_active' => 1,
- 'position' => 1,
- //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
- //and you can not set position directly, use catalog_category.move instead -->
- 'available_sort_by' => 'position',
- 'custom_design' => null,
- 'custom_apply_to_products' => null,
- 'custom_design_from' => null,
- 'custom_design_to' => null,
- 'custom_layout_update' => null,
- 'default_sort_by' => 'position',
- 'description' => 'Category description',
- 'display_mode' => null,
- 'is_anchor' => 0,
- 'landing_page' => null,
- 'meta_description' => 'Category meta description',
- 'meta_keywords' => 'Category meta keywords',
- 'meta_title' => 'Category meta title',
- 'page_layout' => 'two_columns_left',
- 'url_key' => 'url-key',
- 'include_in_menu' => 1,
-)));
-
-var_dump ($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->catalogCategoryCreate($session, 2, array(
- 'name' => 'Category name 2',
- 'is_active' => 1,
- 'position' => 1,
- //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
- //and you can not set position directly, use catalog_category.move instead -->
- 'available_sort_by' => array('position'),
- 'custom_design' => null,
- 'custom_apply_to_products' => null,
- 'custom_design_from' => null,
- 'custom_design_to' => null,
- 'custom_layout_update' => null,
- 'default_sort_by' => 'position',
- 'description' => 'Category description',
- 'display_mode' => null,
- 'is_anchor' => 0,
- 'landing_page' => null,
- 'meta_description' => 'Category meta description',
- 'meta_keywords' => 'Category meta keywords',
- 'meta_title' => 'Category meta title',
- 'page_layout' => 'two_columns_left',
- 'url_key' => 'url-key',
- 'include_in_menu' => 1,
-));
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryCreate((object)array('sessionId' => $sessionId->result, 'parentId' => '5', 'categoryData' => ((object)array(
- 'name' => 'category',
- 'is_active' => '1',
- 'position' => '1',
- 'available_sort_by' => array('position'),
- 'default_sort_by' => 'position',
- 'description' => 'Category description',
- 'is_anchor' => '1',
- 'include_in_menu' => '1'
-))));
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Allows you to set/get the current store view.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -storeView | -Store view ID or code | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -storeView | -Store view ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'category.currentStore', '1');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryCurrentStore($sessionId, '1');
-var_dump($result);
- The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Allows you to delete the required category.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -categoryId | -ID of the category to be deleted | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the category is deleted | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.delete', '7');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryDelete($sessionId, '7');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryDelete((object)array('sessionId' => $sessionId->result, 'categoryId' => '7'));
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Allows you to retrieve information about the required category.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -categoryId | -Category ID | -
| string | -storeView | -Store view ID or code (optional) | -
| ArrayOfString | -attributes | -Array of attributes (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -info | -Array of catalogCategoryInfo | -
The catalogCategoryInfo content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - category_id |
-Category ID | -
| int | - is_active |
-Defines whether the category is active | -
| string |
- position |
-Category position | -
| string |
- level |
-Category level | -
| string |
- parent_id |
-Parent category ID | -
| string |
- all_children |
-All child categories of the current category | -
| string |
- children |
-Names of direct child categories | -
| string |
- created_at |
-Date when the category was created | -
| string |
- updated_at |
-Date when the category was updated | -
| string |
- name |
-Category name | -
| string |
- url_key |
- A relative URL path which can be entered in place of the standard target path (optional) |
-
| string |
- description |
-Category description | -
| string |
- meta_title |
-Category meta title | -
| string |
- meta_keywords |
-Category meta keywords | -
| string |
- meta_description |
-Category meta description | -
| string |
- path |
-Path | -
| string |
- url_path |
-URL path | -
| int | - children_count |
-Number of child categories | -
| string |
- display_mode |
- Content that will be displayed on the category view page (optional) |
-
| int | - is_anchor |
-Defines whether the category is anchored | -
| ArrayOfString | - available_sort_by |
- All available options by which products in the category can be sorted |
-
| string |
- custom_design |
- The custom design for the category (optional) |
-
| string |
- custom_apply_to_products |
- Apply the custom design to all products assigned to the category (optional) |
-
| string |
- custom_design_from |
- Date starting from which the custom design will be applied to the category (optional) |
-
| string |
- custom_design_to |
- Date till which the custom design will be applied to the category (optional) |
-
| string |
- page_layout |
- Type of page layout that the category should use (optional) |
-
| string |
- custom_layout_update |
- Custom layout update (optional) |
-
| string |
- default_sort_by |
- The default option by which products in the category are sorted |
-
| int | - landing_page |
- Landing page (optional) |
-
| int | - include_in_menu |
- Defines whether the category is available on the Magento top menu bar |
-
| string | - filter_price_range |
- Price range of each price level displayed in the layered navigation block |
-
| int | - custom_use_parent_settings |
- Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No |
-
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.info', '5');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryInfo($sessionId, '5');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryInfo((object)array('sessionId' => $sessionId->result, 'categoryId' => '5'));
-var_dump($result->result);
- array - 'category_id' => string '5' (length=1) - 'is_active' => string '1' (length=1) - 'position' => string '1' (length=1) - 'level' => string '2' (length=1) - 'parent_id' => int 3 - 'increment_id' => null - 'created_at' => string '2012-03-29 12:30:51' (length=19) - 'updated_at' => string '2012-03-29 14:25:08' (length=19) - 'name' => string 'Mobile Phones' (length=13) - 'url_key' => string 'mobile-phones' (length=13) - 'thumbnail' => null - 'description' => string 'Category for cell phones' (length=24) - 'image' => null - 'meta_title' => string 'Cell Phones' (length=11) - 'meta_keywords' => string 'cell, phone' (length=11) - 'meta_description' => null - 'include_in_menu' => string '1' (length=1) - 'path' => string '1/3/4' (length=5) - 'all_children' => string '4' (length=1) - 'path_in_store' => null - 'children' => string '' (length=0) - 'url_path' => string 'mobile-phones.html' (length=18) - 'children_count' => string '0' (length=1) - 'display_mode' => string 'PRODUCTS' (length=8) - 'landing_page' => null - 'is_anchor' => string '1' (length=1) - 'available_sort_by' => null - 'default_sort_by' => null - 'filter_price_range' => null - 'custom_use_parent_settings' => string '1' (length=1) - 'custom_apply_to_products' => null - 'custom_design' => null - 'custom_design_from' => null - 'custom_design_to' => null - 'page_layout' => null - 'custom_layout_update' => null-
The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Allows you to retrieve one level of categories by a website, a store view, or a parent category.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -website | -Website ID or code (optional) | -
| string | -storeView | -Store view ID or code (optional) | -
| string | -parentCategory | -Parent category ID (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -tree | -Array of CatalogCategoryEntitiesNoChildren | -
The CatalogCategoryEntitityNoChildren content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - category_id |
-Category ID | -
| int | - parent_id |
-Parent category ID | -
| string | - name |
-Category name | -
| int | - is_active |
-Defines whether the category is active | -
| int | - position |
-Category position | -
| int | - level |
-Category level | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.level');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryLevel($sessionId);
-var_dump($result);
- array - 0 => - array - 'category_id' => string '2' (length=1) - 'parent_id' => int 1 - 'name' => string 'Default Category' (length=16) - 'is_active' => string '1' (length=1) - 'position' => string '1' (length=1) - 'level' => string '1' (length=1) - 1 => - array - 'category_id' => string '3' (length=1) - 'parent_id' => int 1 - 'name' => string 'root_category' (length=13) - 'is_active' => string '1' (length=1) - 'position' => string '2' (length=1) - 'level' => string '1' (length=1)-
The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Allows you to move the required category in the category tree.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -categoryId | -ID of the category to be moved | -
| int | -parentId | -ID of the new parent category | -
| string | -afterId | -ID of the category after which the required category will be moved (optional for V1 and V2) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -id | -True if the category is moved | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.move', array('categoryId' => '4', 'parentId' => '3'));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryMove($sessionId, '4', '3');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryMove((object)array('sessionId' => $sessionId->result, 'categoryId' => '19', 'parentId' => '8', 'afterId' => '4'));
-var_dump($result->result);
- Note: Please make sure that you are not moving the category to any of its own children. There are no extra checks to prevent doing it through API, and you won’t be able to fix this from the admin interface later.
- - - diff --git a/guides/m1x/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html b/guides/m1x/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html deleted file mode 100644 index 4401fee343..0000000000 --- a/guides/m1x/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html +++ /dev/null @@ -1,129 +0,0 @@ ---- -layout: m1x_soap -title: Remove Product ---- - - - -The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Allows you to remove the product assignment from the category.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -categoryId | -Category ID | -
| string | -productId | -ID or SKU of the product to be removed from the category | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the product is removed from the category | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.removeProduct', array('categoryId' => '4', 'product' => '3'));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryRemoveProduct($sessionId, '4', '3');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryRemoveProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '4', 'productId' => '3'));
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Allows you to retrieve the hierarchical tree of categories.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -parentId | -ID of the parent category (optional) | -
| string | -storeView | -Store view (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -tree | -Array of catalogCategoryTree | -
The catalogCategoryTree content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -category_id | -Category ID | -
| int | - parent_id |
-Parent category ID | -
| string | - name |
-Category name | -
| int | - position |
-Category position | -
| int | - level |
-Category level | -
| array | - children |
-Array of CatalogCategoryEntities | -
The catalogCategoryEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - category_id |
-Category ID | -
| int | - parent_id |
-Parent category ID | -
| string | - name |
-Category name | -
| int | - is_active |
-defines whether the category is active | -
| int | - position |
-Category position | -
| int | - level |
-Category level | -
| array | - children |
-Array of CatalogCategoryEntities | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.tree');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryTree($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryTree((object)array('sessionId' => $sessionId->result, 'parentId' => '15'));
-var_dump($result->result);
- array - 'category_id' => string '1' (length=1) - 'parent_id' => string '0' (length=1) - 'name' => string 'Root Catalog' (length=12) - 'is_active' => null - 'position' => string '0' (length=1) - 'level' => string '0' (length=1) - 'children' => - array - 0 => - array - 'category_id' => string '2' (length=1) - 'parent_id' => string '1' (length=1) - 'name' => string 'Default Category' (length=16) - 'is_active' => string '1' (length=1) - 'position' => string '1' (length=1) - 'level' => string '1' (length=1) - 'children' => - array - ... - 1 => - array - 'category_id' => string '3' (length=1) - 'parent_id' => string '1' (length=1) - 'name' => string 'root_category' (length=13) - 'is_active' => string '1' (length=1) - 'position' => string '2' (length=1) - 'level' => string '1' (length=1) - 'children' => - array - ...-
The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Update the required category. Note that you should specify only those parameters which you want to be updated.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -categoryId | -ID of the category to be updated | -
| array | -categoryData | -An array of catalogCategoryEntityCreate | -
| string | -storeView | -Store view ID or code (optional) | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the category is updated | -
The catalogCategoryEntityCreate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -name | - Name of the category to be updated |
-
| int | -is_active | - Defines whether the category is visible in the frontend |
-
| int | -position | - Position of the category to be updated |
-
| arrayOfString |
- available_sort_by |
- All available options by which products in the category can be sorted |
-
| string |
- custom_design |
- The custom design for the category |
-
| int |
- custom_apply_to_products |
- Apply the custom design to all products assigned to the category |
-
| string |
- custom_design_from |
- Date starting from which the custom design will be applied to the category |
-
| string |
- custom_design_to |
- Date till which the custom design will be applied to the category |
-
| string |
- custom_layout_update |
- Custom layout update |
-
| string |
- default_sort_by |
- The default option by which products in the category are sorted |
-
| string |
- description |
- Category description |
-
| string |
- display_mode |
- Content that will be displayed on the category view page |
-
| int |
- is_anchor |
- Defines whether the category will be anchored |
-
| int |
- landing_page |
- Landing page |
-
| string |
- meta_description |
- Category meta description |
-
| string |
- meta_keywords |
- Category meta keywords |
-
| string |
- meta_title |
- Category meta title |
-
| string |
- page_layout |
- Type of page layout that the category should use |
-
| string |
- url_key |
- A relative URL path which can be entered in place of the standard target path |
-
| int |
- include_in_menu |
- Defines whether the category is visible on the top menu bar in the frontend |
-
| string | - filter_price_range |
- Price range of each price level displayed in the layered navigation block |
-
| int | - custom_use_parent_settings |
- Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No |
-
Faults:
-No Faults
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->call($session, 'catalog_category.update', array(23, array(
- 'name' => 'Category name',
- 'is_active' => 1,
- 'position' => 1,
- //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
- //and you can not set position directly, use catalog_category.move instead -->
- 'available_sort_by' => 'position',
- 'custom_design' => null,
- 'custom_apply_to_products' => null,
- 'custom_design_from' => null,
- 'custom_design_to' => null,
- 'custom_layout_update' => null,
- 'default_sort_by' => 'position',
- 'description' => 'Category description',
- 'display_mode' => null,
- 'is_anchor' => 0,
- 'landing_page' => null,
- 'meta_description' => 'Category meta description',
- 'meta_keywords' => 'Category meta keywords',
- 'meta_title' => 'Category meta title',
- 'page_layout' => 'two_columns_left',
- 'url_key' => 'url-key',
- 'include_in_menu' => 1,
-)));
-
-var_dump ($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->catalogCategoryUpdate($session, 23, array(
- 'name' => 'Category name 2',
- 'is_active' => 1,
- 'position' => 1,
- //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
- //and you can not set position directly, use catalog_category.move instead -->
- 'available_sort_by' => array('position'),
- 'custom_design' => null,
- 'custom_apply_to_products' => null,
- 'custom_design_from' => null,
- 'custom_design_to' => null,
- 'custom_layout_update' => null,
- 'default_sort_by' => 'position',
- 'description' => 'Category description',
- 'display_mode' => null,
- 'is_anchor' => 0,
- 'landing_page' => null,
- 'meta_description' => 'Category meta description',
- 'meta_keywords' => 'Category meta keywords',
- 'meta_title' => 'Category meta title',
- 'page_layout' => 'two_columns_left',
- 'url_key' => 'url-key',
- 'include_in_menu' => 1,
-));
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryUpdate((object)array('sessionId' => $sessionId->result, 'categoryId' => '23', 'categoryData' => ((object)array(
- 'name' => 'Category Name Updated',
- 'is_active' => '1',
- 'position' => '1',
- 'available_sort_by' => array('name'),
- 'default_sort_by' => 'name',
- 'description' => 'Category description',
- 'is_anchor' => '1',
- 'include_in_menu' => '1'
-))));
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Aliases:
-Allows you to update the product assigned to a category. The product position is updated.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -categoryId | -ID of the category to which the product is assigned | -
| string | -productId | -ID or SKU of the product to be updated | -
| string | -position | -Position of the product in the category (optional) | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the product is updated in the category | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category.updateProduct', array('categoryId' => '4', 'product' => '1', 'position' => '3'));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryUpdateProduct($sessionId, '4', '1', '3');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogCategoryUpdateProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '4', 'productId' => '1', 'position' => '3'));
-var_dump($result->result);
- Aliases:
-Allows you to set/get the current store view.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -storeView | -Store view ID or code | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -storeView | -Store view ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category_attribute.currentStore', 'english');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryAttributeCurrentStore($sessionId, 'english');
-var_dump($result);
- Aliases:
-Allows you to retrieve the list of category attributes.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogAttributeEntity | -
The catalogAttributeEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - attribute_id |
-Attribute ID | -
| string | - code |
-Attribute code | -
| string |
- type |
-Attribute type | -
| string |
- required |
-Defines whether the attribute is required | -
| string |
- scope |
-Attribute scope: global, website, or store | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category_attribute.list',);
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryAttributeList($sessionId);
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $client->catalogCategoryAttributeList((object)array('sessionId' => $session->result));
-
-var_dump ($result);
- array - 0 => - array - 'attribute_id' => null - 'code' => string 'parent_id' (length=9) - 'type' => null - 'required' => null - 'scope' => string 'global' (length=6) - 1 => - array - 'attribute_id' => null - 'code' => string 'increment_id' (length=12) - 'type' => null - 'required' => null - 'scope' => string 'global' (length=6) - 2 => - array - 'attribute_id' => null - 'code' => string 'updated_at' (length=10) - 'type' => null - 'required' => null - 'scope' => string 'global' (length=6)-
Aliases:
-Allows you to retrieve the attribute options.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -attributeId | -Attribute ID or code | -
| string | -storeView | -Store view ID or code | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogAttributeOptionEntity | -
The catalogAttributeOptionEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -label | -Option label | -
| string | -value | -Option value | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_category_attribute.options', '65');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogCategoryAttributeOptions($sessionId, '65');
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $client->catalogCategoryAttributeOptions((object)array('sessionId' => $session->result, 'attributeId' => '65'));
-
-var_dump ($result);
- array - 0 => - array - 'label' => string 'Yes' (length=3) - 'value' => int 1 - 1 => - array - 'label' => string 'No' (length=2) - 'value' => int 0-
The Mage_Catalog module allows you to manage categories and products.
- -Allows you to retrieve the list of category attributes and options.
- -Resource Name: catalog_category_attribute
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested store view not found. | -
| 101 | -Requested attribute not found. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$attributes = $proxy->call($sessionId, 'category_attribute.list');
-foreach ($attributes as &$attribute) {
- if (isset($attribute['type'])
- && ($attribute['type'] == 'select' || $attribute['type'] == 'multiselect')) {
- $attribute['options'] = $proxy->call($sessionId, 'category_attribute.options', $attribute['code']);
- }
-}
-var_dump($attributes);
- The Mage_Catalog module allows you to manage categories and products.
- -Allows you to manage products.
- -Resource Name: catalog_product
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested store view not found. | -
| 101 | -Product not exists. | -
| 102 | -Invalid data given. Details in error message. | -
| 103 | -Product not deleted. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$filters = array(
- 'sku' => array('like'=>'zol%')
-);
-
-$products = $proxy->call($sessionId, 'product.list', array($filters));
-
-var_dump($products);
- $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$attributeSets = $proxy->call($sessionId, 'product_attribute_set.list');
-$set = current($attributeSets);
-
-
-$newProductData = array(
- 'name' => 'name of product',
- // websites - Array of website ids to which you want to assign a new product
- 'websites' => array(1), // array(1,2,3,...)
- 'short_description' => 'short description',
- 'description' => 'description',
- 'status' => 1,
- 'weight' => 0,
- 'tax_class_id' => 1,
- 'categories' => array(3), //3 is the category id
- 'price' => 12.05
-);
-
-// Create new product
-$proxy->call($sessionId, 'product.create', array('simple', $set['set_id'], 'sku_of_product', $newProductData));
-$proxy->call($sessionId, 'product_stock.update', array('sku_of_product', array('qty'=>50, 'is_in_stock'=>1)));
-
-// Get info of created product
-var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
-
-// Update product name on german store view
-$proxy->call($sessionId, 'product.update', array('sku_of_product', array('name'=>'new name of product'), 'german'));
-
-// Get info for default values
-var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
-// Get info for german store view
-
-var_dump($proxy->call($sessionId, 'product.info', array('sku_of_product', 'german')));
-
-// Delete product
-$proxy->call($sessionId, 'product.delete', 'sku_of_product');
-
-try {
- // Ensure that product deleted
- var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
-} catch (SoapFault $e) {
- echo "Product already deleted";
-}
- Aliases:
-Allows you to create a new product and return ID of the created product.
- -Aliases:
-Note:
-Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- type |
-Product type | -
| string |
- set |
-ID of the product attribute set | -
| string |
- sku |
-Product SKU | -
| array | - productData |
-Array of catalogProductCreateEntity | -
| string | -storeView | -Store view ID or code | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -result | -ID of the created product | -
The catalogProductCreateEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| ArrayOfString | - categories |
-Array of categories | -
| ArrayOfString |
- websites |
-Array of websites | -
| string | - name |
-Product name | -
| string |
- description |
-Product description | -
| string |
- short_description |
-Product short description | -
| string |
- weight |
-Product weight | -
| string |
- status |
-Product status | -
| string |
- url_key |
-URL key | -
| string |
- url_path |
-URL path | -
| string |
- visibility |
-Product visibility on the frontend | -
| ArrayOfString |
- category_ids |
-Array of category IDs | -
| ArrayOfString |
- website_ids |
-Array of website IDs | -
| string |
- has_options |
-Defines whether the product has options | -
| string |
- gift_message_available |
-Defines whether the gift message is available for the product | -
| string |
- price |
-Product price | -
| string |
- special_price |
-Product special price | -
| string |
- special_from_date |
-Date starting from which the special price will be applied to the product | -
| string |
- special_to_date |
-Date till which the special price will be applied to the product | -
| string |
- tax_class_id |
-Tax class ID | -
| array | - tier_price |
-Array of catalogProductTierPriceEntity | -
| string |
- meta_title |
-Meta title | -
| string |
- meta_keyword |
-Meta keyword | -
| string |
- meta_description |
-Meta description | -
| string |
- custom_design |
-Custom design | -
| string |
- custom_layout_update |
-Custom layout update | -
| string |
- options_container |
-Options container | -
| array |
- additional_attributes |
-Array of catalogProductAdditionalAttributesEntity | -
| array | - stock_data |
- Array of catalogInventoryStockItemUpdateEntity |
-
Notes: The "websites" and "website_ids" or "categories" and "category_ids" parameters are interchangeable. In other words, you can specify an array of website IDs (int) and then you don't need to specify the array of website codes (string) and vice versa.
- -The catalogProductTierPriceEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - customer_group_id |
-Customer group ID | -
| string | - website |
-Website | -
| int | - qty |
-Quantity | -
| double | - price |
-Tier price | -
The catalogInventoryStockItemUpdateEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - qty |
-Quantity of items | -
| int | - is_in_stock |
-Defines whether the item is in stock | -
| int |
- manage_stock |
-Manage stock | -
| int |
- use_config_manage_stock |
-Use config manage stock | -
| int |
- min_qty |
-Minimum quantity for items to be in stock | -
| int |
- use_config_min_qty |
-Use config settings flag (value defined in the Inventory System Configuration) | -
| int |
- min_sale_qty |
-Minimum quantity allowed in the shopping cart | -
| int |
- use_config_min_sale_qty |
-Use config settings flag | -
| int |
- max_sale_qty |
-Maximum quantity allowed in the shopping cart | -
| int |
- use_config_max_sale_qty |
-Use config settings flag | -
| int |
- is_qty_decimal |
-Defines whether the quantity is decimal | -
| int |
- backorders |
-Backorders status | -
| int |
- use_config_backorders |
-Use config settings flag (for backorders) | -
| int |
- notify_stock_qty |
-Stock quantity below which a notification will appear | -
| int |
- use_config_notify_stock_qty |
-Use config settings flag (for stock quantity) | -
The catalogProductAdditionalAttributesEntity content is as follows:
- - -| Type | -Name | -
|---|---|
| associativeMultiArray | -multi_data | -
| associativeArray | -single_data | -
Single Data: array of attributes with only single value
-Multi Data: array of attributes which could contain several values
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested store view not found. | -
| 102 | -Invalid data given. Details in error message. | -
| 104 | -Product type is not in allowed types. | -
| 105 | -Product attribute set is not existed | -
| 106 | -Product attribute set is not belong catalog product entity type | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-// get attribute set
-$attributeSets = $client->call($session, 'product_attribute_set.list');
-$attributeSet = current($attributeSets);
-
-
-$result = $client->call($session, 'catalog_product.create', array('simple', $attributeSet['set_id'], 'product_sku', array(
- 'categories' => array(2),
- 'websites' => array(1),
- 'name' => 'Product name',
- 'description' => 'Product description',
- 'short_description' => 'Product short description',
- 'weight' => '10',
- 'status' => '1',
- 'url_key' => 'product-url-key',
- 'url_path' => 'product-url-path',
- 'visibility' => '4',
- 'price' => '100',
- 'tax_class_id' => 1,
- 'meta_title' => 'Product meta title',
- 'meta_keyword' => 'Product meta keyword',
- 'meta_description' => 'Product meta description'
-)));
-
-var_dump ($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-// get attribute set
-$attributeSets = $client->catalogProductAttributeSetList($session);
-$attributeSet = current($attributeSets);
-
-$result = $client->catalogProductCreate($session, 'simple', $attributeSet->set_id, 'product_sku', array(
- 'categories' => array(2),
- 'websites' => array(1),
- 'name' => 'Product name',
- 'description' => 'Product description',
- 'short_description' => 'Product short description',
- 'weight' => '10',
- 'status' => '1',
- 'url_key' => 'product-url-key',
- 'url_path' => 'product-url-path',
- 'visibility' => '4',
- 'price' => '100',
- 'tax_class_id' => 1,
- 'meta_title' => 'Product meta title',
- 'meta_keyword' => 'Product meta keyword',
- 'meta_description' => 'Product meta description'
-));
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCreate((object)array('sessionId' => $sessionId->result, 'type' => 'simple', 'set' => '4', 'sku' => 'simple_sku',
-'productData' => ((object)array(
- 'name' => 'Product name',
- 'description' => 'Product description',
- 'short_description' => 'Product short description',
- 'weight' => '10',
- 'status' => '1',
- 'visibility' => '4',
- 'price' => '100',
- 'tax_class_id' => 1,
-))));
-
-var_dump($result->result);
- Aliases:
-Allows you to set/get the current store view.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -storeView | -Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int/string | -storeView | -Store view ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product.currentStore', 'english');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductCurrentStore($sessionId, 'english');
-var_dump($result);
- Aliases:
-Allows you to delete the required product.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - product\productId |
-Product ID or SKU | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean/int | -result | -True (1) if the product is deleted | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product.delete', '6');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductDelete($sessionId, '6');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductDelete((object)array('sessionId' => $sessionId->result, 'productId' => '21'));
-var_dump($result->result);
- Aliases:
-Allows you to get the product special price data.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string |
- product\productId |
-Product ID or SKU | -
| string |
- storeView |
-Store view ID or code | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductReturnEntity | -
The catalogProductReturnEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string |
- special_price |
-Product special price | -
| string |
- special_from_date |
-Date starting from which the special price is applied to the product | -
| string |
- special_to_date |
-Date till which the special price is applied to the product | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product.getSpecialPrice', '1');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductGetSpecialPrice($sessionId, '1');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductGetSpecialPrice((object)array('sessionId' => $sessionId->result, 'productId' => '1'));
-var_dump($result->result);
- array - 'special_price' => string '139.9900' (length=8) - 'special_from_date' => string '2012-03-28 00:00:00' (length=19) - 'special_to_date' => string '2012-03-31 00:00:00' (length=19)-
Aliases:
-Allows you to retrieve information about the required product.
- -Aliases:
-Arguments:
- -| Type | -Name | - Description |
-
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -productId | -Product ID or SKU | -
| string | -storeView | -Store view ID or code (optional) | -
| array | -attributes | -Array of catalogProductRequestAttributes (optional) | -
| string | -identifierType | -Defines whether the product ID or SKU value is passed in the "productId" parameter. (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -info | -Array of catalogProductReturnEntity | -
The catalogProductRequestAttributes content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| ArrayOfString |
- attributes |
-Array of attributes | -
| ArrayOfString |
- additional_attributes |
-Array of additional attributes | -
The catalogProductReturnEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - product_id |
-Product ID | -
| string |
- sku |
-Product SKU | -
| string |
- set |
-Product set | -
| string |
- type |
-Product type | -
| ArrayOfString | - categories |
-Array of categories | -
| ArrayOfString | - websites |
-Array of websites | -
| string |
- created_at |
-Date when the product was created | -
| string |
- updated_at |
-Date when the product was last updated | -
| string |
- type_id |
-Type ID | -
| string |
- name |
-Product name | -
| string |
- description |
-Product description | -
| string |
- short_description |
-Short description for a product | -
| string |
- weight |
-Product weight | -
| string |
- status |
-Status of a product | -
| string |
- url_key |
-Relative URL path that can be entered in place of a target path | -
| string |
- url_path |
-URL path | -
| string |
- visibility |
-Product visibility on the frontend | -
| ArrayOfString |
- category_ids |
-Array of category IDs | -
| ArrayOfString |
- website_ids |
-Array of website IDs | -
| string |
- has_options |
-Defines whether the product has options | -
| string |
- gift_message_available |
-Defines whether the gift message is available for the product | -
| string |
- price |
-Product price | -
| string |
- special_price |
-Product special price | -
| string |
- special_from_date |
-Date starting from which the special price is applied to the product | -
| string |
- special_to_date |
-Date till which the special price is applied to the product | -
| string |
- tax_class_id |
-Tax class ID | -
| array | - tier_price |
-Array of catalogProductTierPriceEntity | -
| string |
- meta_title |
-Mate title | -
| string |
- meta_keyword |
-Meta keyword | -
| string |
- meta_description |
-Meta description | -
| string |
- custom_design |
-Custom design | -
| string |
- custom_layout_update |
-Custom layout update | -
| string |
- options_container |
-Options container | -
| associativeArray | - additional_attributes |
-Array of additional attributes | -
| string |
- enable_googlecheckout |
-Defines whether Google Checkout is applied to the product | -
The catalogProductTierPriceEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - customer_group_id |
-ID of the customer group | -
| string | - website |
-Website | -
| int | - qty |
-Quantity to which the price will be applied | -
| double | - price |
-Price that each item will cost | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product.info', '4');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductInfo($sessionId, '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductInfo((object)array('sessionId' => $sessionId->result, 'productId' => '4'));
-var_dump($result->result);
- array - 'product_id' => string '4' (length=1) - 'sku' => string 'canon_powershot' (length=15) - 'set' => string '4' (length=1) - 'type' => string 'simple' (length=6) - 'categories' => - array - 0 => string '3' (length=1) - 1 => string '5' (length=1) - 'websites' => - array - 0 => string '2' (length=1) - 'type_id' => string 'simple' (length=6) - 'name' => string 'Canon PowerShot A630 8MP Digital Camera with 4x Optical Zoom' (length=60) - 'description' => string 'Replacing the highly popular PowerShot A620, the PowerShot A630 features a rotating 2.5-inch vari-angle LCD, 4x optical zoom lens, and a vast array of creative shooting modes. - -The PowerShot A630 packs a vast array of advanced features into a remarkably compact space' (length=267) - 'short_description' => string 'Replacing the highly popular PowerShot A620, the PowerShot A630 features a rotating 2.5-inch vari-angle LCD, 4x optical zoom lens, and a vast array of creative shooting modes.' (length=175) - 'weight' => string '1.0000' (length=6) - 'old_id' => null - 'news_from_date' => null - 'news_to_date' => null - 'status' => string '1' (length=1) - 'url_key' => string 'canon-powershot-a630-8mp-digital-camera-with-4x-optical-zoom' (length=60) - 'url_path' => string 'canon-powershot-a630-8mp-digital-camera-with-4x-optical-zoom.html' (length=65) - 'visibility' => string '4' (length=1) - 'category_ids' => - array - 0 => string '3' (length=1) - 1 => string '5' (length=1) - 'required_options' => string '0' (length=1) - 'has_options' => string '0' (length=1) - 'image_label' => null - 'small_image_label' => null - 'thumbnail_label' => null - 'created_at' => string '2012-03-29 12:47:56' (length=19) - 'updated_at' => string '2012-03-29 12:47:56' (length=19) - 'country_of_manufacture' => null - 'price' => string '329.9900' (length=8) - 'group_price' => - array - empty - 'special_price' => null - 'special_from_date' => null - 'special_to_date' => null - 'tier_price' => - array - empty - 'minimal_price' => null - 'msrp_enabled' => string '2' (length=1) - 'msrp_display_actual_price_type' => string '4' (length=1) - 'msrp' => null - 'enable_googlecheckout' => string '1' (length=1) - 'tax_class_id' => string '2' (length=1) - 'meta_title' => null - 'meta_keyword' => null - 'meta_description' => null - 'is_recurring' => string '0' (length=1) - 'recurring_profile' => null - 'custom_design' => null - 'custom_design_from' => null - 'custom_design_to' => null - 'custom_layout_update' => null - 'page_layout' => null - 'options_container' => string 'container2' (length=10) - 'gift_message_available' => null-
Aliases:
-Allows you to retrieve the list of products.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| array | -filters | -Array of filters by attributes (optional) | -
| string | -storeView | -Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -storeView | -Array of catalogProductEntity | -
The catalogProductEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - product_id |
-Product ID | -
| string |
- sku |
-Product SKU | -
| string |
- name |
-Product name | -
| string |
- set |
-Product attribute set | -
| string |
- type |
-Type of the product | -
| ArrayOfString | - category_ids |
-Array of category IDs | -
| ArrayOfString |
-website_ids | -Array of website IDs | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product.list');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductList($sessionId);
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$complexFilter = array(
- 'complex_filter' => array(
- array(
- 'key' => 'type',
- 'value' => array('key' => 'in', 'value' => 'simple,configurable')
- )
- )
-);
-$result = $client->catalogProductList($session, $complexFilter);
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductList((object)array('sessionId' => $sessionId->result, 'filters' => null));
-var_dump($result->result);
- array - 0 => - array - 'product_id' => string '1' (length=1) - 'sku' => string 'n2610' (length=5) - 'name' => string 'Nokia 2610 Phone' (length=16) - 'set' => string '4' (length=1) - 'type' => string 'simple' (length=6) - 'category_ids' => - array - 0 => string '4' (length=1) - 1 => - array - 'product_id' => string '2' (length=1) - 'sku' => string 'b8100' (length=5) - 'name' => string 'BlackBerry 8100 Pearl' (length=21) - 'set' => string '4' (length=1) - 'type' => string 'simple' (length=6) - 'category_ids' => - array - 0 => string '4' (length=1)-
Get the list of additional attributes. Additional attributes are attributes that are not in the default set of attributes.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -productType | -Product type (e.g., simple) | -
| string | -attributeSetId | -Attribute set ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -attribute_id | -Attribute ID | -
| string | -code | -Attribute code | -
| string |
-type | -Attribute type (e.g., text, select, date, etc.) | -
| string |
-required | -Defines whether the attribute is required | -
| string |
-scope | -Attribute scope (global, website, or store) | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 104 | -Product type is not in allowed types. | -
| 105 | -Product attribute set is not existed | -
| 106 | -Product attribute set is not belong catalog product entity type | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$listAttributes = $proxy->call(
- $sessionId,
- 'product.listOfAdditionalAttributes',
- array(
- 'simple',
- 13
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductListOfAdditionalAttributes($sessionId, 'simple', '13');
-var_dump($result);
- array - 0 => - array - 'attribute_id' => string '89' (length=2) - 'code' => string 'old_id' (length=6) - 'type' => string 'text' (length=4) - 'required' => string '0' (length=1) - 'scope' => string 'global' (length=6) - 1 => - array - 'attribute_id' => string '93' (length=2) - 'code' => string 'news_from_date' (length=14) - 'type' => string 'date' (length=4) - 'required' => string '0' (length=1) - 'scope' => string 'website' (length=7) - 2 => - array - ...-
Aliases:
-Allows you to set the product special price.
- -Aliases:
-Note:
-Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- productId |
-Product ID or SKU | -
| string |
- specialPrice |
-Product special price | -
| string |
- fromDate |
-Date starting from which special price will be applied | -
| string |
- toDate |
-Date till which special price will be applied | -
| string |
- storeView |
-Store view ID or code (optional) | -
| string | -productIdentifierType | -Defines whether the product ID or SKU is passed in the 'productId' parameter (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean/int | -result | -True (1) if the special price is set for the product | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product.setSpecialPrice', array('product' => 'testproduct', 'specialPrice' => '77.5', 'fromDate' => '2012-03-29 12:30:51', 'toDate' => '2012-04-29 12:30:51'));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductSetSpecialPrice($sessionId, '2', '77.5', '2012-03-29 12:30:51', '2012-04-29 12:30:51');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductSetSpecialPrice((object)array('sessionId' => $sessionId->result, 'productId' => '2', 'specialPrice' => '77.5', 'fromDate' => '2012-03-29 12:30:51', 'toDate' => '2012-04-29 12:30:51'));
-var_dump($result->result);
- Aliases:
-Allows you to update the required product. Note that you should specify only those parameters which you want to be updated.
- -Aliases:
-Note:
-Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - product\productId |
-Product ID | -
| array | - productData |
-Array of catalogProductCreateEntity | -
| string | - storeView |
-Store view ID or code (optional) | -
| string | - identifierType |
-Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the product is updated | -
The catalogProductCreateEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| ArrayOfString | - categories |
-Array of categories | -
| ArrayOfString |
- websites |
-Array of websites | -
| string | - name |
-Product name | -
| string |
- description |
-Product description | -
| string |
- short_description |
-Product short description | -
| string |
- weight |
-Product weight | -
| string |
- status |
-Product status | -
| string |
- url_key |
-A relative URL path that can be entered in place of the target path | -
| string |
- url_path |
-URL path | -
| string |
- visibility |
-Product visibility on the frontend | -
| ArrayOfString |
- category_ids |
-Array of category IDs | -
| ArrayOfString |
- website_ids |
-Array of website IDs | -
| string |
- has_options |
-Defines whether the product has options | -
| string |
- gift_message_available |
-Defines whether the gift message is available for the product | -
| string |
- price |
-Product price | -
| string |
- special_price |
-Product special price | -
| string |
- special_from_date |
-Date starting from which the special price will be applied to the product | -
| string |
- special_to_date |
-Date till which the special price will be applied to the product | -
| string |
- tax_class_id |
-Tax class ID | -
| array | - tier_price |
-Array of catalogProductTierPriceEntity | -
| string |
- meta_title |
-Meta title | -
| string |
- meta_keyword |
-Meta keyword | -
| string |
- meta_description |
-Meta description | -
| string |
- custom_design |
-Custom design | -
| string |
- custom_layout_update |
-Custom layout update | -
| string |
- options_container |
-Options container | -
| associativeArray |
- additional_attributes |
-Array of catalogProductAdditionalAttributesEntity | -
| array | - stock_data |
- Array of catalogInventoryStockItemUpdateEntity |
-
Notes: The "websites" and "website_ids" or "categories" and "category_ids" parameters are interchangeable. In other words, you can specify an array of website IDs (int) and then you don't need to specify the array of website codes (string) and vice versa.
- -The catalogProductTierPriceEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - customer_group_id |
-Customer group ID | -
| string | - website |
-Website | -
| int | - qty |
-Quantity of items to which the price will be applied | -
| double | - price |
-Price that each item will cost | -
The catalogInventoryStockItemUpdateEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - qty |
-Quantity of items | -
| int | - is_in_stock |
-Defines whether the item is in stock | -
| int |
- manage_stock |
-Manage stock | -
| int |
- use_config_manage_stock |
-Use config manage stock | -
| int |
- min_qty |
-Minimum quantity for items to be in stock | -
| int |
- use_config_min_qty |
-Use config settings flag (value defined in the Inventory System Configuration) | -
| int |
- min_sale_qty |
-Minimum quantity allowed in the shopping cart | -
| int |
- use_config_min_sale_qty |
-Use config settings flag | -
| int |
- max_sale_qty |
-Maximum quantity allowed in the shopping cart | -
| int |
- use_config_max_sale_qty |
-Use config settings flag | -
| int |
- is_qty_decimal |
-Defines whether the quantity is decimal | -
| int |
- backorders |
-Backorders status | -
| int |
- use_config_backorders |
-Use config settings flag (for backorders) | -
| int |
- notify_stock_qty |
-Stock quantity below which a notification will appear | -
| int |
- use_config_notify_stock_qty |
-Use config settings flag (for stock quantity) | -
The catalogProductAdditionalAttributesEntity content is as follows:
- - -| Type | -Name | -
|---|---|
| associativeMultiArray | -multi_data | -
| associativeArray | -single_data | -
Single Data: array of attributes with only single value
-Multi Data: array of attributes which could contain several values
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested store view not found. | -
| 101 | -Product not exists. | -
| 102 | -Invalid data given. Details in error message. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->call($session, 'catalog_product.update', array('product_sku', array(
- 'categories' => array(2),
- 'websites' => array(1),
- 'name' => 'Product name new 2',
- 'description' => 'Product description',
- 'short_description' => 'Product short description',
- 'weight' => '10',
- 'status' => '1',
- 'url_key' => 'product-url-key',
- 'url_path' => 'product-url-path',
- 'visibility' => '4',
- 'price' => '100',
- 'tax_class_id' => 1,
- 'meta_title' => 'Product meta title',
- 'meta_keyword' => 'Product meta keyword',
- 'meta_description' => 'Product meta description'
-)));
-
-var_dump ($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->catalogProductUpdate($session, 'product_sku', array(
- 'categories' => array(2),
- 'websites' => array(1),
- 'name' => 'Product name new',
- 'description' => 'Product description',
- 'short_description' => 'Product short description',
- 'weight' => '10',
- 'status' => '1',
- 'url_key' => 'product-url-key',
- 'url_path' => 'product-url-path',
- 'visibility' => '4',
- 'price' => '100',
- 'tax_class_id' => 1,
- 'meta_title' => 'Product meta title',
- 'meta_keyword' => 'Product meta keyword',
- 'meta_description' => 'Product meta description'
-));
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1',
-'productData' => ((object)array(
- 'name' => 'Product name updated',
- 'status' => '1',
-))));
-
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Allows you to retrieve product attributes and options.
- -Resource Name: catalog_product_attribute
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested store view not found. | -
| 101 | -Requested attribute not found. | -
| 102 | -Invalid request parameters. | -
| 103 | -Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, first character should be a letter. | -
| 104 | -Incorrect attribute type. | -
| 105 | -Unable to save attribute. | -
| 106 | -This attribute cannot be deleted. | -
| 107 | -This attribute cannot be edited. | -
| 108 | -Unable to add option. | -
| 109 | -Unable to remove option. | -
<pre>
-<?php
-$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-echo "<pre>";
-// Create new attribute
-$attributeToCreate = array(
- "attribute_code" => "new_attribute",
- "scope" => "store",
- "frontend_input" => "select",
- "is_unique" => 0,
- "is_required" => 0,
- "is_configurable" => 0,
- "is_searchable" => 0,
- "is_visible_in_advanced_search" => 0,
- "used_in_product_listing" => 0,
- "additional_fields" => array(
- "is_filterable" => 1,
- "is_filterable_in_search" => 1,
- "position" => 1,
- "used_for_sort_by" => 1
- ),
- "frontend_label" => array(
- array(
- "store_id" => 0,
- "label" => "A new attribute"
- )
- )
-);
-
-$attributeId = $proxy->call(
- $sessionId,
- "product_attribute.create",
- array(
- $attributeToCreate
- )
-);
-
-// Update attribute
-$attributeToUpdate = array(
- "scope" => "global",
- "is_unique" => 1,
- "is_required" => 1,
- "is_configurable" => 1,
- "is_searchable" => 1,
- "is_visible_in_advanced_search" => 0,
- "used_in_product_listing" => 0,
- "additional_fields" => array(
- "is_filterable" => 01,
- "is_filterable_in_search" => 0,
- "position" => 2,
- "used_for_sort_by" => 0
- ),
- "frontend_label" => array(
- array(
- "store_id" => 0,
- "label" => "A Test Attribute"
- )
- )
-);
-$proxy->call(
- $sessionId,
- "product_attribute.update",
- array(
- "new_attribute",
- $attributeToUpdate
- )
-);
-
-// Add option
-$optionToAdd = array(
- "label" => array(
- array(
- "store_id" => 0,
- "value" => "New Option"
- )
- ),
- "order" => 0,
- "is_default" => 0
-);
-
-$proxy->call(
- $sessionId,
- "product_attribute.addOption",
- array(
- $attributeId,
- $optionToAdd
- )
-);
-
-// Get info
-$resultInfo = $proxy->call(
- $sessionId,
- "product_attribute.info",
- array(
- $attributeId
- )
-);
-echo "info result:\n";
-print_r($resultInfo);
-
-// List options
-$resultListOptions = $proxy->call(
- $sessionId,
- "product_attribute.options",
- array(
- $attributeId
- )
-);
-echo "\n options result:\n";
-print_r($resultListOptions);
-
-// Remove option
-$result = $proxy->call(
- $sessionId,
- "product_attribute.removeOption",
- array(
- $attributeId,
- $resultInfo['options'][0]['value']
- )
-);
-
-// remove attribute
-$result = $proxy->call(
- $sessionId,
- "product_attribute.remove",
- array(
- $attributeId
- )
-);
- Aliases:
-Allows you to retrieve the product attribute options.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- attributeId |
-Attribute ID or code | -
| string |
- storeView |
-Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogAttributeOptionEntity | -
The catalogAttributeOptionEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -label | -Option label | -
| string | -value | -Option value | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested attribute not found. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$attributeId = 11; // Existing selectable attribute ID
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute.options",
- array(
- $attributeId
- )
-);
-echo "<pre>";
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeOptions($sessionId, '11');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeOptions((object)array('sessionId' => $sessionId->result, 'attributeId' => '11'));
-
-var_dump($result->result);
- array - 1 => - array - 'value' => string '5' (length=1) - 'label' => string 'blue' (length=4) - 2 => - array - 'value' => string '4' (length=1) - 'label' => string 'green' (length=5) - 3 => - array - 'value' => string '3' (length=1) - 'label' => string 'yellow' (length=6)-
Allows you to add a new option for attributes with selectable fields.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - attribute |
-Attribute code or ID | -
| array | -data | -Array of catalogProductAttributeOptionEntityToAdd | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -result | -True on success | -
The catalogProductAttributeOptionEntityToAdd content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -label | -Array of catalogProductAttributeOptionLabel | -
| int | -order | -Option order | -
| int | -is_default | -Defines whether the option is a default one | -
The catalogProductAttributeOptionLabel content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| ArrayOfString | - store_id |
-Array of store view IDs | -
| string | - value |
-Text label | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested attribute not found. | -
| 104 | -Incorrect attribute type. | -
| 108 | -Unable to add option. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$attributeCode = "new_attribute";
-$optionToAdd = array(
- "label" => array(
- array(
- "store_id" => 0,
- "value" => "New Option"
- )
- ),
- "order" => 0,
- "is_default" => 0
-);
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute.addOption",
- array(
- $attributeCode,
- $optionToAdd
- )
-);
- <?php
-$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-//V2
-$session = $client->login('apiUser', 'apiKey');
-
-// V2 WS-I Mode
-//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-//$session = $response->result;
-
-$attributeCode = "new_attribute";
-
-//v2
-
-$label = array (
- array(
- "store_id" => array("0"),
- "value" => "some random data"
- )
- );
-
-$data = array(
- "label" => $label,
- "order" => "10",
- "is_default" => "1"
- );
-
-$orders = $client->catalogProductAttributeAddOption($session, $attributeCode, $data);
-
-
-
-//V2 WSI
-//WSDL WSI does not describe this method
-//$result = $client->catalogProductAttributeAddOption(...);
-//$orders = $result->result->complexObjectArray;
-
-var_dump ($orders);
-?>
- Allows you to create a new product attribute.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| array | -data | -Array of catalogProductAttributeEntityToCreate | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -result | -ID of the created attribute | -
The catalogProductAttributeEntityToCreate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - attribute_code |
-Attribute code | -
| string |
- frontend_input |
- Attribute type |
-
| string |
- scope |
- Attribute scope. Possible values are as follows: 'store', 'website', or 'global' |
-
| string |
- default_value |
-Attribute default value | -
| int | - is_unique |
-Defines whether the attribute is unique | -
| int | - is_required |
- Defines whether the attribute is required |
-
| ArrayOfString | - apply_to |
- Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
-
| int | - is_configurable |
- Defines whether the attribute can be used for configurable products |
-
| int |
- is_searchable |
-Defines whether the attribute can be used in Quick Search | -
| int |
- is_visible_in_advanced_search |
-Defines whether the attribute can be used in Advanced Search | -
| int |
- is_comparable |
-Defines whether the attribute can be compared on the frontend | -
| int |
- is_used_for_promo_rules |
-Defines whether the attribute can be used for promo rules | -
| int |
- is_visible_on_front |
-Defines whether the attribute is visible on the frontend | -
| int |
- used_in_product_listing |
-Defines whether the attribute can be used in product listing | -
| associativeArray | - additional_fields |
-Array of additional fields | -
| array | - frontend_label |
-Array of catalogProductAttributeFrontendLabel | -
The catalogProductAttributeFrontendLabelEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - store_id |
-Store ID | -
| string | - label |
-Text label | -
Notes: The "label" value for the "store_id" value set to 0 must be specified. An attribute cannot be created without specifying the label for store_id=0.
- -The AdditionaFieldsEntity array of additional fields for the text type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -frontend_class | -Input Validation for Store Owner. Possible values are as follows: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | -
| boolean | -is_html_allowed_on_front | -Defines whether the HTML tags are allowed on the frontend | -
| boolean | -used_for_sort_by | -Defines whether it is used for sorting in product listing | -
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_wysiwyg_enabled | -Enable WYSIWYG flag | -
| boolean | -is_html_allowed_on_front | - Defines whether the HTML tags are allowed on the frontend |
-
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -used_for_sort_by | - Defines whether it is used for sorting in product listing |
-
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_filterable | -Defines whether it is used in layered navigation | -
| boolean | -is_filterable_in_search | -Defines whether it is used in search results layered navigation | -
| int | -position | -Position | -
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_filterable | - Defines whether it is used in layered navigation |
-
| boolean | -is_filterable_in_search | - Defines whether it is used in search results layered navigation |
-
| int | -position | -Position | -
| boolean | -used_for_sort_by | - Defines whether it is used for sorting in product listing |
-
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 102 | -Invalid request parameters. | -
| 103 | -Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, first character should be a letter. | -
| 104 | -Incorrect attribute type. | -
| 105 | -Unable to save attribute. | -
<?php
-
-$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$attributeToUpdate = array(
- "scope" => "global",
- "default_value" => "100",
- "frontend_input" => "text",
- "is_unique" => 0,
- "is_required" => 0,
- "is_configurable" => 0,
- "is_searchable" => 0,
- "is_visible_in_advanced_search" => 0,
- "used_in_product_listing" => 0,
- "additional_fields" => array(
- "is_filterable" => 1,
- "is_filterable_in_search" => 1,
- "position" => 1,
- "used_for_sort_by" => 1
- ),
- "frontend_label" => array(
- array(
- "store_id" => 0,
- "label" => "Updated attribute"
- )
- )
-);
-
-
-$attributeCode = 'code1';
-
-$result = $client->call($session, 'product_attribute.update', array($attributeCode, $attributeToUpdate));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
-
-?>
- <?php
-//ini_set("soap.wsdl_cache_enabled", 0);
-
-$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-//V2
-$session = $client->login('apiUser', 'apiKey');
-
-// V2 WS-I Mode
-//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-//$session = $response->result;
-
-
-//v2
-
-$data = array(
- "attribute_code" => "test_attribute",
- "frontend_input" => "text",
- "scope" => "1",
- "default_value" => "1",
- "is_unique" => 0,
- "is_required" => 0,
- "apply_to" => array("simple"),
- "is_configurable" => 0,
- "is_searchable" => 0,
- "is_visible_in_advanced_search" => 0,
- "is_comparable" => 0,
- "is_used_for_promo_rules" => 0,
- "is_visible_on_front" => 0,
- "used_in_product_listing" => 0,
- "additional_fields" => array(),
- "frontend_label" => array(array("store_id" => "0", "label" => "some label"))
- );
-
-$orders = $client->catalogProductAttributeCreate($session, $data);
-
-
-
-//V2 WSI
-//WSDL WSI Sample is not complete
-//$result = $client->catalogProductAttributeCreate(array("sessionId" => $session, "data" => $data));
-//$orders = $result->result->complexObjectArray;
-
-echo 'Number of results: ' . count($orders) . '<br/>';
-var_dump ($orders);
-?>
- Aliases:
-Allows you to set/get the current store view.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string |
- sessionId |
-Session ID | -
| string |
- storeView |
-Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -storeView | -Store view ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_attribute.currentStore', 'english');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeCurrentStore($sessionId, 'english');
-var_dump($result);
- Allows you to get full information about a required attribute with the list of options.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -attribute | -Attribute code or ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductAttributeEntity | -
The catalogProductAttributeEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -attribute_id | -Attribute ID | -
| string |
- attribute_code |
-Attribute code | -
| string |
- frontend_input |
- Attribute type |
-
| string |
- scope |
-Attribute scope | -
| string |
- default_value |
-Attribute default value | -
| int | - is_unique |
-Defines whether the attribute is unique | -
| int | - is_required |
- Defines whether the attribute is required |
-
| ArrayOfString | - apply_to |
- Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
-
| int | - is_configurable |
- Defines whether the attribute can be used for configurable products |
-
| int | - is_searchable |
- Defines whether the attribute can be used in Quick Search |
-
| int | - is_visible_in_advanced_search |
- Defines whether the attribute can be used in Advanced Search |
-
| int | - is_comparable |
- Defines whether the attribute can be compared on the frontend |
-
| int | - is_used_for_promo_rules |
- Defines whether the attribute can be used for promo rules |
-
| int | - is_visible_on_front |
-Defines whether the attribute is visible on the frontend | -
| int | - used_in_product_listing |
- Defines whether the attribute can be used in product listing |
-
| associativeArray |
- additional_fields |
-Array of additional fields | -
| array | - options |
-Array of catalogAttributeOptionEntity | -
| array | - frontend_label |
-Array of catalogProductAttributeFrontendLabel | -
The catalogAttributeOptionEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - label |
-Text label | -
| string | - value |
-Option ID | -
The catalogProductAttributeFrontendLabelEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - store_id |
-Store ID | -
| string | - label |
-Text label | -
The AdditionaFieldsEntity array of additional fields for the text type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -frontend_class | -Input Validation for Store Owner. Possible values: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | -
| boolean | -is_html_allowed_on_front | -Defines whether the HTML tags are allowed on the frontend | -
| boolean | -used_for_sort_by | -Defines whether it is used for sorting in product listing | -
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_wysiwyg_enabled | -Enable WYSIWYG flag | -
| boolean | -is_html_allowed_on_front | - Defines whether the HTML tags are allowed on the frontend |
-
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -used_for_sort_by | - Defines whether it is used for sorting in product listing |
-
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_filterable | -Defines whether it used in layered navigation | -
| boolean | -is_filterable_in_search | -Defines whether it is used in search results layered navigation | -
| int | -position | -Position | -
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_filterable | - Defines whether it used in layered navigation |
-
| boolean | -is_filterable_in_search | - Defines whether it is used in search results layered navigation |
-
| int | -position | -Position | -
| boolean | -used_for_sort_by | - Defines whether it is used for sorting in product listing |
-
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested attribute not found. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'product_attribute.info', '11');
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeInfo($sessionId, '11');
-var_dump($result);
- array - 'attribute_id' => string '11' (length=3) - 'attribute_code' => string 'new_special_price' (length=17) - 'frontend_input' => string 'text' (length=4) - 'default_value' => null - 'is_unique' => string '0' (length=1) - 'is_required' => string '0' (length=1) - 'apply_to' => - array - empty - 'is_configurable' => string '0' (length=1) - 'is_searchable' => string '0' (length=1) - 'is_visible_in_advanced_search' => string '0' (length=1) - 'is_comparable' => string '0' (length=1) - 'is_used_for_promo_rules' => string '0' (length=1) - 'is_visible_on_front' => string '0' (length=1) - 'used_in_product_listing' => string '0' (length=1) - 'frontend_label' => - array - 0 => - array - 'store_id' => int 0 - 'label' => string 'special price' (length=13) - 1 => - array - 'store_id' => int 2 - 'label' => string 'special price' (length=13) - 'scope' => string 'store' (length=5) - 'additional_fields' => - array - 'frontend_class' => null - 'is_html_allowed_on_front' => string '1' (length=1) - 'used_for_sort_by' => string '0' (length=1)-
Aliases:
-Allows you to retrieve the list of product attributes.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| int | - setId |
-ID of the attribute set | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogAttributeEntity | -
The catalogAttributeEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - attribute_id |
-Attribute ID | -
| string | - code |
-Attribute code | -
| string |
- type |
-Attribute type | -
| string |
- required |
-Defines whether the attribute is required | -
| string |
- scope |
-Attribute scope. Possible values: 'store', 'website', or 'global' | -
Faults:
- -No faults
- -$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$setid = 4; // Existing attribute set id
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute.list",
- array(
- $setId
- )
-);
-echo "<pre>";
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeList($sessionId, '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeList((object)array('sessionId' => $sessionId->result, 'setId' => '4'));
-
-var_dump($result->result);
- array - 0 => - array - 'attribute_id' => string '71' (length=2) - 'code' => string 'name' (length=4) - 'type' => string 'text' (length=4) - 'required' => string '1' (length=1) - 'scope' => string 'store' (length=5) - 1 => - array - 'attribute_id' => string '72' (length=2) - 'code' => string 'description' (length=11) - 'type' => string 'textarea' (length=8) - 'required' => string '1' (length=1) - 'scope' => string 'store' (length=5)-
Aliases:
-Allows you to retrieve the product attribute options.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- attributeId |
-Attribute ID or code | -
| string |
- storeView |
-Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogAttributeOptionEntity | -
The catalogAttributeOptionEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -label | -Option label | -
| string | -value | -Option value | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested attribute not found. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$attributeId = 11; // Existing selectable attribute ID
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute.options",
- array(
- $attributeId
- )
-);
-echo "<pre>";
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeOptions($sessionId, '11');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeOptions((object)array('sessionId' => $sessionId->result, 'attributeId' => '11'));
-
-var_dump($result->result);
- array - 1 => - array - 'value' => string '5' (length=1) - 'label' => string 'blue' (length=4) - 2 => - array - 'value' => string '4' (length=1) - 'label' => string 'green' (length=5) - 3 => - array - 'value' => string '3' (length=1) - 'label' => string 'yellow' (length=6)-
Allows you to remove the required attribute from a product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | -attribute | -Attribute code or ID | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the attribute is removed | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested attribute not found. | -
| 106 | -This attribute cannot be deleted. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$attributeCode = "11";
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute.remove",
- array(
- $attributeCode
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeRemove($sessionId, '11');
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $client->catalogProductAttributeRemove((object)array('sessionId' => $session->result, 'attribute' => '11'));
-
-var_dump ($result);
- Allows you to remove the option for an attribute.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | -attribute | -Attribute code or ID | -
| string |
-optionId | -Option ID | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the option is removed | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested attribute not found. | -
| 104 | -Incorrect attribute type. | -
| 109 | -Unable to remove option. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$attributeCode = "2";
-$optionId = 11; // Existing option ID
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute.removeOption",
- array(
- $attributeCode,
- $optionId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeRemoveOption($sessionId, '2', '11');
-var_dump($result);
- Allows you to retrieve the list of possible attribute types.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogAttributeOptionEntity | -
The catalogAttributeOptionEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -label | -Option label | -
| string |
- value |
-Option value | -
Faults:
- -No Faults.
- -$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute.types"
-);
-
-echo "<pre>";
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeTypes($sessionId);
-var_dump($result);
- array - 0 => - 'value' => 'text' - 'label' => 'Text Field' - 1 => - 'value' => 'textarea' - 'label' => 'Text Area' - 2 => - 'value' => 'date' - 'label' => 'Date' - 3 => - 'value' => 'boolean' - 'label' => 'Yes/No' - 4 => - 'value' => 'multiselect' - 'label' => 'Multiple Select' - 5 => - 'value' => 'select' - 'label' => 'Dropdown' - 6 => - 'value' => 'price' - 'label' => 'Price' - 7 => - 'value' => 'media_image' - 'label' => 'Media Image'-
Allows you to update the required attribute.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - attribute |
-Attribute code or ID | -
| array | -data | -Array of catalogProductAttributeEntityToUpdate | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the attribute is updated | -
The catalogProductAttributeEntityToUpdate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - scope |
- Attribute scope. Possible values are as follows: 'store', 'website', or 'global' |
-
| string | - default_value |
-Attribute default value | -
| int | - is_unique |
-Defines whether the attribute is unique | -
| int | - is_required |
-Defines whether the attribute is required | -
| ArrayOfString | - apply_to |
- Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
-
| int | - is_configurable |
-Defines whether the attribute can be used for configurable products | -
| int |
- is_searchable |
- Defines whether the attribute can be used in Quick Search |
-
| int |
- is_visible_in_advanced_search |
- Defines whether the attribute can be used in Advanced Search |
-
| int |
- is_comparable |
- Defines whether the attribute can be compared on the frontend |
-
| int |
- is_used_for_promo_rules |
- Defines whether the attribute can be used for promo rules |
-
| int |
- is_visible_on_front |
- Defines whether the attribute can be visible on the frontend |
-
| int |
- used_in_product_listing |
- Defines whether the attribute can be used in product listing |
-
| associativeArray | - additional_fields |
-Array of additional fields | -
| array | - frontend_label |
-Array of catalogProductAttributeFrontendLabel | -
The AdditionaFieldsEntity array of additional fields for the text type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -frontend_class | -Input Validation for Store Owner. Possible values: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | -
| boolean | -is_html_allowed_on_front | - Defines whether the HTML tags are allowed on the frontend |
-
| boolean | -used_for_sort_by | - Defines whether it is used for sorting in product listing |
-
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_wysiwyg_enabled | -Enable WYSIWYG flag | -
| boolean | -is_html_allowed_on_front | - Defines whether the HTML tags are allowed on the frontend |
-
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -used_for_sort_by | - Defines whether it is used for sorting in product listing |
-
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_filterable | - Defines whether it used in layered navigation |
-
| boolean | -is_filterable_in_search | - Defines whether it is used in search results layered navigation |
-
| integer | -position | -Position | -
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -is_filterable | - Defines whether it used in layered navigation |
-
| boolean | -is_filterable_in_search | - Defines whether it is used in search results layered navigation |
-
| integer | -position | -Position | -
| boolean | -used_for_sort_by | - Defines whether it is used for sorting in product listing |
-
The catalogProductAttributeFrontendLabel content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -store_id | -Store ID | -
| string | -label | -Text label | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested attribute not found. | -
| 105 | -Unable to save attribute. | -
| 107 | -This attribute cannot be edited. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$attributeToUpdate = array(
- "scope" => "global",
- "is_unique" => 1,
- "is_required" => 1,
- "is_configurable" => 1,
- "is_searchable" => 1,
- "is_visible_in_advanced_search" => 0,
- "used_in_product_listing" => 0,
- "additional_fields" => array(
- "is_filterable" => 1,
- "is_filterable_in_search" => 0,
- "position" => 2,
- "used_for_sort_by" => 0
- ),
- "frontend_label" => array(
- array(
- "store_id" => 0,
- "label" => "A Test Attribute"
- )
- )
-);
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute.update",
- array(
- $attributeToUpdate
- )
-);
- <?php
-//ini_set("soap.wsdl_cache_enabled", 0);
-
-$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-//V2
-$session = $client->login('apiUser', 'apiKey');
-
-// V2 WS-I Mode
-//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-//$session = $response->result;
-
-
-//v2
-$attributeCode = "code1";
-$data = array(
- "frontend_input" => "text",
- "scope" => "1",
- "default_value" => "1",
- "is_unique" => 0,
- "is_required" => 0,
- "apply_to" => array("simple"),
- "is_configurable" => 0,
- "is_searchable" => 0,
- "is_visible_in_advanced_search" => 0,
- "is_comparable" => 0,
- "is_used_for_promo_rules" => 0,
- "is_visible_on_front" => 0,
- "used_in_product_listing" => 0,
- "additional_fields" => array(),
- "frontend_label" => array(array("store_id" => "0", "label" => "some random label updated"))
- );
-
-$orders = $client->catalogProductAttributeUpdate($session, $attributeCode, $data);
-
-
-
-//V2 WSI
-//WSDL WSI Sample is not complete
-//$result = $client->catalogProductAttributeCreate(array("sessionId" => $session, "data" => $data));
-//$orders = $result->result->complexObjectArray;
-
-echo 'Number of results: ' . count($orders) . '<br/>';
-var_dump ($orders);
-?>
- Aliases:
-Allows you to upload a new product image.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- product |
-Product ID or code | -
| array | - data |
-Array of catalogProductAttributeMediaCreateEntity | -
| string | - storeView |
-Store view ID or code (optional) | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -result | -Image file name (e.g., "/i/m/image.png") | -
The catalogProductAttributeMediaCreateEntity content is as follows:
- -| Type | -Name | - Description |
-
|---|---|---|
| array | - file |
- Array of catalogProductImageFileEntity |
-
| string | - label |
-Image label | -
| string | - position |
-Image position | -
| ArrayOfString | - types |
-Array of types | -
| string | - exclude |
-Defines whether the image will associate only to one of three image types | -
| string | - remove |
-Remove image flag | -
The catalogProductImageFileEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -content | -Image content (base_64 encoded) | -
| string | -mime | -Image mime type (e.g., image/jpeg) | -
| string | -name | -Image name | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$productId = 2;
-$file = array(
- 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
- 'mime' => 'image/jpeg'
-);
-
-$result = $proxy->call(
- $session,
- 'catalog_product_attribute_media.create',
- array(
- $productId,
- array('file'=>$file, 'label'=>'Label', 'position'=>'100', 'types'=>array('thumbnail'), 'exclude'=>0)
- )
-);
- $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$productId = 2;
-$file = array(
- 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
- 'mime' => 'image/jpeg'
-);
-
-$result = $proxy->catalogProductAttributeMediaCreate(
- $session,
- $productId,
- array('file' => $file, 'label' => 'Label', 'position' => '100', 'types' => array('thumbnail'), 'exclude' => 0)
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeMediaCreate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'data' => ((object)array(
-'label' => 'image_label',
-'position' => '1',
-'types' => array('thumbnail'),
-'exclude' => '0',
-'file' => ((object)array(
-'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
-'mime' => 'image/png',
-'name' => 'image'
-))))));
-
-var_dump($result->result);
- Aliases:
-Allows you to set/get the current store view.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -storeView | -Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -storeView | -Store view ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_attribute_media.currentStore', 'english');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeMediaCurrentStore($sessionId, 'english');
-var_dump($result);
- Aliases:
-Allows you to retrieve information about the specified product image.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- product\productId |
-Product ID or SKU | -
| string |
- file |
-Name of the image file (e.g., /b/l/blackberry8100_2.jpg) | -
| string |
- storeView |
-Store view ID or code (optional) | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductImageEntity | -
The catalogProductImageEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - file |
-Image file name | -
| string |
- label |
-Image file label | -
| string |
- position |
-Image file position | -
| string |
- exclude |
-Defines whether the image will associate only to one of three image types | -
| string |
- url |
-Image URL | -
| ArrayOfString | - types |
-Array of types | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_attribute_media.info', array('product' => '2', 'file' => '/b/l/blackberry8100_2.jpg'));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeMediaInfo($sessionId, '2', '/b/l/blackberry8100_2.jpg');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeMediaInfo((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'file' => '/i/m/image.png'));
-
-var_dump($result->result);
- array - 'file' => string '/b/l/blackberry8100_2.jpg' (length=25) - 'label' => string '' (length=0) - 'position' => string '1' (length=1) - 'exclude' => string '0' (length=1) - 'url' => string 'http://magentohost/media/catalog/product/b/l/blackberry8100_2.jpg' (length=71) - 'types' => - array - 0 => string 'image' (length=5) - 1 => string 'small_image' (length=11) - 2 => string 'thumbnail' (length=9)-
Aliases:
-Allows you to retrieve the list of product images.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- product\productId |
-Product ID or SKU | -
| string |
- storeView |
-Store view ID or code (optional) | -
| string | -identifierType | -Defines whether the product ID or sku is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductImageEntity | -
The catalogProductImageEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - file |
-Image file name | -
| string |
- label |
-Image label | -
| string |
- position |
-Image position | -
| string |
- exclude |
-Defines whether the image will associate only to one of three image types | -
| string |
- url |
-Image URL | -
| ArrayOfString | - types |
-Array of types | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_attribute_media.list', '2');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeMediaList($sessionId, '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeMediaList((object)array('sessionId' => $sessionId->result, 'productId' => '2'));
-
-var_dump($result->result);
- array - 0 => - array - 'file' => string '/b/l/blackberry8100_2.jpg' (length=25) - 'label' => string '' (length=0) - 'position' => string '1' (length=1) - 'exclude' => string '0' (length=1) - 'url' => string 'http://magentopath/blackberry8100_2.jpg' (length=71) - 'types' => - array - 0 => string 'image' (length=5) - 1 => string 'small_image' (length=11) - 2 => string 'thumbnail' (length=9)-
Aliases:
-Allows you to remove the image from a product.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- product\productId |
-Product ID or SKU | -
| string |
- file |
-Image file name (e.g., /b/l/blackberry8100_2.jpg) | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the image is removed from a product | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_attribute_media.remove', array('product' => '3', 'file' => '/b/l/blackberry8100_2.jpg'));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeMediaRemove($sessionId, '3', '/b/l/blackberry8100_2.jpg');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeMediaRemove((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'file' => '/b/l/blackberry8100_2.jpg'));
-
-var_dump($result->result);
- Aliases:
-Allows you to retrieve product image types including standard image, small_image, thumbnail, etc. Note that if the product attribute set contains attributes of the Media Image type (Catalog Input Type for Store Owner > Media Image), it will also be returned in the response.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -setId | -ID of the product attribute set | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductAttributeMediaTypeEntity | -
The catalogProductAttributeMediaTypeEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -code | -Image type code | -
| string | -scope | -Image scope (store, website, or global) | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_attribute_media.types', '4');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeMediaTypes($sessionId, '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeMediaTypes((object)array('sessionId' => $sessionId->result, 'setId' => '4'));
-
-var_dump($result->result);
- array - 0 => - array - 'code' => string 'image' (length=5) - 'scope' => string 'store' (length=5) - 1 => - array - 'code' => string 'small_image' (length=11) - 'scope' => string 'store' (length=5) - 2 => - array - 'code' => string 'thumbnail' (length=9) - 'scope' => string 'store' (length=5)-
Aliases:
-Allows you to update the product image.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string |
- product\productId |
-Product ID or code | -
| string |
- file |
-Image file name (e.g., /i/m/image.jpeg) | -
| array | - data |
-Array of catalogProductAttributeMediaCreateEntity | -
| string |
- storeView |
-Store view ID or code | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Notes: You should specify only those parameters which you want to be updated. Parameters that were not specified in the request, will preserve the previous values.
- -Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -result | -Result of product image updating | -
The catalogProductAttributeMediaCreateEntity content is as follows:
- -| Type | -Name | - Description |
-
|---|---|---|
| array | - file |
- Array of catalogProductImageFileEntity |
-
| string | - label |
-Product image label | -
| string | - position |
-Product image position | -
| ArrayOfString | - types |
-Array of types | -
| string | - exclude |
-Defines whether the image will associate only to one of three image types | -
| string | - remove |
-Image remove flag | -
The catalogProductImageFileEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -content | -Product image content (base_64 encoded) | -
| string | -mime | -Image mime type (e.g., image/jpeg) | -
| string | -name | -Image name | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$productId = 1;
-$file = '/i/m/image.jpg';
-
-$newFile = array(
- 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
- 'mime' => 'image/jpeg'
-);
-
-$result = $client->call(
- $session,
- 'catalog_product_attribute_media.update',
- array(
- $productId,
- $file,
- array('file' => $newFile, 'label' => 'New label', 'position' => '50', 'types' => array('image'), 'exclude' => 1)
- )
-);
- $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$productId = 1;
-$file = '/i/m/image.jpg';
-
-$newFile = array(
-'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
-'mime' => 'image/jpeg'
-);
-
-$result = $client->catalogProductAttributeMediaUpdate(
-$session,
-$productId,
-$file,
-array('file' => $newFile, 'label' => 'New label', 'position' => '50', 'types' => array('image'), 'exclude' => 1)
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeMediaUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'file' => '/t/u/tulips.jpg', 'data' => ((object)array(
-'label' => 'tulips',
-'position' => '1',
-'remove' => '0',
-'types' => array('small_image')
-))));
-
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Allows you to manage product images.
- -Resource Name: catalog_product_attribute_media
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested store view not found. | -
| 101 | -Product not exists. | -
| 102 | -Invalid data given. Details in error message. | -
| 103 | -Requested image not exists in product images’ gallery. | -
| 104 | -Image creation failed. Details in error message. | -
| 105 | -Image not updated. Details in error message. | -
| 106 | -Image not removed. Details in error message. | -
| 107 | -Requested product doesn’t support images | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$newImage = array(
- 'file' => array(
- 'name' => 'file_name',
- 'content' => base64_encode(file_get_contents('product.jpg')),
- 'mime' => 'image/jpeg'
- ),
- 'label' => 'Cool Image Through Soap',
- 'position' => 2,
- 'types' => array('small_image'),
- 'exclude' => 0
-);
-
-$imageFilename = $proxy->call($sessionId, 'product_media.create', array('Sku', $newImage));
-
-
-var_dump($imageFilename);
-
-// Newly created image file
-var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
-
-$proxy->call($sessionId, 'product_media.update', array(
- 'Sku',
- $imageFilename,
- array('position' => 2, 'types' => array('image') /* Lets do it main image for product */)
-));
-
-// Updated image file
-var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
-
-// Remove image file
-$proxy->call($sessionId, 'product_media.remove', array('Sku', $imageFilename));
-
-// Images without our file
-var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
- The Mage_Catalog module allows you to manage categories and products.
- -Allows you to retrieve product attribute sets.
- -Resource Name: catalog_product_attribute_set
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Attribute set with requested id does not exist. | -
| 101 | -Invalid data given. | -
| 102 | -Error while creating attribute set. Details in error message. | -
| 103 | -Error while removing attribute set. Details in error message. | -
| 104 | -Attribute set with requested id does not exist. | -
| 105 | -Unable to remove attribute set as it has related goods. Use forceProductsRemove parameter to remove attribute set with all goods. | -
| 106 | -Attribute with requested id does not exist. | -
| 107 | -Error while adding attribute to attribute set. Details in error message. | -
| 108 | -Attribute group with requested id does not exist. | -
| 109 | -Requested attribute is already in requested attribute set. | -
| 110 | -Error while removing attribute from attribute set. Details in error message. | -
| 111 | -Requested attribute is not in requested attribute set. | -
| 112 | -Requested group exist already in requested attribute set. | -
| 113 | -Error while adding group to attribute set. Details in error message. | -
| 114 | -Error while renaming group. Details in error message. | -
| 115 | -Error while removing group from attribute set. Details in error message. | -
| 116 | -Group can not be removed as it contains system attributes. | -
| 117 | -Group can not be removed as it contains attributes, used in configurable products. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-echo "<pre>";
-// create new set
-$setName = "New Test Set";
-$skeletonId = 4;
-
-$setId = $proxy->call(
- $sessionId,
- "product_attribute_set.create",
- array(
- $setName,
- $skeletonId
- )
-);
-
-// Get list
-$setList = $proxy->call(
- $sessionId,
- "product_attribute_set.list"
-);
-echo "Set list:\n";
-print_r($setList);
-
-// create group
-$groupName = "Test Group";
-$groupId = $proxy->call(
- $sessionId,
- "product_attribute_set.groupAdd",
- array(
- $setId,
- $groupName
- )
-);
-
-// rename group
-$newGroupName = "New Test Group";
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.groupRename",
- array(
- $groupId,
- $newGroupName
- )
-);
-
-// add attribute
-$attributeId = 83;
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.attributeAdd",
- array(
- $attributeId,
- $setId
- )
-);
-
-//remove attribute
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.attributeRemove",
- array(
- $attributeId,
- $setId
- )
-);
-
-// remove group
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.groupRemove",
- array(
- $groupId
- )
-);
-
-// remove set
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.remove",
- array(
- $setId
- )
-);
- Allows you to add an existing attribute to an attribute set.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
-attributeId | -Attribute ID | -
| string |
-attributeSetId | -Attribute set ID | -
| string |
-attributeGroupId | -Group ID (optional) | -
| string |
-sortOrder | -Sort order (optional) | -
Note: If the attributeGroupId parameter is not passed, the attribute is added to the General group by default.
- -Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -isAdded | -True if the attribute is added to an attribute set | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 104 | -Attribute set with requested id does not exist. | -
| 106 | -Attribute with requested id does not exist. | -
| 107 | -Error while adding attribute to attribute set. Details in error message. | -
| 108 | -Attribute group with requested id does not exist. | -
| 109 | -Requested attribute is already in requested attribute set. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$setId = 5;
-$attributeId = 83;
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.attributeAdd",
- array(
- $attributeId,
- $setId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$setId = 5;
-$attributeId = 83;
-
-$result = $proxy->catalogProductAttributeSetAttributeAdd(
- $sessionId,
- $attributeId,
- $setId
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeSetAttributeAdd((object)array('sessionId' => $sessionId->result, 'attributeId' => '5', 'attributeSetId' => '83'));
-var_dump($result->result);
- Allows you to remove an existing attribute from an attribute set.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
-attributeId | -Attribute ID | -
| string |
-attributeSetId | -Attribute set ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -isRemoved | -True if the attribute is removed from an attribute set | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 104 | -Attribute set with requested id does not exist. | -
| 106 | -Attribute with requested id does not exist. | -
| 110 | -Error while removing attribute from attribute set. Details in error message. | -
| 111 | -Requested attribute is not in requested attribute set. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$setId = 5;
-$attributeId = 83;
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.attributeRemove",
- array(
- $attributeId,
- $setId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeSetAttributeRemove($sessionId, '5', '83');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeSetAttributeRemove((object)array('sessionId' => $sessionId->result, 'attributeId' => '5', 'attributeSetId' => '83'));
-var_dump($result->result);
- Allows you to create a new attribute set based on another attribute set.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | -attributeSetName | -Attribute set name | -
| string |
-skeletonSetId | -Attribute set ID basing on which the new attribute set will be created | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -setId | -ID of the created attribute set | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Attribute set with requested id does not exist. | -
| 101 | -Invalid data given. | -
| 102 | -Error while creating attribute set. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$setName = "New Attribute Set";
-$skeletonId = 4;
-
-$newSetId = $proxy->call(
- $sessionId,
- "product_attribute_set.create",
- array(
- $setName,
- $skeletonId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$attributeSetName = 'New Attribute Set';
-$skeletonId = 4;
-
-$result = $client->catalogProductAttributeSetCreate(
- $sessionId,
- $attributeSetName,
- $skeletonId
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeSetCreate((object)array('sessionId' => $sessionId->result, 'attributeSetName' => 'New Attribute Set', 'skeletonSetId' => '4'));
-var_dump($result->result);
- Allows you to add a new group for attributes to the attribute set.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
-attributeSetId | -Attribute set ID | -
| string | -groupName | -Group name | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -result | -ID of the created group | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 112 | -Requested group exist already in requested attribute set. | -
| 113 | -Error while adding group to attribute set. Details in error message. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'product_attribute_set.groupAdd', array('attributeSetId' => '9', 'groupName' => 'new_group'));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeSetGroupAdd($sessionId, '9', 'new_group');
-var_dump($result);
- $proxy = new SoapClient('http://maentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeSetGroupAdd((object)array('sessionId' => $sessionId->result, 'attributeSetId' => '9', 'groupName' => 'new_group'));
-var_dump($result->result);
- Allows you to remove a group from an attribute set.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
-attributeGroupId | -Group ID | -
Return:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the group is removed | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 108 | -Attribute group with requested id does not exist. | -
| 115 | -Error while removing group from attribute set. Details in error message. | -
| 116 | -Group can not be removed as it contains system attributes. | -
| 117 | -Group can not be removed as it contains attributes, used in configurable products. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$groupId = 70;
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.groupRemove",
- array(
- $groupId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeSetGroupRemove($sessionId, '70');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeSetGroupRemove((object)array('sessionId' => $sessionId->result, 'attributeGroupId' => '70'));
-var_dump($result->result);
- Allows you to rename a group in the attribute set.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
-groupId | -ID of the group that will be renamed | -
| string | -groupName | -New name for the group | -
Return:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the group is renamed | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 108 | -Attribute group with requested id does not exist. | -
| 114 | -Error while renaming group. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$groupId = 100;
-$groupName = "New Group";
-
-echo "Renaming group...";
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.groupRename",
- array(
- $groupId,
- $groupName
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeSetGroupRename($sessionId, '100', 'New Group');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeSetGroupRename((object)array('sessionId' => $sessionId->result, 'groupId' => '100', 'groupName' => 'New Group'));
-var_dump($result->result);
- Aliases:
-Allows you to retrieve the list of product attribute sets.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductAttributeSetEntity | -
The catalogProductAttributeSetEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -set_id | -ID of the attribute set | -
| string | -name | -Attribute set name | -
Faults:
- -No faults.
- -$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_attribute_set.list');
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeSetList($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeSetList((object)array('sessionId' => $sessionId->result));
-var_dump($result->result);
- array - 0 => - array - 'set_id' => string '4' (length=1) - 'name' => string 'Default' (length=7) - 1 => - array - 'set_id' => string '9' (length=1) - 'name' => string 'products_set' (length=12)-
Allows you to remove an existing attribute set.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
-attributeSetId | -Attribute set ID | -
| string |
-forceProductsRemove | -Force product remove flag (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean\int | -isRemoved | -True (1) if the attribute set is removed | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 103 | -Error while removing attribute set. Details in error message. | -
| 104 | -Attribute set with requested id does not exist. | -
| 105 | -Unable to remove attribute set as it has related goods. Use forceProductsRemove parameter to remove attribute set with all goods. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$setId = 5;
-
-$result = $proxy->call(
- $sessionId,
- "product_attribute_set.remove",
- array(
- $setId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductAttributeSetRemove($sessionId, '5');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeSetRemove((object)array('sessionId' => $sessionId->result, 'attributeSetId' => '5'));
-var_dump($result->result);
- Aliases: product_custom_option
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Product with requested id does not exist. | -
| 102 | -Provided data is invalid. | -
| 103 | -Error while saving an option. Details are in the error message. | -
| 104 | -Store with requested code/id does not exist. | -
| 105 | -Option with requested id does not exist. | -
| 106 | -Invalid option type provided. Call 'types' to get list of allowed option types. | -
| 107 | -Error while deleting an option. Details are in the error message. | -
Allows you to add a new custom option for a product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string |
-productId | -Product ID | -
| array | -data | -Array of catalogProductCustomOptionToAdd | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the custom option is added | -
The catalogProductCustomOptionToAdd content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Option title | -
| string |
- type |
-Option type | -
| string |
- sort_order |
-Option sort order | -
| int | - is_require |
-Defines whether the option is required | -
| array | - additional_fields |
-Array of catalogProductCustomOptionAdditionalFields | -
The catalogProductCustomOptionAdditionalFieldsEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Custom option title | -
| string |
- price |
-Custom option price | -
| string |
- price_type |
- Price type. Possible values are as follows: "fixed" or "percent" |
-
| string |
- sku |
- Custom option SKU |
-
| string |
- max_characters |
- Maximum number of characters for the customer input on the frontend (optional) |
-
| string |
- sort_order |
-Custom option sort order | -
| string |
- file_extension |
- List of file extensions allowed to upload by the user on the frontend (optional) |
-
| string |
- image_size_x |
- Width limit for uploaded images (optional) |
-
| string |
- image_size_y |
- Height limit for uploaded images (optional) |
-
| string |
- value_id |
-Value ID | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Product with requested id does not exist. | -
| 102 | -Provided data is invalid. | -
| 103 | -Error while saving an option. Details are in the error message. | -
| 104 | -Store with requested code/id does not exist. | -
| 106 | -Invalid option type provided. Call 'types' to get list of allowed option types. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$productId = 1;// Existing product ID
-
-// Add custom option of Text Field type
-$customTextFieldOption = array(
- "title" => "Custom Text Field Option Title",
- "type" => "field",
- "is_require" => 1,
- "sort_order" => 0,
- "additional_fields" => array(
- array(
- "price" => 10.00,
- "price_type" => "fixed",
- "sku" => "custom_text_option_sku",
- "max_characters" => 255
- )
- )
-);
-$resultCustomTextFieldOptionAdd = $proxy->call(
- $sessionId,
- "product_custom_option.add",
- array(
- $productId,
- $customTextFieldOption
- )
-);
-
-// Add custom option of File type
-$customFileOption = array(
- "title" => "Custom File Option Title",
- "type" => "file",
- "is_require" => 1,
- "sort_order" => 5,
- "additional_fields" => array(
- array(
- "price" => 10.00,
- "price_type" => "fixed",
- "sku" => "custom_file_option_sku",
- "file_extension" => "jpg",
- "image_size_x" => 800,
- "image_size_y" => 600
- )
- )
-);
-$resultCustomFileOptionAdd = $proxy->call(
- $sessionId,
- "product_custom_option.add",
- array(
- $productId,
- $customFileOption
- )
-);
-
-// Add custom option of Dropdown type
-$customDropdownOption = array(
- "title" => "Custom Dropdown Option Title",
- "type" => "drop_down",
- "is_require" => 1,
- "sort_order" => 10,
- "additional_fields" => array(
- array(
- "title" => "Dropdown row #1",
- "price" => 10.00,
- "price_type" => "fixed",
- "sku" => "custom_select_option_sku_1",
- "sort_order" => 0
- ),
- array(
- "title" => "Dropdown row #2",
- "price" => 10.00,
- "price_type" => "fixed",
- "sku" => "custom_select_option_sku_2",
- "sort_order" => 5
- )
- )
-);
-$resultCustomDropdownOptionAdd = $proxy->call(
- $sessionId,
- "product_custom_option.add",
- array(
- $productId,
- $customDropdownOption
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->catalogProductCustomOptionAdd($sessionId, '1', array('title' => 'title',
-'type' => 'field',
-'sort_order' => '1',
-'is_require' => 1,
-'additional_fields' => array(array(
-'price' => '15',
-'price_type' => 'fixed',
-'sku' => 'sku',
-'max_characters' => '100'
-))));
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionAdd((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'store' => '1', 'data' => ((object)array(
-'title' => 'title',
-'type' => 'field',
-'sort_order' => '1',
-'is_require' => 1,
-'additional_fields' => array(array(
-'price' => '15',
-'price_type' => 'fixed',
-'sku' => 'sku',
-'max_characters' => '100'
-))))));
-var_dump($result->result);
- Allows you to retrieve full information about the custom option in a product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -optionId | -Option ID | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductCustomOptionInfoEntity | -
The catalogProductCustomOptionInfoEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Custom option title | -
| string |
- type |
- Custom option type. Can have one of the following values: "fixed" or "percent" |
-
| string |
- sort_order |
-Custom option sort order | -
| int | - is_require |
-Defines whether the custom option is required | -
| array | - additional_fields |
-Array of catalogProductCustomOptionAdditionalFields | -
The catalogProductCustomOptionAdditionalFields content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Custom option title | -
| string |
- price |
-Custom option price | -
| string |
- price_type |
- Price type. Possible values are as follows: "fixed" or "percent" |
-
| string |
- sku |
- Custom option SKU |
-
| string |
- max_characters |
- Maximum number of characters for the customer input on the frontend (optional) |
-
| string |
- sort_order |
-Custom option sort order | -
| string |
- file_extension |
- List of file extensions allowed to upload by the user on the frontend (optional; for the File input type) |
-
| string |
- image_size_x |
- Width limit for uploaded images (optional; for the File input type) |
-
| string |
- image_size_y |
- Height limit for uploaded images (optional; for the File input type) |
-
| string |
- value_id |
-Value ID | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Product with requested id does not exist. | -
| 104 | -Store with requested code/id does not exist. | -
| 105 | -Option with requested id does not exist. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'product_custom_option.info', '1');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductCustomOptionInfo($sessionId, '1');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionInfo((object)array('sessionId' => $sessionId->result, 'optionId' => '1'));
-var_dump($result->result);
- array - 'title' => string 'model' (length=5) - 'type' => string 'drop_down' (length=9) - 'is_require' => string '1' (length=1) - 'sort_order' => string '0' (length=1) - 'additional_fields' => - array - 0 => - array - 'value_id' => string '1' (length=1) - 'title' => string 'monoblock' (length=9) - 'price' => string '139.9900' (length=8) - 'price_type' => string 'fixed' (length=5) - 'sku' => string 'monoblock' (length=9) - 'sort_order' => string '0' (length=1) - 1 => - array - 'value_id' => string '2' (length=1) - 'title' => string 'slider' (length=6) - 'price' => string '239.9900' (length=8) - 'price_type' => string 'fixed' (length=5) - 'sku' => string 'slider' (length=6) - 'sort_order' => string '0' (length=1)-
Allows you to retrieve the list of custom options for a specific product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
-productId | -Product ID | -
| string | -store | -Store view ID or code (optional but required for WS-I mode) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | - Array of catalogProductCustomOptionList |
-
The catalogProductCustomOptionList content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -option_id | -Custom option ID | -
| string |
- title |
-Custom option title | -
| string |
- type |
-Custom option type | -
| string |
- sort_order |
-Custom option sort order | -
| int | - is_require |
-Defines whether the custom option is required | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Product with requested id does not exist. | -
| 104 | -Store with requested code/id does not exist. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'product_custom_option.list', '1');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductCustomOptionList($sessionId, '1');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionList((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'store' => '1'));
-var_dump($result->result);
- array - 0 => - array - 'option_id' => string '1' (length=1) - 'title' => string 'model' (length=5) - 'type' => string 'drop_down' (length=9) - 'is_require' => string '1' (length=1) - 'sort_order' => string '0' (length=1)-
Allows you to remove a custom option from the product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | -optionId | -Custom option ID | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the custom option is removed | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 105 | -Option with requested id does not exist. | -
| 107 | -Error while deleting an option. Details are in the error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$optionId = 1;// Existing option ID
-
-$result = $proxy->call(
- $sessionId,
- "product_custom_option.remove",
- array(
- $optionId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductCustomOptionRemove($sessionId, '1');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionRemove((object)array('sessionId' => $sessionId->result, 'optionId' => '1'));
-var_dump($result->result);
- Allows you to retrieve the list of available custom option types.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductCustomOptionTypes | -
The catalogProductCustomOptionTypesEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -label | -Custom option label | -
| string | - value |
-Custom option value | -
Faults:
- -No faults
- -$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'product_custom_option.types');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductCustomOptionTypes($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionTypes((object)array('sessionId' => $sessionId->result));
-var_dump($result->result);
- array - 0 => - array - 'label' => string 'Field' (length=5) - 'value' => string 'field' (length=5) - 1 => - array - 'label' => string 'Area' (length=4) - 'value' => string 'area' (length=4) - 2 => - array - 'label' => string 'File' (length=4) - 'value' => string 'file' (length=4) - 3 => - array - 'label' => string 'Drop-down' (length=9) - 'value' => string 'drop_down' (length=9) - 4 => - array - 'label' => string 'Radio Buttons' (length=13) - 'value' => string 'radio' (length=5) - 5 => - array - 'label' => string 'Checkbox' (length=8) - 'value' => string 'checkbox' (length=8) - 6 => - array - 'label' => string 'Multiple Select' (length=15) - 'value' => string 'multiple' (length=8) - 7 => - array - 'label' => string 'Date' (length=4) - 'value' => string 'date' (length=4) - 8 => - array - 'label' => string 'Date & Time' (length=11) - 'value' => string 'date_time' (length=9) - 9 => - array - 'label' => string 'Time' (length=4) - 'value' => string 'time' (length=4)-
Allows you to update the required product custom option.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -optionId | -Option ID | -
| array | -data | -Array of catalogProductCustomOptionToUpdate | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the custom option is updated | -
The catalogProductCustomOptionToUpdate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Title of the custom option to be updated | -
| string |
- type |
-Custom option type | -
| string |
- sort_order |
-Custom option sort order | -
| int | - is_require |
-Defines whether the custom option is required | -
| array | - additional_fields |
-Array of catalogProductCustomOptionAdditionalFields | -
The catalogProductCustomOptionAdditionalFields content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Custom option title | -
| string |
- price |
-Custom option price | -
| string |
- price_type |
- Price type. Possible values are as follows: "fixed" or "percent" |
-
| string |
- sku |
- Custom option SKU |
-
| string |
- max_characters |
- Maximum number of characters for the customer input on the frontend (optional) |
-
| string |
- sort_order |
-Custom option sort order | -
| string |
- file_extension |
- List of file extensions allowed to upload by the user on the frontend (optional; for the File input type) |
-
| string |
- image_size_x |
- Width limit for uploaded images (optional; for the File input type) |
-
| string |
- image_size_y |
- Height limit for uploaded images (optional; for the File input type) |
-
| string |
- value_id |
-Value ID | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Product with requested id does not exist. | -
| 102 | -Provided data is invalid. | -
| 103 | -Error while saving an option. Details are in the error message. | -
| 104 | -Store with requested code/id does not exist. | -
| 105 | -Option with requested id does not exist. | -
| 106 | -Invalid option type provided. Call 'types' to get list of allowed option types. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$selectOptionId = 1379;
-$selectOptionValueId = 794;
-$textOptionId = 1380;
-$fileOptionId = 1381;
-
-// Update custom option of Text Field type
-$customTextFieldOption = array(
- "title" => "Custom Text Field Option Title Updated",
- "type" => "field",
- "is_require" => 1,
- "sort_order" => 20,
- "additional_fields" => array(
- array(
- "price" => 13.00,
- "price_type" => "fixed",
- "sku" => "custom_text_option_sku_updated",
- "max_characters" => 127
- )
- )
-);
-$resultCustomTextFieldOptionUpdate = $proxy->call(
- $sessionId,
- "product_custom_option.update",
- array(
- $textOptionId,
- $customTextFieldOption
- )
-);
-
-// Update custom option of File type
-$customFileOption = array(
- "title" => "Custom File Option Title Updated",
- "additional_fields" => array(
- array(
- "image_size_x" => 800,
- "image_size_y" => 999
- )
- )
-);
-$resultCustomFileOptionUpdate = $proxy->call(
- $sessionId,
- "product_custom_option.update",
- array(
- $fileOptionId,
- $customFileOption
- )
-);
-
-
-// Update custom option of Dropdown type
-$customDropdownOption = array(
- "title" => "Custom Dropdown Option Title Updated to Multiselect",
- "type" => "multiple",
- "additional_fields" => array(
- array(
- "value_id" => $selectOptionValueId,
- "price" => 14.00,
- "price_type" => 'percent',
- "sku" => "custom_select_option_sku_1 updated",
- "sort_order" => 26
- )
- )
-);
-$resultCustomDropdownOptionUpdate = $proxy->call(
- $sessionId,
- "product_custom_option.update",
- array(
- $selectOptionId,
- $customDropdownOption
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->catalogProductCustomOptionUpdate($sessionId, '1', array(
-'title' => 'title_updated',
-'is_require' => 0,
-'sort_order' => '2'
-));
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionUpdate((object)array('sessionId' => $sessionId->result, 'optionId' => '1', 'data' => ((object)array(
-'title' => 'title_updated',
-'is_require' => 0,
-'sort_order' => '2'
-))));
-var_dump($result->result);
- Aliases: product_custom_option_value
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Option value with requested id does not exist. | -
| 102 | -Error while adding an option value. Details are in the error message. | -
| 103 | -Option with requested id does not exist. | -
| 104 | -Invalid option type. | -
| 105 | -Store with requested code/id does not exist. | -
| 106 | -Can not delete option. | -
| 107 | -Error while updating an option value. Details are in the error message. | -
| 108 | -Title field is required. | -
| 109 | -Option should have at least one value. Can not delete last value. | -
Allows you to add a new custom option value to a custom option. Note that the custom option value can be added only to the option with the Select Input Type.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - optionId |
-Option ID | -
| array | -data | -Array of catalogProductCustomOptionValueAdd | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the custom option value is added | -
The catalogProductCustomOptionValueAdd content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Custom option value title | -
| string |
- price |
-Custom option value price | -
| string |
- price_type |
-Type of the custom option value price. Can have one of the following values: "fixed" or "percent" | -
| string |
- sku |
-Custom option value row SKU | -
| string |
- sort_order |
-Custom option value sort order | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Option value with requested id does not exist. | -
| 102 | -Error while adding an option value. Details are in the error message. | -
| 104 | -Invalid option type. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$productOptionId = 1;// Existing product option ID
-
-// Add custom option value
-$customOptionValue = array(
- "title" => "Some value text 1",
- "price" => 10.00,
- "price_type" => "fixed",
- "sku" => "custom_text_option_sku",
- "sort_order" => 0
-);
-$resultCustomOptionValueAdd = $proxy->call(
- $sessionId,
- "product_custom_option_value.add",
- array(
- $productOptionId,
- array($customOptionValue)
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->catalogProductCustomOptionValueAdd($sessionId, '10', array(array(
-'title' => 'value',
-'price' => '99.99',
-'price_type' => 'fixed',
-'sku' => 'sku',
-'sort_order' => '1'
-)));
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionValueAdd((object)array('sessionId' => $sessionId->result, 'optionId' => '10', 'data' => array(array(
-'title' => 'value',
-'price' => '99.99',
-'price_type' => 'fixed',
-'sku' => 'sku',
-'sort_order' => '1'
-))));
-var_dump($result->result);
- Allows you to retrieve full information about the specified product custom option value.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -valueId | -Value ID | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array |
-result | -Array of catalogProductCustomOptionValueInfoEntity | -
The catalogProductCustomOptionValueInfoEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - value_id |
- Option value ID |
-
| string |
- option_id |
-Option ID | -
| string |
- sku |
- Custom option value row SKU |
-
| string |
- sort_order |
-Option value sort order | -
| string |
- default_price |
- Option value default price |
-
| string |
- default_price_type |
- Default price type. Possible values are as follows: "fixed" or "percent" |
-
| string |
- store_price |
- Option value store price |
-
| string |
- store_price_type |
- Store price type. Possible values are as follows: "fixed" or "percent" |
-
| string |
- price |
-Option value price | -
| string |
- price_type |
-Price type. Possible values are as follows: "fixed" or "percent" | -
| string |
- default_title |
-Option value default title | -
| string |
- store_title |
-Option value store title | -
| string |
- title |
-Option value title | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | - Option value with requested id does not exist. |
-
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'product_custom_option_value.info', '5');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductCustomOptionValueInfo($sessionId, '5');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionValueInfo((object)array('sessionId' => $sessionId->result, 'valueId' => '5'));
-
-var_dump($result->result);
- array - 'option_id' => string '5' (length=1) - 'sku' => string 'slider' (length=6) - 'sort_order' => string '0' (length=1) - 'default_title' => string 'slider' (length=6) - 'store_title' => string 'slider' (length=6) - 'title' => string 'slider' (length=6) - 'default_price' => string '239.9900' (length=8) - 'default_price_type' => string 'fixed' (length=5) - 'store_price' => string '239.9900' (length=8) - 'store_price_type' => string 'fixed' (length=5) - 'price' => string '239.9900' (length=8) - 'price_type' => string 'fixed' (length=5) - 'value_id' => string '2' (length=1)-
Allows you to retrieve the list of product custom option values. Note that the method is available only for the option Select Input Type.
- - -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string |
-optionId | -Option ID | -
| string | -store | -Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array |
-result | -Array of catalogProductCustomOptionValueList | -
The catalogProductCustomOptionValueListEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -value_id | -Custom option value ID | -
| string |
- title |
-Custom option value title | -
| string |
- price |
- Option value price |
-
| string |
- price_type |
- Price type. Possible values: "fixed" or "percent" |
-
| string |
- sku |
- Custom option value SKU |
-
| string |
- sort_order |
- Option value sort order (optional) |
-
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Provided data is invalid. | -
| 102 | -Error while adding an option value. Details are in the error message. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'product_custom_option_value.list', '3');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductCustomOptionValueList($sessionId, '3');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionValueList((object)array('sessionId' => $sessionId->result, 'optionId' => '3'));
-
-var_dump($result->result);
- array - 0 => - array - 'value_id' => string '1' (length=1) - 'title' => string 'monoblock' (length=9) - 'price' => string '139.9900' (length=8) - 'price_type' => string 'fixed' (length=5) - 'sku' => string 'monoblock' (length=9) - 'sort_order' => string '0' (length=1) - 1 => - array - 'value_id' => string '2' (length=1) - 'title' => string 'slider' (length=6) - 'price' => string '239.9900' (length=8) - 'price_type' => string 'fixed' (length=5) - 'sku' => string 'slider' (length=6) - 'sort_order' => string '0' (length=1)-
Allows you to remove the custom option value from a product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
-valueId | -Custom option value ID | -
Return:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the custom option value is removed | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 103 | -Option with requested id does not exist. | -
| 106 | -Can not delete option. | -
| 109 | -Option should have at least one value. Can not delete last value. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$productOptionId = 4;// Existing option ID
-// Get last value from option values list
-$optionValues = $proxy->call($sessionId, "product_custom_option_value.list", array($productOptionId));
-$optionValue = reset($optionValues);
-$valueId = $optionValue['value_id'];
-
-$result = $proxy->call(
- $sessionId,
- "product_custom_option_value.remove",
- array(
- $valueId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductCustomOptionValueRemove($sessionId, '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionValueRemove((object)array('sessionId' => $sessionId->result, 'valueId' => '4'));
-var_dump($result->result);
- Allows you to update the product custom option value.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string |
-valueId | -Value ID | -
| array | -data | -Array of catalogProductCustomOptionValueUpdateEntity | -
| string | -storeId | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the custom option value is updated | -
The catalogProductCustomOptionValueUpdateEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Option value title | -
| string |
- price |
-Option value price | -
| string |
- price_type |
- Price type. Possible values are as follows: "fixed" or "percent" |
-
| string |
- sku |
- Custom option value row SKU |
-
| string |
- sort_order |
-Custom option value sort order | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Option value with requested id does not exist. | -
| 103 | -Option with requested id does not exist. | -
| 104 | -Invalid option type. | -
| 107 | -Error while updating an option value. Details are in the error message. | -
| 108 | -Title field is required. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$productOptionId = 1;// Existing option ID
-
-// Get last value from option values list
-$optionValues = $proxy->call($sessionId, "product_custom_option_value.list", array($productOptionId));
-$optionValue = reset($optionValues);
-$valueId = $optionValue['value_id'];
-// Update custom option value
-$customOptionValue = array(
- "title" => "new title",
- "price" => 12.00,
- "price_type" => "percent",
- "sku" => "custom_text_option_2",
- "sort_order" => 2
-);
-$resultCustomOptionValueUpdate = $proxy->call(
- $sessionId,
- "product_custom_option_value.update",
- array(
- $valueId,
- $customOptionValue
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->catalogProductCustomOptionValueUpdate($sessionId, '2', array(
-'title' => 'value',
-'price' => '20',
-'price_type' => 'fixed',
-'sku' => 'sku'
-));
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductCustomOptionValueUpdate((object)array('sessionId' => $sessionId->result, 'valueId' => '2', 'data' => ((object)array(
-'title' => 'value',
-'sku' => 'sku',
-'price' => '199',
-'price_type' => 'percent'
-))));
-
-var_dump($result->result);
- Allows you to add a new link to a downloadable product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - productId |
-Product ID | -
| array | - resource |
-Array of catalogProductDownloadableLinkAddEntity | -
| string | - resourceType |
-Resource type. Can have one of the following values: "sample" or "link". | -
| string | - store |
-Store view ID or code (optional) | -
| string | - identifierType |
-Type of the product identifier. Can have one of the following values: "sku" or "id". | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -result | -Result of adding a link to the downloadable product | -
The catalogProductDownloadableLinkAddEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Link title | -
| string | - price |
-Custom option value row price | -
| int | - is_unlimited |
-Defines whether the number of downloads is unlimited | -
| int | - number_of_downloads |
-Maximum number of possible downloads | -
| int | - is_shareable |
-Defines whether the link is shareable | -
| array | - sample |
-Array of catalogProductDownloadableLinkAddSampleEntity | -
| string | - type |
-Type of the data source. Can have one of the following values: "file" or "url" | -
| array | - file |
-Array of catalogProductDownloadableLinkFileEntity | -
| string | - link_url |
-Link URL address | -
| string | - sample_url |
-Sample URL address | -
| int | - sort_order |
-Link sort order | -
The catalogProductDownloadableLinkAddSampleEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -type | - Type of the data source. Can have one of the following values: "file" or "url" |
-
| array | - file |
-Array of catalogProductDownloadableLinkFileEntity | -
| string | - url |
-URL to upload | -
The catalogProductDownloadableLinkFileEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - name |
-File name | -
| string | - base64_content |
- BASE64 encoded file |
-
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 414 | - Unable to save action. Details in error message. |
-
| 415 | - Validation error has occurred. |
-
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$filesPath = '/var/www/ws/tests/WebService/etc/Modules/Downloadable/Product/Link';
-$downloadableProductId = 'downloadable_demo_product';
-
-$items = array(
- 'small' => array(
- 'link' => array(
- 'title' => 'Test file',
- 'price' => '123',
- 'is_unlimited' => '1',
- 'number_of_downloads' => '111',
- 'is_shareable' => '0',
- 'sample' => array(
- 'type' => 'file',
- 'file' =>
- array(
- 'filename' => 'files/test.txt',
- ),
- 'url' => 'http://www.magentocommerce.com/img/logo.gif',
- ),
- 'type' => 'file',
- 'file' =>
- array(
- 'filename' => 'files/test.txt',
- ),
- 'link_url' => 'http://www.magentocommerce.com/img/logo.gif',
- ),
- 'sample' => array(
- 'title' => 'Test sample file',
- 'type' => 'file',
- 'file' => array(
- 'filename' => 'files/image.jpg',
- ),
- 'sample_url' => 'http://www.magentocommerce.com/img/logo.gif',
- 'sort_order' => '3',
- )
- ),
- 'big' => array(
- 'link' => array(
- 'title' => 'Test url',
- 'price' => '123',
- 'is_unlimited' => '0',
- 'number_of_downloads' => '111',
- 'is_shareable' => '1',
- 'sample' => array(
- 'type' => 'url',
- 'file' => array(
- 'filename' => 'files/book.pdf',
- ),
- 'url' => 'http://www.magentocommerce.com/img/logo.gif',
- ),
- 'type' => 'url',
- 'file' => array(
- 'filename' => 'files/song.mp3',
- ),
- 'link_url' => 'http://www.magentocommerce.com/img/logo.gif',
- ),
- 'sample' => array(
- 'title' => 'Test sample url',
- 'type' => 'url',
- 'file' => array(
- 'filename' => 'files/image.jpg',
- ),
- 'sample_url' => 'http://www.magentocommerce.com/img/logo.gif',
- 'sort_order' => '3',
- )
- )
-);
-
-$result = true;
-foreach ($items as $item) {
- foreach ($item as $key => $value) {
- if ($value['type'] == 'file') {
- $filePath = $filesPath . '/' . $value['file']['filename'];
- $value['file'] = array('name' => str_replace('/', '_', $value['file']['filename']), 'base64_content' => base64_encode(file_get_contents($filePath)), 'type' => $value['type']);
- }
- if ($value['sample']['type'] == 'file') {
- $filePath = $filesPath . '/' . $value['sample']['file']['filename'];
- $value['sample']['file'] = array('name' => str_replace('/', '_', $value['sample']['file']['filename']), 'base64_content' => base64_encode(file_get_contents($filePath)));
- }
- if (!$proxy->call(
- $sessionId,
- 'product_downloadable_link.add',
- array($downloadableProductId, $value, $key)
- )
- ) {
- $result = false;
- }
- }
-}
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductDownloadableLinkAdd((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'resourceType' => 'link', 'resource' => ((object)array(
-'title' => 'link',
-'price' => '10.99',
-'sample' => array(
-'type' => 'url',
-'url' => 'http://sometesturl.com')
-))));
-
-var_dump($result->result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductDownloadableLinkAdd((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'resourceType' => 'link', 'resource' => ((object)array(
-'title' => 'link_2',
-'price' => '11.99',
-'type' => 'file',
-'file' => array(
-'name' => 'file_test',
-'base64_content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z'
-)
-))));
-
-var_dump($result->result);
- Allows you to retrieve a list of links of a downloadable product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -productId | -Product ID or SKU | -
| string | -store | -Store view ID or code (optional) | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the request | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductDownloadableLinkListEntity | -
The catalogProductDownloadableLinkListEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -links | -Array of catalogProductDownloadableLinkEntity | -
| array | -samples | -Array of catalogProductDownloadableLinkSampleEntity | -
The catalogProductDownloadableLinkEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - link_id |
-Link ID | -
| string | - title |
-Link title | -
| string | - price |
- Downloadable link price value |
-
| int | - number_of_downloads |
-Maximum number of possible downloads | -
| int | - is_unlimited |
-Defines whether the number of downloads is unlimited | -
| int | - is_shareable |
-Defines whether the link is shareable | -
| string | - link_url |
-Link URL address | -
| string | - link_type |
- Type of the link data source. Can have one of the following values: "file" or "url" |
-
| string | - sample_file |
-Sample file name | -
| string | - sample_url |
-Sample URL | -
| string | - sample_type |
- Type of sample data source. Can have one of the following values: "file" or "url" |
-
| int | - sort_order |
-Link sort order | -
| array | - file_save |
-Array of catalogProductDownloadableLinkFileInfoEntity | -
| array | - sample_file_save |
-Array of catalogProductDownloadableLinkFileInfoEntity | -
The catalogProductDownloadableLinkSampleEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sample_id |
-Sample ID | -
| string |
- product_id |
-Product ID | -
| string |
- sample_file |
-Sample file name | -
| string |
- sample_url |
-Sample URL | -
| string |
- sample_type |
-Sample type. Can have one of the following values: "file" or "url" | -
| string |
- sort_order |
-Sort order | -
| string |
- default_title |
-Default title | -
| string |
- store_title |
-Store title | -
| string |
- title |
-Sample title | -
The catalogProductDownloadableLinkFileInfoEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - file |
-File | -
| string | - name |
-File name | -
| int | - size |
-File size | -
| string | - status |
-Status | -
Faults:
-No Faults
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$downloadableProductId = '5';
-
-$resultList = $proxy->call(
- $sessionId,
- 'product_downloadable_link.list',
- array($downloadableProductId)
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductDownloadableLinkList($sessionId, '5', null, 'sku');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductDownloadableLinkList((object)array('sessionId' => $sessionId->result, 'productId' => '5'));
-
-var_dump($result->result);
- array - 'links' => - array - 0 => - array - 'link_id' => string '1' (length=1) - 'title' => string 'link 1' (length=11) - 'price' => string '30.0000' (length=7) - 'number_of_downloads' => string '0' (length=1) - 'is_shareable' => string '1' (length=1) - 'link_url' => null - 'link_type' => string 'file' (length=4) - 'sample_file' => string '/s/o/software.jpg' (length=17) - 'sample_url' => null - 'sample_type' => string 'file' (length=4) - 'sort_order' => string '1' (length=1) - 'file_save' => - array - ... - 'sample_file_save' => - array - ... - 'is_unlimited' => int 1 - 'samples' => - array - 0 => - array - 'sample_id' => string '1' (length=1) - 'product_id' => string '5' (length=1) - 'sample_url' => null - 'sample_file' => string '/s/o/software.jpg' (length=17) - 'sample_type' => string 'file' (length=4) - 'sort_order' => string '2' (length=1) - 'default_title' => string 'Sample 1' (length=8) - 'store_title' => string 'Sample 1' (length=8) - 'title' => string 'Sample 1' (length=8)-
Allows you to remove a link/sample from a downloadable product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -linkId/sampleId | -Link/sample ID | -
| string | -resourceType | -Resource type. Can have one of the following values: 'sample' or 'link' | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the link/sample is removed from a downloadable product | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 412 | - Link or sample with specified ID was not found. |
-
| 415 | - Validation error has occurred. |
-
| 416 | - Unable to remove link. Details in error message. |
-
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$sampleId = 7;
-$linkId = 9;
-
-$resultSample = $proxy->call(
-Â Â $sessionId,
-Â Â 'product_downloadable_link.remove',
-Â Â array($sampleId, 'sample')
-);
-
-$resultLink = $proxy->call(
-Â Â $sessionId,
-Â Â 'product_downloadable_link.remove',
-Â Â array($linkId, 'link')
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductDownloadableLinkRemove($sessionId, '7', 'sample');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductDownloadableLinkRemove((object)array('sessionId' => $sessionId->result, 'linkId' => '7', 'resourceType' => 'sample'));
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Allows you to manage links for products, including related, cross-sells, up-sells, and grouped.
- -Resource Name: catalog_product_link
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Given invalid link type. | -
| 101 | -Product not exists. | -
| 102 | -Invalid data given. Details in error message. | -
| 104 | -Product link not removed. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-// Get list of related products
-var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
-
-// Assign related product
-$proxy->call($sessionId, 'product_link.assign', array('related', 'Sku', 'Sku2', array('position'=>0, 'qty'=>56)));
-
-var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
-
-// Update related product
-$proxy->call($sessionId, 'product_link.update', array('related', 'Sku', 'Sku2', array('position'=>2)));
-
-var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
-
-// Remove related product
-$proxy->call($sessionId, 'product_link.remove', array('related', 'Sku', 'Sku2'));
-
-var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
- Aliases:
-Allows you to assign a product link (cross_sell, grouped, related, or up_sell) to another product.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string |
- type |
-Type of the link (cross_sell, grouped, related, or up_sell) | -
| string |
- product\productId |
-Product ID or SKU | -
| string |
- linkedProduct\linkedProductId |
-Product ID or SKU for the link | -
| array | - data |
-Array of catalogProductLinkEntity | -
| string |
- identifierType |
-Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the link is assigned to the product | -
The catalogProductLinkEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - product_id |
-Product ID | -
| string |
- type |
-Type of the link (cross_sell, grouped, related, or up_sell) | -
| string |
- set |
-Product attribute set | -
| string |
- sku |
-Product SKU | -
| string |
- position |
-Position of the product | -
| string |
- qty |
-Quantity of products | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apikey');
-
-$result = $client->call($session, 'catalog_product_link.assign', array('type' => 'related', 'product' => '1', 'linkedProduct' => '4'));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductLinkAssign($sessionId, 'related', '1', '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductLinkAssign((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1', 'linkedProductId' => '4'));
-
-var_dump($result->result);
- Aliases:
-Allows you to retrieve the product link type attributes.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - type |
-Type of the link (cross_sell, up_sell, related, or grouped) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductLinkAttributeEntity | -
The catalogProductLinkAttributeEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -code | -Attribute code | -
| string | -type | -Attribute type | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_link.attributes', 'related');
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductLinkAttributes($sessionId, 'related');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductLinkAttributes((object)array('sessionId' => $sessionId->result, 'type' => 'related'));
-
-var_dump($result->result);
- array - 0 => - array - 'code' => string 'position' (length=8) - 'type' => string 'int' (length=3)-
Aliases:
-Allows you to retrieve the list of linked products for a specific product.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - type |
-Type of the link (cross_sell, up_sell, related, or grouped) | -
| string | - product\productId |
-Product ID or SKU | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductLinkEntity | -
The catalogProductLinkEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - product_id |
-Product ID | -
| string |
- type |
-Type of the link | -
| string |
- set |
-Product attribute set | -
| string |
- sku |
-Product SKU | -
| string |
- position |
-Position | -
| string |
- qty |
-Quantity | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_link.list', array('type' => 'related', 'product' => '1'));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductLinkList($sessionId, 'related', '1');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductLinkList((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1'));
-
-var_dump($result->result);
- array - 0 => - array - 'product_id' => string '3' (length=1) - 'type' => string 'simple' (length=6) - 'set' => string '4' (length=1) - 'sku' => string 'canonxt' (length=7) - 'position' => string '1' (length=1) - 1 => - array - 'product_id' => string '4' (length=1) - 'type' => string 'simple' (length=6) - 'set' => string '4' (length=1) - 'sku' => string 'canon_powershot' (length=15) - 'position' => string '0' (length=1)-
Aliases:
-Allows you to remove the product link from a specific product.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- type |
-Type of the link (cross_sell, up_sell, related, or grouped) | -
| string |
- product\productId |
-Product ID or SKU | -
| string |
- linkedProduct\linkedProductId |
-Product ID or SKU for the link | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the link is removed from a product | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_link.remove', array('type' => 'related', 'product' => '1', 'linkedProduct' => '4'));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductLinkRemove($sessionId, 'related', '1', '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductLinkRemove((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1', 'linkedProductId' => '4'));
-
-var_dump($result->result);
- Aliases:
-Allows you to retrieve the list of product link types.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| ArrayOfString | -result | -Array of link types | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'product_link.types');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductLinkTypes($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductLinkTypes((object)array('sessionId' => $sessionId->result));
-
-var_dump($result->result);
- array - 0 => string 'related' (length=7) - 1 => string 'up_sell' (length=7) - 2 => string 'cross_sell' (length=10) - 3 => string 'grouped' (length=7)-
Aliases:
-Allows you to update the product link.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string |
- type |
-Type of the link (cross_sell, grouped, related, or up_sell) | -
| string |
- product\productId |
-Product ID or SKU | -
| string |
- linkedProduct\linkedProductId |
-Product ID or SKU for the link | -
| array | - data |
-Array of catalogProductLinkEntity | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean\int | -result | -True (1) if the link is updated | -
The catalogProductLinkEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - product_id |
-Product ID | -
| string |
- type |
-Type of the link | -
| string |
- set |
-Product attribute set | -
| string |
- sku |
-Product SKU | -
| string |
- position |
-Position | -
| string |
- qty |
-Quantity | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$productId = '1';
-$linkedProductId = '2';
-$data = array(
- 'position' => '50'
-);
-
-$result = $proxy->call(
- $session,
- 'catalog_product_link.update',
- array(
- 'cross_sell',
- $productId,
- $linkedProductId,
- $data
- )
-);
- <?php
-
-$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$session = $client->login('apiUser', 'apiKey');
-
-$data = array(
- "position" => 15
- );
-
-$identifierType = "product_id";
-$type = "related";
-$product = "1";
-$linkedProduct = "3";
-
-$orders = $client->catalogProductLinkUpdate($session, $type, $product, $linkedProduct, $data, $identifierType);
-
-echo 'Number of results: ' . count($orders) . '<br/>';
-var_dump ($orders);
-?>
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductLinkUpdate((object)array('sessionId' => $sessionId->result, 'type' => 'cross_sell', 'productId' => '1', 'linkedProductId' => '2', 'data' => ((object)array(
-'position' => '1'
-))));
-
-var_dump($result->result);
- Allows you to operate with product tags.
- - -Aliases: product_tag
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested store does not exist. | -
| 102 | -Requested product does not exist. | -
| 103 | -Requested customer does not exist. | -
| 104 | -Requested tag does not exist. | -
| 105 | -Provided data is invalid. | -
| 106 | -Error while saving tag. Details in error message. | -
| 107 | -Error while removing tag. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$productId = 2;
-$customerId = 10002;
-$store = 'default';
-
-// Add tags
-$data = array('product_id' => $productId, 'store' => $store, 'customer_id' => $customerId, 'tag' => "First 'Second tag' Third");
-echo "Adding Tag... ";
-$addResult = $proxy->call(
- $sessionId,
- "product_tag.add",
- array($data)
-);
-echo ((count($addResult) == 3) ? "Done!" : "Fail!");
-echo "<br />";
-print_r($addResult);
-$tagId = reset($addResult);
-
-// Get tag info
-echo "<br />Get Tag Info (id = $tagId)... ";
-$infoResult = $proxy->call(
- $sessionId,
- "product_tag.info",
- array($tagId, $store)
-);
-echo "Done!<br />";
-print_r($infoResult);
-
-// Update tag data
-$data = array('status' => -1, 'base_popularity' => 12, 'name' => 'Changed name');
-echo "<br />Update Tag (id = $tagId)... ";
-$updateResult = $proxy->call(
- $sessionId,
- "product_tag.update",
- array($tagId, $data, $store)
-);
-echo ($updateResult ? "Done!" : "Fail!");
-
-// Retrieve list of tags by product
-echo "<br />Tag list for product with id = $productId... ";
-$listResult = $proxy->call(
- $sessionId,
- "product_tag.list",
- array($productId, $store)
-);
-echo (count($listResult) ? "Done!" : "Fail!");
-echo "<br />";
-print_r($listResult);
-
-// Remove existing tag
-echo "<br />Remove Tag (id = $tagId)... ";
-$removeResult = $proxy->call(
- $sessionId,
- "product_tag.remove",
- array($tagId)
-);
-echo ($removeResult ? "Done!" : "Fail!");
- Aliases: product_tag
- - -Allows you to add one or more tags to a product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| array | -data | -Array of catalogProductTagAddEntity | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Associative array of added tags with the tag name as a key and the tag ID as a value | -
The catalogProductTagAddEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - tag |
- Tag to be added (can contain several tags separated with white spaces). A tag that contains several words should be enclosed in single quotes. |
-
| string |
- product_id |
-Product ID | -
| string |
- customer_id |
-Customer ID | -
| string |
- store |
-Store ID | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested store does not exist. | -
| 102 | -Requested product does not exist. | -
| 103 | -Requested customer does not exist. | -
| 105 | -Provided data is invalid. | -
| 106 | -Error while saving tag. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$data = array('product_id' => 2, 'store' => 'default', 'customer_id' => 10002, 'tag' => "First 'Second tag' Third");
-echo "Adding Tag... ";
-$addResult = $proxy->call(
- $sessionId,
- "product_tag.add",
- array($data)
-);
-echo ((count($addResult) == 3) ? "Done!" : "Fail!");
-echo "<br />";
-print_r($addResult);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->catalogProductTagAdd($sessionId, array(
-'tag' => 'album',
-'product_id' => '3',
-'customer_id' => '1',
-'store' => '0'
-));
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductTagAdd((object)array('sessionId' => $sessionId->result, 'data' => ((object)array(
-'tag' => 'album',
-'product_id' => '3',
-'customer_id' => '1',
-'store' => '0'
-))));
-var_dump($result->result);
- Aliases: product_tag
- - -Allows you to retrieve information about the required product tag.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -tagId | -Tag ID | -
| string | -store | -Store view code or ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductTagInfoEntity | -
The catalogProductTagInfoEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -name | -Tag name | -
| string | -status | -Tag status | -
| string | -base_popularity | -Tag base popularity for a specific store | -
| associativeArray | -products | -Associative array of tagged products with related product ID as a key and popularity as a value | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested store does not exist. | -
| 104 | -Requested tag does not exist. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_tag.info', array('tagId' => '4', 'store' => '2'));
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductTagInfo($sessionId, '4', '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductTagInfo((object)array('sessionId' => $sessionId->result, 'tagId' => '4', 'store' => '2'));
-var_dump($result->result);
- array - 'status' => string '1' (length=1) - 'name' => string 'digital' (length=7) - 'base_popularity' => int 0 - 'products' => - array - 1 => string '1' (length=1) - 3 => string '1' (length=1) - 4 => string '1' (length=1)-
Aliases: product_tag
- - -Allows you to retrieve the list of tags for a specific product.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -productId | -Product ID | -
| string | -store | -Store view code or ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductTagListEntity | -
The catalogProductTagListEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - tag_id |
-Tag ID | -
| string | - name |
-Tag name | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested store does not exist. | -
| 102 | -Requested product does not exist. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_tag.list', array('productId' => '4', 'store' => '2'));
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductTagList($sessionId, '4', '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductTagList((object)array('sessionId' => $sessionId->result, 'productId' => '4', 'store' => '2'));
-var_dump($result->result);
- array - 3 => - array - 'tag_id' => string '3' (length=1) - 'name' => string 'canon' (length=5) - 4 => - array - 'tag_id' => string '4' (length=1) - 'name' => string 'digital' (length=7)-
Aliases: product_tag
- - -Allows you to remove an existing product tag.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -tagId | -Tag ID | -
Return:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the product tag is removed | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 104 | -Requested tag does not exist. | -
| 107 | -Error while removing tag. Details in error message. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_tag.remove', '3');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductTagRemove($sessionId, '3');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductTagRemove((object)array('sessionId' => $sessionId->result, 'tagId' => '3'));
-var_dump($result->result);
- Aliases: product_tag
- - -Allows you to update information about an existing product tag.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -tagId | -ID of the tag to be updated | -
| array | -data | -Array of catalogProductTagUpdateEntity | -
| string | -store | -Store view code or ID (optional; required for WS-I compliance mode) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the product tag is updated | -
The catalogProductTagUpdateEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - name |
-Tag name | -
| string |
- status |
-Tag status. Can have the following values: -1 - Disabled, 0 - Pending, 1- Approved | -
| string |
- base_popularity |
-Tag base popularity | -
Faults:
- -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested store does not exist. | -
| 104 | -Requested tag does not exist. | -
| 105 | -Provided data is invalid. | -
| 106 | -Error while saving tag. Details in error message. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_tag.update', array('tagId' => '4', 'data' => array('name' => 'digital_1')));
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
-
-$sessionId = $proxy->login('apiUser', 'apiKey');Â
-Â
-$result = $proxy->catalogProductTagUpdate($sessionId, '1', array(
-'name' => 'tag',
-'status' => '1'
-)); Â Â
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductTagUpdate((object)array('sessionId' => $sessionId->result, 'tagId' => '1', 'store' => '0', 'data' => ((object)array(
-'name' => 'tag',
-'status' => '1',
-'base_popularity' => null
-))));
-var_dump($result->result);
- The Mage_Catalog module allows you to manage categories and products.
- -Allows you to retrieve and update product tier prices.
- -Resource Name: catalog_product_attribute_tier_price
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Product not exists. | -
| 101 | -Invalid data given. Details in error message. | -
| 102 | -Tier prices not updated. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-// Get tier prices
-$tierPrices = $proxy->call($sessionId, 'product_tier_price.info', 'Sku');
-
-var_dump($tierPrices);
-
-// Add new
-$tierPrices[] = array(
- 'website' => 'all',
- 'customer_group_id' => 'all',
- 'qty' => 68,
- 'price' => 18.20
-);
-
-// Update tier prices
-$proxy->call($sessionId, 'product_tier_price.update', array('Sku', $tierPrices));
-
-// Compare values
-var_dump($proxy->call($sessionId, 'product_tier_price.info', 'Sku'));
-
-var_dump($tierPrices);
- Aliases:
-Allows you to retrieve information about product tier prices.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - product\productId |
-Product ID or SKU | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductTierPriceEntity | -
The catalogProductTierPriceEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - customer_group_id |
-Customer group ID | -
| string | - website |
-Website | -
| int | - qty |
-Quantity of items to which the price will be applied | -
| double | - price |
-Price that each item will cost | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_attribute_tier_price.info', 'productId');
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$productId = 1;
-
-$result = $client->catalogProductAttributeTierPriceInfo(
- $session,
- $productId
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductAttributeTierPriceInfo((object)array('sessionId' => $sessionId->result, 'productId' => '1'));
-
-var_dump($result->result);
- array - 0 => - array - 'customer_group_id' => string '1' (length=1) - 'website' => string 'all' (length=3) - 'qty' => string '2.0000' (length=6) - 'price' => string '129.9900' (length=8)-
array - 0 => - object(stdClass)[2] - public 'customer_group_id' => string '0' (length=1) - public 'website' => string 'all' (length=3) - public 'qty' => int 5 - public 'price' => float 99 - 1 => - object(stdClass)[3] - public 'customer_group_id' => string '0' (length=1) - public 'website' => string 'all' (length=3) - public 'qty' => int 10 - public 'price' => float 98-
Aliases:
-Allows you to update the product tier prices.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - product\productId |
-Product ID or SKU | -
| array | - tierPrices |
-Array of catalogProductTierPriceEntity | -
| string | -identifierType | -Defines whether the product ID or SKU is passed in the 'product' parameter | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean\int | -result | -True (1) if the product tier price is updated | -
The catalogProductTierPriceEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - customer_group_id |
-Customer group ID | -
| string | - website |
-Website | -
| int | - qty |
-Quantity of items to which the price will be applied | -
| double | - price |
-Price that each item will cost | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$productId = 1;
-$tierPrices = array(
- array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
-);
-
-$result = $proxy->call(
- $sessionId,
- 'product_attribute_tier_price.update',
- array(
- $productId,
- $tierPrices
- )
-);
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-
-$productId = 1;
-$tierPrices = array(
- array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
-);
-
-$result = $proxy->catalogProductAttributeTierPriceUpdate(
- $sessionId,
- $productId,
- $tierPrices
-);
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-
-$productId = 1;
-$tierPrices = array(
- array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
-);
-
-$result = $proxy->catalogProductAttributeTierPriceUpdate((object)array(
-'sessionId' => $sessionId->result,
-'productId' => $productId,
-'tierPrices' => $tierPrices
-));
-
-var_dump($result->result);
- Aliases:
-Allows you to retrieve the list of product types.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogProductTypeEntity | -
The catalogProductTypeEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -type | -Product type | -
| string | -label | -Product label in the Admin Panel | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'catalog_product_type.list');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogProductTypeList($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogProductTypeList((object)array('sessionId' => $sessionId->result));
-var_dump($result->result);
- array - 0 => - array - 'type' => string 'simple' (length=6) - 'label' => string 'Simple Product' (length=14) - 1 => - array - 'type' => string 'grouped' (length=7) - 'label' => string 'Grouped Product' (length=15) - 2 => - array - 'type' => string 'configurable' (length=12) - 'label' => string 'Configurable Product' (length=20) - 3 => - array - 'type' => string 'virtual' (length=7) - 'label' => string 'Virtual Product' (length=15) - 4 => - array - 'type' => string 'bundle' (length=6) - 'label' => string 'Bundle Product' (length=14) - 5 => - array - 'type' => string 'downloadable' (length=12) - 'label' => string 'Downloadable Product' (length=20)-
The Mage_Catalog module allows you to manage categories and products.
- -Allows you to retrieve product types.
- -Resource Name: catalog_product_type
- -Aliases:
-Methods:
-$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$types = $proxy->call($sessionId, 'product_type.list');
-
-var_dump($types);
- The Mage_CatalogInventory module allows you to retrieve and update stock attributes, such as status and quantity.
- -Allows you to retrieve and update the stock data.
- -Resource Name: cataloginventory_stock_item
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 101 | -Product not exists. | -
| 102 | -Product inventory not updated. Details in error message. | -
Change manage_stock setting to ‘off’ in the inventory area.
- -$attributeSets = $client->call($session, ‘product_stock.update’, array(’SKU’,array(’manage_stock’=>'0’,’use_config_manage_stock’=>'0’)));
- -The use_config_manage_stock unchecks the ‘Use Config Settings’ box which allows you to make changes to this product and not to use the global settings that are set by default.
- -$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-// Get stock info
-var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
-
-// Update stock info
-$proxy->call($sessionId, 'product_stock.update', array('Sku', array('qty'=>50, 'is_in_stock'=>1)));
-
-var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
- $client = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sid = $client->login('apiUser', 'apiKey');
-
-print_r(
- $client->call(
- $sid,
- 'product_stock.list',
- array(
- array( // Notice the nested array
- 'sku1',
- 'sku2',
- 'sku3',
- ...
- 'skuN'
- )
- )
- )
-);
- Aliases:
-Allows you to retrieve the list of stock data by product IDs.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| ArrayOfString |
- products/productIds (for WS-I mode) |
-List of product IDs or SKUs | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of catalogInventoryStockItemEntity | -
The catalogInventoryStockItemEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - product_id |
-Product ID | -
| string | - sku |
-Product SKU | -
| string | - qty |
-Product quantity | -
| string | - is_in_stock |
-Defines whether the product is in stock | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'cataloginventory_stock_item.list', '1');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->catalogInventoryStockItemList($sessionId, array('1', '2'));
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogInventoryStockItemList((object)array('sessionId' => $sessionId->result, 'productIds' => array(1,2)));
-var_dump($result->result);
- array - 0 => - array - 'product_id' => string '1' (length=1) - 'sku' => string 'n2610' (length=5) - 'qty' => string '98.0000' (length=7) - 'is_in_stock' => string '1' (length=1)-
Aliases:
-Allows you to update the required product stock data.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - product\productId |
-Product ID or SKU | -
| array | - data |
-Array of catalogInventoryStockItemUpdateEntity | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -result | -Result of stock item updating | -
The catalogInventoryStockItemUpdateEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - qty |
-Quantity of items to be updated | -
| int | - is_in_stock |
-Defines whether the item is in stock | -
| int |
- manage_stock |
-Manage stock flag | -
| int |
- use_config_manage_stock |
-Use config manage stock | -
| int |
- min_qty |
-Minimum quantity for items to be in stock | -
| int |
- use_config_min_qty |
-Use config settings flag (value defined in the Inventory System Configuration) | -
| int |
- min_sale_qty |
-Minimum quantity allowed in the shopping cart | -
| int |
- use_config_min_sale_qty |
-Use config settings flag | -
| int |
- max_sale_qty |
-Maximum quantity allowed in the shopping cart | -
| int |
- use_config_max_sale_qty |
-Use config settings flag | -
| int |
- is_qty_decimal |
-Defines whether the quantity is decimal | -
| int |
- backorders |
-Backorders status | -
| int |
- use_config_backorders |
-Use config settings flag (for backorders) | -
| int |
- notify_stock_qty |
-Stock quantity below which a notification will appear | -
| int |
- use_config_notify_stock_qty |
-Use config settings flag (for stock quantity) | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$productId = '1';
-$stockItemData = array(
- 'qty' => '100',
- 'is_in_stock ' => 1,
- 'manage_stock ' => 1,
- 'use_config_manage_stock' => 0,
- 'min_qty' => 2,
- 'use_config_min_qty ' => 0,
- 'min_sale_qty' => 1,
- 'use_config_min_sale_qty' => 0,
- 'max_sale_qty' => 10,
- 'use_config_max_sale_qty' => 0,
- 'is_qty_decimal' => 0,
- 'backorders' => 1,
- 'use_config_backorders' => 0,
- 'notify_stock_qty' => 10,
- 'use_config_notify_stock_qty' => 0
-);
-
-$result = $client->call(
- $session,
- 'product_stock.update',
- array(
- $productId,
- $stockItemData
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-Â
-$result = $proxy->catalogInventoryStockItemUpdate($sessionId, 1, array(
-'qty' => '49',
-'is_in_stock' => 1
-));
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->catalogInventoryStockItemUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'data' => array(
-'qty' => '49',
-'is_in_stock' => 1
-)));
-
-var_dump($result->result);
- Allows you to create an empty shopping cart.
- - -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - storeId |
-Store view ID or code (optional) | -
Returns:
- -| Type | -Description | -
|---|---|
| int | -ID of the created empty shopping cart | -
Faults:
-No Faults
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartCreate($sessionId, '3');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartCreate((object)array('sessionId' => $sessionId->result, 'store' => '3'));
-
-var_dump($result->result);
- The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
- -Allows you to manage shopping carts.
- -Resource Name: cart
- -Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1003 | -Can not create a quote. | -
| 1004 | -Can not create a quote because quote with such identifier is already exists | -
| 1005 | -You did not set all required agreements | -
| 1006 | -The checkout type is not valid. Select single checkout type. | -
| 1007 | -Checkout is not available for guest | -
| 1008 | -Can not create an order. | -
The following example illustrates the work with shopping cart (creation of a shopping cart, setting customer and customer addresses, adding products to the shopping cart, updating products in the shopping cart, removing products from the shopping cart, getting the list of products/shipping methods/payment methods, setting payment/shipping methods, adding/removing coupon, getting total prices/full information about shopping cart/list of licenses, and creating an order.
-$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-// Create a quote, get quote identifier
-$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-
-// Set customer, for example guest
-$customerAsGuest = array(
- "firstname" => "testFirstname",
- "lastname" => "testLastName",
- "email" => "testEmail",
- "website_id" => "0",
- "store_id" => "0",
- "mode" => "guest"
-);
-$resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customerAsGuest) );
-
-// Set customer addresses, for example guest's addresses
-$arrAddresses = array(
- array(
- "mode" => "shipping",
- "firstname" => "testFirstname",
- "lastname" => "testLastname",
- "company" => "testCompany",
- "street" => "testStreet",
- "city" => "testCity",
- "region" => "testRegion",
- "postcode" => "testPostcode",
- "country_id" => "id",
- "telephone" => "0123456789",
- "fax" => "0123456789",
- "is_default_shipping" => 0,
- "is_default_billing" => 0
- ),
- array(
- "mode" => "billing",
- "firstname" => "testFirstname",
- "lastname" => "testLastname",
- "company" => "testCompany",
- "street" => "testStreet",
- "city" => "testCity",
- "region" => "testRegion",
- "postcode" => "testPostcode",
- "country_id" => "id",
- "telephone" => "0123456789",
- "fax" => "0123456789",
- "is_default_shipping" => 0,
- "is_default_billing" => 0
- )
-);
-$resultCustomerAddresses = $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses));
-
-// add products into shopping cart
-$arrProducts = array(
- array(
- "product_id" => "1",
- "qty" => 2
- ),
- array(
- "sku" => "testSKU",
- "quantity" => 4
- )
-);
-$resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts));
-
-// update product in shopping cart
-$arrProducts = array(
- array(
- "product_id" => "1",
- "qty" => 5
- ),
-);
-$resultCartProductUpdate = $proxy->call($sessionId, "cart_product.update", array($shoppingCartId, $arrProducts));
-
-// remove products from shopping cart, for example by SKU
-$arrProducts = array(
- array(
- "sku" => "testSKU"
- ),
-);
-$resultCartProductRemove = $proxy->call($sessionId, "cart_product.remove", array($shoppingCartId, $arrProducts));
-
-// get list of products
-$shoppingCartProducts = $proxy->call($sessionId, "cart_product.list", array($shoppingCartId));
-print_r( $shoppingCartProducts );
-
-// get list of shipping methods
-$resultShippingMethods = $proxy->call($sessionId, "cart_shipping.list", array($shoppingCartId));
-print_r( $resultShippingMethods );
-
-// set shipping method
-$randShippingMethodIndex = rand(1, count($resultShippingMethods) );
-$shippingMethod = $resultShippingMethods[$randShippingMethodIndex]["code"];
-
-$resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod));
-
-// get list of payment methods
-$resultPaymentMethods = $proxy->call($sessionId, "cart_payment.list", array($shoppingCartId));
-print_r($resultPaymentMethods);
-
-// set payment method
-$paymentMethod = array(
- "method" => "checkmo"
-);
-$resultPaymentMethod = $proxy->call($sessionId, "cart_payment.method", array($shoppingCartId, $paymentMethod));
-
-// add coupon
-$couponCode = "aCouponCode";
-$resultCartCouponRemove = $proxy->call($sessionId, "cart_coupon.add", array($shoppingCartId, $couponCode));
-
-// remove coupon
-$resultCartCouponRemove = $proxy->call($sessionId, "cart_coupon.remove", array($shoppingCartId));
-
-// get total prices
-$shoppingCartTotals = $proxy->call($sessionId, "cart.totals", array($shoppingCartId));
-print_r( $shoppingCartTotals );
-
-// get full information about shopping cart
-$shoppingCartInfo = $proxy->call($sessionId, "cart.info", array($shoppingCartId));
-print_r( $shoppingCartInfo );
-
-// get list of licenses
-$shoppingCartLicenses = $proxy->call($sessionId, "cart.licenseAgreement", array($shoppingCartId));
-print_r( $shoppingCartLicences );
-
-// check if license is existed
-$licenseForOrderCreation = null;
-if (count($shoppingCartLicenses)) {
- $licenseForOrderCreation = array();
- foreach ($shoppingCartLicenses as $license) {
- $licenseForOrderCreation[] = $license['agreement_id'];
- }
-}
-
-// create order
-$resultOrderCreation = $proxy->call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation));
- Allows you to retrieve full information about the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| int | -quoteId | -Shopping cart ID (quote ID) | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of shoppingCartInfoEntity | -
The shoppingCartInfoEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - store_id |
-Store ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- converted_at |
-Date of conversion | -
| int | - quote_id |
-Quote ID | -
| int | - is_active |
-Active flag | -
| int | - is_virtual |
-Defines whether the product is a virtual one | -
| int | - is_multi_shipping |
-Defines whether multi shipping is available | -
| double | - items_count |
-Items quantity | -
| double | - items_qty |
-Total items quantity | -
| string |
- orig_order_id |
-Original order ID | -
| string |
- store_to_base_rate |
-Store to base rate | -
| string |
- store_to_quote_rate |
-Store to quote rate | -
| string |
- base_currency_code |
-Base currency code | -
| string |
- store_currency_code |
-Store currency code | -
| string |
- quote_currency_code |
-Quote currency code | -
| string |
- grand_total |
-Grand total | -
| string |
- base_grand_total |
-Base grand total | -
| string |
- checkout_method |
-Checkout method | -
| string |
- customer_id |
-Customer ID | -
| string |
- customer_tax_class_id |
-Customer tax class ID | -
| int | - customer_group_id |
-Customer group ID | -
| string |
- customer_email |
-Customer email address | -
| string |
- customer_prefix |
-Customer prefix | -
| string |
- customer_firstname |
-Customer first name | -
| string |
- customer_middlename |
-Customer middle name | -
| string |
- customer_lastname |
-Customer last name | -
| string |
- customer_suffix |
-Customer suffix | -
| string |
- customer_note |
-Customer note | -
| string |
- customer_note_notify |
-Customer notification flag | -
| string |
- customer_is_guest |
-Defines whether the customer is a guest | -
| string |
- applied_rule_ids |
-Applied rule IDs | -
| string |
- reserved_order_id |
-Reserved order ID | -
| string |
- password_hash |
-Password hash | -
| string |
- coupon_code |
-Coupon code | -
| string |
- global_currency_code |
-Global currency code | -
| double | - base_to_global_rate |
-Base to global rate | -
| double | - base_to_quote_rate |
-Base to quote rate | -
| string |
- customer_taxvat |
-Customer taxvat value | -
| string |
- customer_gender |
-Customer gender | -
| double | - subtotal |
-Subtotal | -
| double | - base_subtotal |
-Base subtotal | -
| double | - subtotal_with_discount |
-Subtotal with discount | -
| double | - base_subtotal_with_discount |
-Base subtotal with discount | -
| string |
- ext_shipping_info |
-- |
| string |
- gift_message_id |
-Gift message ID | -
| string |
- gift_message |
-Gift message | -
| double | - customer_balance_amount_used |
-Used customer balance amount | -
| double | - base_customer_balance_amount_used |
-Used base customer balance amount | -
| string |
- use_customer_balance |
-Defines whether to use the customer balance | -
| string |
- gift_cards_amount |
-Gift cards amount | -
| string |
- base_gift_cards_amount |
-Base gift cards amount | -
| string |
- gift_cards_amount_used |
-Used gift cards amount | -
| string |
- use_reward_points |
-Defines whether to use reward points | -
| string |
- reward_points_balance |
-Reward points balance | -
| string |
- base_reward_currency_amount |
-Base reward currency amount | -
| string |
- reward_currency_amount |
-Reward currency amount | -
| array | - shipping_address |
-Array of shoppingCartAddressEntity | -
| array | - billing_address |
-Array of shoppingCartAddressEntity | -
| array | - items |
-Array of shoppingCartItemEntity | -
| array | - payment |
-Array of shoppingCartPaymentEntity | -
The shoppingCartAddressEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - address_id |
-Shopping cart address ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- customer_id |
-Customer ID | -
| int | - save_in_address_book |
-Defines whether to save the address in the address book | -
| string |
- customer_address_id |
-Customer address ID | -
| string |
- address_type |
-Address type | -
| string |
- email |
-Email address | -
| string |
- prefix |
-Customer prefix | -
| string |
- firstname |
-Customer first name | -
| string |
- middlename |
-Customer middle name | -
| string |
- lastname |
-Customer last name | -
| string |
- suffix |
-Customer suffix | -
| string |
- company |
-Company name | -
| string |
- street |
-Street | -
| string |
- city |
-City | -
| string |
- region |
-Region | -
| string |
- region_id |
-Region ID | -
| string |
- postcode |
-Postcode | -
| string |
- country_id |
-Country ID | -
| string |
- telephone |
-Telephone number | -
| string |
- fax |
-Fax | -
| int | - same_as_billing |
-Defines whether the address is the same as the billing one | -
| int | - free_shipping |
-Defines whether free shipping is used | -
| string |
- shipping_method |
-Shipping method | -
| string |
- shipping_description |
-Shipping description | -
| double | - weight |
-Weight | -
The shoppingCartItemEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - item_id |
-Cart item ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- product_id |
-Product ID | -
| string |
- store_id |
-Store ID | -
| string |
- parent_item_id |
-Parent item ID | -
| int | - is_virtual |
-Defines whether the product is a virtual one | -
| string |
- sku |
-Product SKU | -
| string |
- name |
-Product name | -
| string |
- description |
-Description | -
| string |
- applied_rule_ids |
-Applied rule IDs | -
| string |
- additional_data |
-Additional data | -
| string |
- free_shipping |
-Free shipping | -
| string |
- is_qty_decimal |
-Defines whether the quantity is decimal | -
| string |
- no_discount |
-Defines whether no discount is applied | -
| double | - weight |
-Weight | -
| double |
- qty |
-Quantity | -
| double |
- price |
-Price | -
| double |
- base_price |
-Base price | -
| double |
- custom_price |
-Custom price | -
| double |
- discount_percent |
-Discount percent | -
| double |
- discount_amount |
-Discount amount | -
| double |
- base_discount_amount |
-Base discount amount | -
| double |
- tax_percent |
-Tax percent | -
| double |
- tax_amount |
-Tax amount | -
| double |
- base_tax_amount |
-Base tax amount | -
| double |
- row_total |
-Row total | -
| double |
- base_row_total |
-Base row total | -
| double |
- row_total_with_discount |
-Row total with discount | -
| double |
- row_weight |
-Row weight | -
| string | - product_type |
-Product type | -
| double |
- base_tax_before_discount |
-Base tax before discount | -
| double |
- tax_before_discount |
-Tax before discount | -
| double |
- original_custom_price |
-Original custom price | -
| double |
- base_cost |
-Base cost | -
| double |
- price_incl_tax |
-Price including tax | -
| double |
- base_price_incl_tax |
-Base price including tax | -
| double |
- row_total_incl_tax |
-Row total including tax | -
| double | - base_row_total_incl_tax |
-Base row total including tax | -
| string | - gift_message_id |
-Gift message ID | -
| string |
- gift_message |
-Gift message | -
| string |
- gift_message_available |
-Defines whether the gift message is available | -
| double |
- weee_tax_applied |
-Applied fix product tax | -
| double |
- weee_tax_applied_amount |
- Applied fix product tax amount |
-
| double |
- weee_tax_applied_row_amount |
- Applied fix product tax row amount |
-
| double |
- base_weee_tax_applied_amount |
- Applied fix product tax amount (in base currency) |
-
| double |
- base_weee_tax_applied_row_amount |
- Applied fix product tax row amount (in base currency) |
-
| double |
- weee_tax_disposition |
-Fixed product tax disposition | -
| double |
- weee_tax_row_disposition |
- Fixed product tax row disposition |
-
| double |
- base_weee_tax_disposition |
- Fixed product tax disposition (in base currency) |
-
| double | - base_weee_tax_row_disposition |
- Fixed product tax row disposition (in base currency) |
-
| string |
- tax_class_id |
-Tax class ID | -
The shoppingCartPaymentEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - payment_id |
-Payment ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- method |
-Payment method | -
| string |
- cc_type |
-Credit card type | -
| string |
- cc_number_enc |
-Credit card number | -
| string |
- cc_last4 |
-Last four digits on the credit card | -
| string |
- cc_cid_enc |
-Credit card CID | -
| string |
- cc_owner |
-Credit card owner | -
| string |
- cc_exp_month |
-Credit card expiration month | -
| string |
- cc_exp_year |
-Credit card expiration year | -
| string |
- cc_ss_owner |
-Credit card owner (Switch/Solo) | -
| string |
- cc_ss_start_month |
- Credit card start month (Switch/Solo) |
-
| string |
- cc_ss_start_year |
- Credit card start year (Switch/Solo) |
-
| string |
- cc_ss_issue |
- Credit card issue number (Switch/Solo) |
-
| string |
- po_number |
-Purchase order number | -
| string |
- additional_data |
-Additional data | -
| string |
- additional_information |
-Additional information | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'cart.info', '15');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartInfo($sessionId, '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartInfo((object)array('sessionId' => $sessionId->result, 'quoteId' => '15'));
-
-var_dump($result->result);
- Allows you to retrieve the website license agreement for the quote according to the website (store).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID (quote identifier) | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of shoppingCartLicenseEntity | -
The shoppingCartLicenseEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - agreement_id |
-License agreement ID | -
| string |
- name |
-License name | -
| string |
- content |
-License content | -
| int | - is_active |
-Defines whether the license is active | -
| int | - is_html |
-Defines whether the license is HTML | -
Faults:
- -$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'cart.license', '15');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartLicense($sessionId, '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartLicense((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
-var_dump($result->result);
- array - 0 => - array - 'agreement_id' => string '1' (length=1) - 'name' => string 'license' (length=4) - 'content' => string 'terms and conditions' (length=20) - 'content_height' => null - 'checkbox_text' => string 'terms' (length=5) - 'is_active' => string '1' (length=1) - 'is_html' => string '0' (length=1)-
Allows you to create an order from a shopping cart (quote).
-Before placing the order, you need to add the customer, customer address, shipping and payment methods.
Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping Cart ID (quote ID) | -
| string | -storeId | -Store view ID or code (optional) | -
| ArrayOfString | - licenses |
-Website license ID (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -result | -Result of creating an order | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-
-$resultOrderCreation = $proxy->call(
- $sessionId,
- "cart.order",
- array(
- $shoppingCartId
- )
-);
- /**
- * Example of order creation
- * Preconditions are as follows:
- * 1. Create a customer
- * 2. Create a simple product */
-
-$user = 'apiUser';
-$password = 'apiKey';
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
- $sessionId = $proxy->login($user, $password);
- $cartId = $proxy->shoppingCartCreate($sessionId, 1);
- // load the customer list and select the first customer from the list
- $customerList = $proxy->customerCustomerList($sessionId, array());
- $customer = (array) $customerList[0];
- $customer['mode'] = 'customer';
- $proxy->shoppingCartCustomerSet($sessionId, $cartId, $customer);
- // load the product list and select the first product from the list
- $productList = $proxy->catalogProductList($sessionId);
- $product = (array) $productList[0];
- $product['qty'] = 1;
- $proxy->shoppingCartProductAdd($sessionId, $cartId, array($product));
-
- $address = array(
- array(
- 'mode' => 'shipping',
- 'firstname' => $customer['firstname'],
- 'lastname' => $customer['lastname'],
- 'street' => 'street address',
- 'city' => 'city',
- 'region' => 'region',
- 'telephone' => 'phone number',
- 'postcode' => 'postcode',
- 'country_id' => 'country ID',
- 'is_default_shipping' => 0,
- 'is_default_billing' => 0
- ),
- array(
- 'mode' => 'billing',
- 'firstname' => $customer['firstname'],
- 'lastname' => $customer['lastname'],
- 'street' => 'street address',
- 'city' => 'city',
- 'region' => 'region',
- 'telephone' => 'phone number',
- 'postcode' => 'postcode',
- 'country_id' => 'country ID',
- 'is_default_shipping' => 0,
- 'is_default_billing' => 0
- ),
- );
- // add customer address
- $proxy->shoppingCartCustomerAddresses($sessionId, $cartId, $address);
- // add shipping method
- $proxy->shoppingCartShippingMethod($sessionId, $cartId, 'flatrate_flatrate');
-
- $paymentMethod = array(
- 'po_number' => null,
- 'method' => 'checkmo',
- 'cc_cid' => null,
- 'cc_owner' => null,
- 'cc_number' => null,
- 'cc_type' => null,
- 'cc_exp_year' => null,
- 'cc_exp_month' => null
- );
- // add payment method
- $proxy->shoppingCartPaymentMethod($sessionId, $cartId, $paymentMethod);
- // place the order
- $orderId = $proxy->shoppingCartOrder($sessionId, $cartId, null, null);
- Allows you to retrieve total prices for a shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID (quote identifier) | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of shoppingCartTotalsEntity | -
The shoppingCartTotalsEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - title |
-Title | -
| float | - amount |
-Total amount | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'cart.totals', '15');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartTotals($sessionId, '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartTotals((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
-var_dump($result->result);
- array - 0 => - array - 'title' => string 'Subtotal' (length=8) - 'amount' => float 388.69 - 1 => - array - 'title' => string '0 Reward points' (length=15) - 'amount' => float 0 - 2 => - array - 'title' => string 'Gift Cards' (length=10) - 'amount' => float 0 - 3 => - array - 'title' => string 'Store Credit' (length=12) - 'amount' => float 0 - 4 => - array - 'title' => string 'Grand Total' (length=11) - 'amount' => float 388.69 - 5 => - array - 'title' => null - 'amount' => null-
The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
- -Allows you to add and remove coupon codes for a shopping cart.
- -Resource Name: cart_coupon
- -Methods:
-Note: In Magento, quotes and shopping carts are logically related, but technically different. The shopping cart is a wrapper for a quote, and it is used primarily by the frontend logic. The cart is represented by the Mage_Checkout_Model_Cart class and the quote is represented by the Mage_Sales_Model_Quote class.
- -| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1081 | -Coupon could not be applied because quote is empty. | -
| 1082 | -Coupon could not be applied. | -
| 1083 | -Coupon is not valid. | -
Allows you to add a coupon code for a shopping cart (quote). The shopping cart must not be empty.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| int | -quoteId | -Shopping cart ID | -
| string | -couponCode | -Coupon code | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the coupon code is added | -
Faults:
- -$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-$couponCode = "aCouponCode";
-$resultCartCouponRemove = $proxy->call(
- $sessionId,
- "cart_coupon.add",
- array(
- $shoppingCartId,
- $couponCode
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartCouponAdd($sessionId, '15', 'aCouponCode');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartCouponAdd((object)array('sessionId' => $sessionId->result, 'quoteId' => 15, 'couponCode' => 'aCouponCode', 'store' => '3'));
-var_dump($result->result);
- Allows you to remove a coupon code from a shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| int | -quoteId | -Shopping cart ID | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the coupon code is removed | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-$resultCartCouponRemove = $proxy->call(
- $sessionId,
- "cart_coupon.remove",
- array(
- $shoppingCartId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartCouponRemove($sessionId, '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartCouponRemove((object)array('sessionId' => $sessionId->result, 'quoteId' => 15, 'store' => '3'));
-var_dump($result->result);
- The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
- -Allows you to add customer information and addresses into a shopping cart.
- -Resource Name: cart_customer
- -Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1041 | -Customer is not set. | -
| 1042 | -The customer’s identifier is not valid or customer is not existed | -
| 1043 | -Customer could not be created. | -
| 1044 | -Customer data is not valid. | -
| 1045 | -Customer’s mode is unknown | -
| 1051 | -Customer address data is empty. | -
| 1052 | -Customer’s address data is not valid. | -
| 1053 | -The customer’s address identifier is not valid | -
| 1054 | -Customer address is not set. | -
| 1055 | -Customer address identifier do not belong customer, which set in quote | -
Allows you to set the customer addresses in the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID | -
| array | -customerAddressData | -Array of shoppingCartCustomerAddressEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -result | -True if the address is set | -
The shoppingCartCustomerAddressEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - mode |
-Mode: billing or shipping | -
| string |
- address_id |
-Address ID | -
| string |
- firstname |
-Customer first name | -
| string |
- lastname |
-Customer last name | -
| string |
- company |
-Company name | -
| string |
- street |
-Street | -
| string |
- city |
-City | -
| string |
- region |
-Region | -
| string |
- region_id |
-Region ID | -
| string |
- postcode |
-Post code | -
| string |
- country_id |
-Country ID | -
| string |
- telephone |
-Telephone number | -
| string |
- fax |
-Fax number | -
| int | - is_default_billing |
-Defines whether the address is a default billing address | -
| int | - is_default_shipping |
- Defines whether the address is a default shipping address |
-
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-
-$arrAddresses = array(
- array(
- "mode" => "shipping",
- "firstname" => "testFirstname",
- "lastname" => "testLastname",
- "company" => "testCompany",
- "street" => "testStreet",
- "city" => "testCity",
- "region" => "testRegion",
- "postcode" => "testPostcode",
- "country_id" => "id",
- "telephone" => "0123456789",
- "fax" => "0123456789",
- "is_default_shipping" => 0,
- "is_default_billing" => 0
- ),
- array(
- "mode" => "billing",
- "address_id" => "customer_address_id"
- )
-);
-
-$resultCustomerAddresses = $proxy->call(
- $sessionId,
- "cart_customer.addresses",
- array(
- $shoppingCartId,
- $arrAddresses,
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
-Â
-$sessionId = $proxy->login('apiUser', 'apiKey');Â
-Â Â
-$result = $proxy->shoppingCartCustomerAddresses($sessionId, 10, array(array(
-'mode' => 'billing',
-'firstname' => 'first name',
-'lastname' => 'last name',
-'street' => 'street address',
-'city' => 'city',
-'region' => 'region',
-'postcode' => 'postcode',
-'country_id' => 'US',
-'telephone' => '123456789',
-'is_default_billing' => 1
-))); Â Â
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartCustomerAddresses((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'customerAddressData' => array(array(
-'mode' => 'billing',
-'firstname' => 'first name',
-'lastname' => 'last name',
-'street' => 'street address',
-'city' => 'city',
-'region' => 'region',
-'postcode' => 'postcode',
-'country_id' => 'US',
-'telephone' => '123456789',
-'is_default_billing' => 1
-))));
-var_dump($result->result);
- Allows you to add information about the customer to a shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID | -
| array | -customerData | -Array of shoppingCartCustomerEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -result | -True if information is added | -
The shoppingCartCustomerEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - mode |
-Customer mode | -
| int | - customer_id |
-Customer ID | -
| string | - email |
-Customer email address | -
| string |
- firstname |
-Customer first name | -
| string |
- lastname |
-Customer last name | -
| string |
- password |
-Customer password | -
| string |
- confirmation |
-Confirmation flag | -
| int | - website_id |
-Website ID | -
| int | - store_id |
-Store ID | -
| int | - group_id |
-Group ID | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-$customerAsGuest = array(
- "firstname" => "testFirstname",
- "lastname" => "testLastName",
- "email" => "testEmail",
- "website_id" => "0",
- "store_id" => "0",
- "mode" => "guest"
-);
-$resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customerAsGuest) );
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$session = $client->login('apiUser', 'apiKey');
-
-$quoteId = $client->shoppingCartCreate($session);
-
-$customerData = array(
- "firstname" => "testFirstname",
- "lastname" => "testLastName",
- "email" => "testEmail@mail.com",
- "mode" => "guest",
- "website_id" => "0"
- );
-
-$resultCustomerSet = $client->shoppingCartCustomerSet($session, $quoteId, $customerData);
- The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
- -Allows you to retrieve and set payment methods for a shopping cart.
- -Resource Name: cart_payment
- -Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1071 | -Payment method data is empty. | -
| 1072 | -Customer’s billing address is not set. Required for payment method data. | -
| 1073 | -Customer’s shipping address is not set. Required for payment method data. | -
| 1074 | -Payment method is not allowed | -
| 1075 | -Payment method is not set. | -
Allows you to retrieve a list of available payment methods for a shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | - quoteId |
-Shopping cart ID | -
| string | - store |
-Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of shoppingCartPaymentMethodResponseEntity | -
The shoppingCartPaymentMethodResponseEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - code |
-Payment method code | -
| string | - title |
-Payment method title | -
| associativeArray | - cc_types |
-Array of credit card types | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'cart_payment.list', 'quoteId');
-var_dump($result);
- array - 0 => - array - 'code' => string 'checkmo' (length=7) - 'title' => string 'Check / Money order' (length=19) - 'ccTypes' => null - 1 => - array - 'code' => string 'ccsave' (length=6) - 'title' => string 'Credit Card (saved)' (length=19) - 'ccTypes' => - array - 'AE' => string 'American Express' (length=16) - 'VI' => string 'Visa' (length=4) - 'MC' => string 'MasterCard' (length=10) - 'DI' => string 'Discover' (length=8)-
Allows you to set a payment method for a shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID | -
| array | -method | -Array of shoppingCartPaymentMethodEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True on success | -
The shoppingCartPaymentMethodEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - po_number |
-Purchase order number | -
| string |
- method |
-Payment method | -
| string |
- cc_cid |
-Credit card CID | -
| string |
- cc_owner |
-Credit card owner | -
| string |
- cc_number |
-Credit card number | -
| string |
- cc_type |
-Credit card type | -
| string |
- cc_exp_year |
-Credit card expiration year | -
| string |
- cc_exp_month |
-Credit card expiration month | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-
-$paymentMethod = array(
- "method" => "checkmo"
-);
-
-$resultPaymentMethod = $proxy->call(
- $sessionId,
- "cart_payment.method",
- array(
- $shoppingCartId,
- $paymentMethod
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->shoppingCartPaymentMethod($sessionId, 10, array(
-'po_number' => null,
-'method' => 'checkmo',
-'cc_cid' => null,
-'cc_owner' => null,
-'cc_number' => null,
-'cc_type' => null,
-'cc_exp_year' => null,
-'cc_exp_month' => null
-));
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartPaymentMethod((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'method' => array(
-'po_number' => null,
-'method' => 'checkmo',
-'cc_cid' => null,
-'cc_owner' => null,
-'cc_number' => null,
-'cc_type' => null,
-'cc_exp_year' => null,
-'cc_exp_month' => null
-)));
-
-var_dump($result->result);
- The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
- -Allows you to manage products in a shopping cart.
- -Resource Name: cart_product
- -Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1021 | -Product’s data is not valid. | -
| 1022 | -Product(s) could not be added. | -
| 1023 | -Quote could not be saved during adding product(s) operation. | -
| 1024 | -Product(s) could not be updated. | -
| 1025 | -Quote could not be saved during updating product(s) operation. | -
| 1026 | -Product(s) could not be removed. | -
| 1027 | -Quote could not be saved during removing product(s) operation. | -
| 1028 | -Customer is not set for quote. | -
| 1029 | -Customer’s quote is not existed. | -
| 1030 | -Quotes are identical. | -
| 1031 | -Product(s) could not be moved. | -
| 1032 | -One of quote could not be saved during moving product(s) operation. | -
Allows you to create/modify shopping cart and create an order after complete filling the shopping cart. Consists of two main parts: Shopping Cart and Checkout processes.
- -Module: Mage_Checkout
- -Resource: cart_product
- -Allows you to add one or more products to the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | - Shopping cart ID (quote ID) |
-
| array |
- products\productsData |
- An array with the list of shoppingCartProductEntity |
-
| string |
- storeId |
- Store view ID or code (optional) |
-
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True on success (if the product is added to the shopping cart) | -
The shoppingCartProductEntity array attributes are as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -product_id | -ID of the product to be added to the shopping cart (quote) (optional) | -
| string |
- sku |
- SKU of the product to be added to the shopping cart (quote) (optional) |
-
| double |
- qty |
- Number of products to be added to the shopping cart (quote) (optional) |
-
| associativeArray |
- options |
- An array in the form of option_id => content (optional) |
-
| associativeArray |
- bundle_option |
-An array of bundle item options (optional) | -
| associativeArray |
- bundle_option_qty |
-An array of bundle items quantity (optional) | -
| ArrayOfString |
- links |
-An array of links (optional) | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$quoteId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-$arrProducts = array(
- array(
- "product_id" => "1",
- "qty" => 2
- "options" => array( Â
- optionId_1 => optionValue_1,
- ...,
- optionId_n => optionValue_n
- )
- ),
- array(
- "sku" => "testSKU",
- "quantity" => 4
- )
-);
-$resultCartProductAdd = $proxy->call(
- $sessionId,
- "cart_product.add",
- array(
- $quoteId,
- $arrProducts
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->shoppingCartProductAdd($sessionId, 10, array(array(
-'product_id' => '4',
-'sku' => 'simple_product',
-'qty' => '5',
-'options' => null,
-'bundle_option' => null,
-'bundle_option_qty' => null,
-'links' => null
-)));
-
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartProductAdd((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
-'product_id' => '4',
-'sku' => 'simple_product',
-'qty' => '1',
-'options' => null,
-'bundle_option' => null,
-'bundle_option_qty' => null,
-'links' => null
-))));
-
-
-var_dump($result->result);
- Allows you to retrieve the list of products in the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of shoppingCartProductResponseEntity | -
The shoppingCartProductResponseEntity (catalogProductEntity) content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -product_id | -Product ID | -
| string |
- sku |
-Product SKU | -
| string |
- name |
-Product name | -
| string |
- set |
-Product attribute set | -
| string |
- type |
-Product type | -
| ArrayOfString |
- category_ids |
-Array of category IDs | -
| ArrayOfString |
- website_ids |
-Array of website IDs | -
Faults:
- -$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'cart_product.list', '15');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartProductList($sessionId, '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartProductList((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
-var_dump($result->result);
- array - 0 => - array - 'product_id' => string '3' (length=1) - 'sku' => string 'canonxt' (length=7) - 'name' => string 'Canon Digital Rebel XT 8MP Digital SLR Camera' (length=45) - 'set' => string '4' (length=1) - 'type' => string 'simple' (length=6) - 'category_ids' => - array - 0 => string '5' (length=1) - 'website_ids' => - array - 0 => string '2' (length=1)-
Allows you to move products from the current quote to a customer quote.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID | -
| array | -productsData | -Array of shoppingCartProductEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -result | -True if the product is moved to customer quote | -
The shoppingCartProductEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -product_id | -Product ID | -
| string | - sku |
-Product SKU | -
| double | - qty |
-Product quantity | -
| associativeArray |
- options |
-Product custom options | -
| associativeArray |
- bundle_option |
-An array of bundle item options (optional) | -
| associativeArray | - bundle_option_qty |
-An array of bundle items quantity (optional) | -
| ArrayOfString | - links |
-An array of links (optional) | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-$arrProducts = array(
- array(
- "product_id" => "1",
- "qty" => 2
- ),
- array(
- "sku" => "testSKU",
- "quantity" => 4
- )
-);
-$resultCartProductAdd = $proxy->call(
- $sessionId,
- "cart_product.add",
- array(
- $shoppingCartId,
- $arrProducts
- )
-);
-$arrProducts = array(
- array(
- "product_id" => "1"
- ),
-);
-$resultCartProductMove = $proxy->call(
- $sessionId,
- "cart_product.moveToCustomerQuote",
- array(
- $shoppingCartId,
- $arrProducts
- )
-);
- Allows you to remove one or several products from a shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID | -
| array | -productsData | -Array of shoppingCartProductEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the product is removed | -
The shoppingCartProductEntity content is as follows:
- - -| Type | -Name | -Description | -
|---|---|---|
| string | -product_id | -Product ID | -
| string | - sku |
-Product SKU | -
| double | - qty |
-Product quantity | -
| associativeArray |
- options |
-Product custom options | -
| associativeArray |
- bundle_option |
-An array of bundle item options (optional) | -
| associativeArray | - bundle_option_qty |
-An array of bundle items quantity (optional) | -
| ArrayOfString | - links |
-An array of links (optional) | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-$arrProducts = array(
- array(
- "product_id" => "1",
- "qty" => 2
- ),
- array(
- "sku" => "testSKU",
- "quantity" => 4
- )
-);
-$resultCartProductAdd = $proxy->call(
- $sessionId,
- "cart_product.add",
- array(
- $shoppingCartId,
- $arrProducts
- )
-);
-$arrProducts = array(
- array(
- "product_id" => "1"
- ),
-);
-$resultCartProductUpdate = $proxy->call(
- $sessionId,
- "cart_product.remove",
- array(
- $shoppingCartId,
- $arrProducts
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->shoppingCartProductRemove($sessionId, 10, array(array(
-'product_id' => '4',
-'sku' => 'simple_product',
-'qty' => '1',
-'options' => null,
-'bundle_option' => null,
-'bundle_option_qty' => null,
-'links' => null
-)));
-
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartProductRemove((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
-'product_id' => '4',
-'sku' => 'simple_product',
-'qty' => '1',
-'options' => null,
-'bundle_option' => null,
-'bundle_option_qty' => null,
-'links' => null
-))));
-
-
-var_dump($result->result);
- Allows you to update one or several products in the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID | -
| array | -productsData | -Array of shoppingCartProductEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the product is updated | -
The shoppingCartProductEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -product_id | -Product ID | -
| string | - sku |
-Product SKU | -
| double | - qty |
-Product quantity | -
| associativeArray |
- options |
-Product custom options | -
| associativeArray |
- bundle_option |
-An array of bundle item options (optional) | -
| associativeArray | - bundle_option_qty |
-An array of bundle items quantity (optional) | -
| ArrayOfString | - links |
-An array of links (optional) | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-$arrProducts = array(
- array(
- "product_id" => "1",
- "qty" => 2
- ),
- array(
- "sku" => "testSKU",
- "quantity" => 4
- )
-);
-$resultCartProductAdd = $proxy->call(
- $sessionId,
- "cart_product.add",
- array(
- $shoppingCartId,
- $arrProducts
- )
-);
-$arrProducts = array(
- array(
- "product_id" => "1",
- "qty" => 5
- ),
-);
-$resultCartProductUpdate = $proxy->call(
- $sessionId,
- "cart_product.update",
- array(
- $shoppingCartId,
- $arrProducts
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->shoppingCartProductUpdate($sessionId, 10, array(array(
-'product_id' => '4',
-'sku' => 'simple_product',
-'qty' => '2',
-'options' => null,
-'bundle_option' => null,
-'bundle_option_qty' => null,
-'links' => null
-)));
-
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartProductUpdate((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
-'product_id' => '4',
-'sku' => 'simple_product',
-'qty' => '5',
-'options' => null,
-'bundle_option' => null,
-'bundle_option_qty' => null,
-'links' => null
-))));
-
-
-var_dump($result->result);
- The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
- -Allows you to retrieve and set shipping methods for a shopping cart.
- -Resource Name: cart_shipping
- -Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1061 | -Can not make operation because of customer shipping address is not set | -
| 1062 | -Shipping method is not available | -
| 1063 | -Can not set shipping method. | -
| 1064 | -Can not receive list of shipping methods. | -
Allows you to retrieve the list of available shipping methods for a shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -quoteId | -Shopping cart ID | -
| string | -storeId | -Store view ID or code (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of shoppingCartShippingMethodEntity | -
The shoppingCartShippingMethodEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - code |
-Code | -
| string |
- carrier |
-Carrier | -
| string |
- carrier_title |
-Carrier title | -
| string |
- method |
-Shipping method | -
| string |
- method_title |
-Shipping method title | -
| string |
- method_description |
-Shipping method description | -
| double | - price |
-Shipping price | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->call($sessionId, 'cart_shipping.list', 10);
-
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->shoppingCartShippingList($sessionId, 10);
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartShippingList((object)array('sessionId' => $sessionId->result, 'quoteId' => 10));
-var_dump($result->result);
- Allows you to set a shipping method for a shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| int | -quoteId | -Shopping cart ID | -
| string | -method | -Shipping method code | -
| string | -storeId | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | -result | -True if the shipping method is set | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->call($sessionId, 'cart_shipping.method', array(10, 'freeshipping_freeshipping'));
-
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->shoppingCartShippingMethod($sessionId, 10, 'freeshipping_freeshipping');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartShippingMethod((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'shippingMethod' => 'freeshipping_freeshipping'));
-var_dump($result->result);
- The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
- -Allows you to add and remove coupon codes for a shopping cart.
- -Resource Name: cart_coupon
- -Methods:
-Allows you to add customer information and addresses into a shopping cart.
- -Resource Name: cart_customer
- -Methods:
-Allows you to retrieve and set payment methods for a shopping cart.
- -Resource Name: cart_payment
- -Methods:
-Allows you to manage products in a shopping cart.
- -Resource Name: cart_product
- -Methods:
-Allows you to retrieve and set shipping methods for a shopping cart.
- -Resource Name: cart_shipping
- -Methods:
-Allows you to manage shopping carts.
- -Resource Name: cart
- -Methods:
-The Core API allows you to manage a set of common resources used in Magento. However, you may choose to have your own set of resources to manage, or you may wish to extend the Core API to handle additional resources.
- -This tutorial leads you through the process of creating a custom API for a customer module that handles basic customer information.
- -Note: This tutorial applies to v1 of the API.
- -To learn more about the Core API, to read Magento Core API calls.
- -For general information about the Magento API, go to the Introduction.
- -Create a file named api.xml in the /etc folder in the customer module. Start with the empty structure, as follows:
-<config> - <api> - <resources> - </resources> - <acl> - <resources> - <all> - </all> - </resources> - </acl> - </api> -</config>-
Add an element named customer in the <resources> element. Add a <methods> element, with elements for list, create, info, update and remove methods for customer resource.
- -Note that:
-<config> - <api> -.... - <resources> - <customer translate="title" module="customer"> - <title>Customer Resource</title> - <methods> - <list translate="title" module="customer"> - <title>Retrieve customers</title> - </list> - <create translate="title" module="customer"> - <title>Create customer</title> - </create> - <info translate="title" module="customer"> - <title>Retrieve customer data</title> - </info> - <update translate="title" module="customer"> - <title>Update customer data</title> - </update> - <delete> - <title>Delete customer</title> - </delete> - </methods> - <faults module="customer"> - </faults> - </customer> - </resources> -.... - </api> -</config>-
The resource can return some faults, so add a <faults> element in the customer element, and list the various faults.
-<config> - <api> -.... - <resources> - <customer translate="title" module="customer"> -.... - <faults module="customer"> <!-- module="customer" specifies the module which will be used for translation. --> - <data_invalid> <!-- if we get invalid input data for customers --> - <code>100</code > - <!-- we cannot know all the errors that can appear, their details can be found in error message for call --> - <message>Invalid customer data. Details in error message.</message> - </data_invalid> - <filters_invalid> - <code>101</code > - <message>Invalid filters specified. Details in error message.</message> - </filters_invalid> - <not_exists> - <code>102</code > - <message>Customer doesn't exist.</message> - </not_exists> - <not_deleted> - <code>103</code > - <message>Customer was not deleted. Details in error message.</message> - </not_deleted> - </faults> - </customer> - </resources> -.... - </api> -</config>-
In order to prevent unauthorized access to our custom API, you must first list the resources that are restricted within the <acl> element.
-<config> - <api> -.... - <acl> - <resources> - <customer translate="title" module="customer"> - <title>Customers</title> - <list translate="title" module="customer"> - <title>View All</title> - </list> - <create translate="title" module="customer"> - <title>Create</title> - </create> - <info translate="title" module="customer"> - <title>Get Info</title> - </info> - <update translate="title" module="customer"> - <title>Update</title> - </update> - <delete translate="title" module="customer"> - <title>Delete</title> - </delete> - </customer> - </resources> - </acl> - </api> -</config>-
Then, map ACL resources to API resource methods by adding an <acl> element to each part of the resource that needs restricting:
-<config> - <api> - <resources> - <customer translate="title" module="customer"> - <title>Customer Resource</title> - <acl>customer</acl> - <methods> - <list translate="title" module="customer"> - <title>Retrieve customers</title> - <acl>customer/list</acl> - </list> - <create translate="title" module="customer"> - <title>Create customer</title> - <acl>customer/create</acl> - </create> - <info translate="title" module="customer"> - <title>Retrieve customer data</title> - <acl>customer/info</acl> - </info> - <update translate="title" module="customer"> - <title>Update customer data</title> - <acl>customer/update</acl> - </update> - <delete> - <title>Delete customer</title> - <acl>customer/delete</acl> - </delete> - </methods> - .... - </customer> - </resources> -.... - </api> -</config>-
Next, write some PHP code to access the resources. Start by creating a class called Mage_Customer_Model_Customer_Api that extends Mage_Api_Model_Resource_Abstract. Save it into a file called api.php.
-class Mage_Customer_Model_Customer_Api extends Mage_Api_Model_Resource_Abstract
-{
-
- public function create($customerData)
- {
- }
-
- public function info($customerId)
- {
- }
-
- public function items($filters)
- {
- }
-
- public function update($customerId, $customerData)
- {
- }
-
- public function delete($customerId)
- {
- }
-}
- Note that you cannot create method "list" because it’s a PHP keyword, so instead the method is named items. In order to make this work, add a <method> element into the <list> element in api.xml, as shown below.
-<config> - <api> - <resources> - <customer translate="title" module="customer"> - <model>customer/api</model> <!-- our model --> - <title>Customer Resource</title> - <acl>customer</acl> - <methods> - <list translate="title" module="customer"> - <title>Retrieve customers</title> - <method>items</method> <!-- we have another method name inside our resource --> - <acl>customer/list</acl> - </list> -.... - </methods> -.... - </resources> -.... - </api> -</config>-
Now add some simple functionality to the Mage_Customer_Model_Api methods you created.
- -Create a customer:
-public function create($customerData)
- {
- try {
- $customer = Mage::getModel('customer/customer')
- ->setData($customerData)
- ->save();
- } catch (Mage_Core_Exception $e) {
- $this->_fault('data_invalid', $e->getMessage());
- // We cannot know all the possible exceptions,
- // so let's try to catch the ones that extend Mage_Core_Exception
- } catch (Exception $e) {
- $this->_fault('data_invalid', $e->getMessage());
- }
- return $customer->getId();
- }
- Retrieve customer info:
-public function info($customerId)
- {
- $customer = Mage::getModel('customer/customer')->load($customerId);
- if (!$customer->getId()) {
- $this->_fault('not_exists');
- // If customer not found.
- }
- return $customer->toArray();
- // We can use only simple PHP data types in webservices.
- }
- Retrieve list of customers using filtering:
-public function items($filters)
- {
- $collection = Mage::getModel('customer/customer')->getCollection()
- ->addAttributeToSelect('*');
-
- if (is_array($filters)) {
- try {
- foreach ($filters as $field => $value) {
- $collection->addFieldToFilter($field, $value);
- }
- } catch (Mage_Core_Exception $e) {
- $this->_fault('filters_invalid', $e->getMessage());
- // If we are adding filter on non-existent attribute
- }
- }
-
- $result = array();
- foreach ($collection as $customer) {
- $result[] = $customer->toArray();
- }
-
- return $result;
- }
- Update a customer:
-public function update($customerId, $customerData)
- {
- $customer = Mage::getModel('customer/customer')->load($customerId);
-
- if (!$customer->getId()) {
- $this->_fault('not_exists');
- // No customer found
- }
-
- $customer->addData($customerData)->save();
- return true;
- }
- Delete a customer:
-public function delete($customerId)
- {
- $customer = Mage::getModel('customer/customer')->load($customerId);
-
- if (!$customer->getId()) {
- $this->_fault('not_exists');
- // No customer found
- }
-
- try {
- $customer->delete();
- } catch (Mage_Core_Exception $e) {
- $this->_fault('not_deleted', $e->getMessage());
- // Some errors while deleting.
- }
-
- return true;
- }
- In order to create custom webservice adapter, implement the Mage_Api_Model_Server_Adapter_Interface, which is shown below.
-interface Mage_Api_Model_Server_Adapter_Interface
-{
- /**
- * Set handler class name for webservice
- *
- * @param string $handler
- * @return Mage_Api_Model_Server_Adapter_Interface
- */
- function setHandler($handler);
-
- /**
- * Retrieve handler class name for webservice
- *
- * @return string [basc]
- */
- function getHandler();
-
- /**
- * Set webservice API controller
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Interface
- */
- function setController(Mage_Api_Controller_Action $controller);
-
- /**
- * Retrieve webservice API controller
- *
- * @return Mage_Api_Controller_Action
- */
- function getController();
-
- /**
- * Run webservice
- *
- * @return Mage_Api_Model_Server_Adapter_Interface
- */
- function run();
-
- /**
- * Dispatch webservice fault
- *
- * @param int $code
- * @param string $message
- */
- function fault($code, $message);
-
-} // Class Mage_Api_Model_Server_Adapter_Interface End
- Here is an example implementation for XML-RPC:
-class Mage_Api_Model_Server_Adapter_Customxmlrpc
- extends Varien_Object
- implements Mage_Api_Model_Server_Adapter_Interface
-{
- /**
- * XmlRpc Server
- *
- * @var Zend_XmlRpc_Server
- */
- protected $_xmlRpc = null;
-
- /**
- * Set handler class name for webservice
- *
- * @param string $handler
- * @return Mage_Api_Model_Server_Adapter_Xmlrpc
- */
- public function setHandler($handler)
- {
- $this->setData('handler', $handler);
- return $this;
- }
-
- /**
- * Retrieve handler class name for webservice
- *
- * @return string
- */
- public function getHandler()
- {
- return $this->getData('handler');
- }
-
- /**
- * Set webservice API controller
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Xmlrpc
- */
- public function setController(Mage_Api_Controller_Action $controller)
- {
- $this->setData('controller', $controller);
- return $this;
- }
-
- /**
- * Retrieve webservice API controller
- *
- * @return Mage_Api_Controller_Action
- */
- public function getController()
- {
- return $this->getData('controller');
- }
-
- /**
- * Run webservice
- *
- * @param Mage_Api_Controller_Action $controller
- * @return Mage_Api_Model_Server_Adapter_Xmlrpc
- */
- public function run()
- {
- $this->_xmlRpc = new Zend_XmlRpc_Server();
- $this->_xmlRpc->setClass($this->getHandler());
- $this->getController()->getResponse()
- ->setHeader('Content-Type', 'text/xml')
- ->setBody($this->_xmlRpc->handle());
- return $this;
- }
-
- /**
- * Dispatch webservice fault
- *
- * @param int $code
- * @param string $message
- */
- public function fault($code, $message)
- {
- throw new Zend_XmlRpc_Server_Exception($message, $code);
- }
-} // Class Mage_Api_Model_Server_Adapter_Customxmlrpc End
- Notes: The setHandler, getHandler, setController and getController methods have a simple implementation that uses the Varien_Object getData and setData methods.
- -The run and fault methods are a native implementation for an XML-RPC webservice. The run method defines webservice logic in this adapter for creating an XML-RPC server to handle XML-RPC requests.
-public function run()
-Â Â {
-Â Â Â Â $this->_xmlRpc = new Zend_XmlRpc_Server();
-Â Â Â Â $this->_xmlRpc->setClass($this->getHandler());
-Â Â Â Â $this->getController()->getResponse()
-Â Â Â Â Â Â ->setHeader('Content-Type', 'text/xml')
-Â Â Â Â Â Â ->setBody($this->_xmlRpc->handle());
-Â Â Â Â return $this;
-Â Â }
- The "fault" method allows you to send fault exceptions for XML-RPC service when handling requests.
-public function fault($code, $message)
-Â Â {
-Â Â Â Â throw new Zend_XmlRpc_Server_Exception($message, $code);
-Â Â }
- The following are common error messages that you might receive when creating your own custom API.
- -Invalid API path
- -This error occurs when the methods listed in the api.xml file do not correspond exactly with those used in your PHP file.
- -For example, in your api.xml file, you might have this:
-<config> - <api> - <resources> - <checkout_cart translate="title" module="checkout"> - <model>checkout/cart_api</model> - <title>Cart API</title> - <methods> - <list translate="title" module="checkout"> - <title>Retrieve cart data</title> - <method>info</method> - </list> - </methods> - </checkout_cart> - </resources> - ... - </api> -</config>-
You should have a corresponding info method in your PHP file.
-class Mage_Checkout_Model_Cart_Api extends Mage_Cart_Model_Api_Resource
-{
- public function info()
- {
- ...
- }
-}
- If you are missing this method, the error "Invalid API path" will be returned.
- diff --git a/guides/m1x/api/soap/customer/customer.create.html b/guides/m1x/api/soap/customer/customer.create.html deleted file mode 100644 index 0dc813cbe8..0000000000 --- a/guides/m1x/api/soap/customer/customer.create.html +++ /dev/null @@ -1,193 +0,0 @@ ---- -layout: m1x_soap -title: Customer Create ---- - - -Allows you to export/import customers from/to Magento.
- -Create a new customer.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| array | -customerData | - Array of customerCustomerEntityToCreate |
-
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -result | -ID of the created customer | -
The customerCustomerEntityToCreate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -Customer email | -|
| string | -firstname | -Customer first name | -
| string | -lastname | -Customer last name | -
| string | -password | -Customer password | -
| int | -website_id | -Website ID | -
| int | -store_id | -Store ID | -
| int | -group_id | -Group ID | -
| string | -prefix | -Customer prefix (optional) | -
| string | -suffix | -Customer suffix (optional) | -
| string | -dob | -Customer date of birth (optional) | -
| string | -taxvat | -Customer tax/VAT number (optional) | -
| int | -gender | -Customer gender: 1 - Male, 2 - Female (optional) | -
| string | -middlename | -Customer middle name/initial (optional) | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->call($session,'customer.create',array(array('email' => 'mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1)));
-
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->customerCustomerCreate($session, array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerCustomerCreate((object)array('sessionId' => $sessionId->result, 'customerData' => ((object)array(
-'email' => 'customer-mail@example.org',
-'firstname' => 'John',
-'lastname' => 'Dou',
-'password' => '123123',
-'website_id' => '0',
-'group_id' => '1'
-))));
-var_dump($result->result);
- Allows you to export/import customers from/to Magento
- -Delete the required customer.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -customerId | -Customer ID | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the customer is deleted | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'customer.delete', '2');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->customerCustomerDelete($sessionId, '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerCustomerDelete((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
-var_dump($result->result);
- The Mage_Customer module allows you to create, retrieve, update, and delete customers and customer addresses.
- -Allows you to create, retrieve, update, and delete data about customers.
- -Resource Name: customer
- -Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Invalid customer data. Details in error message. | -
| 101 | -Invalid filters specified. Details in error message. | -
| 102 | -Customer does not exist. | -
| 103 | -Customer not deleted. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-$newCustomer = array(
- 'firstname' => 'First',
- 'lastname' => 'Last',
- 'email' => 'test@example.com',
- //for my version of magento (1.3.2.4) you SHOULD NOT
- // hash the password, as in:
- // 'password_hash' => 'password'
- 'password_hash' => md5('password'),
- // password hash can be either regular or salted md5:
- // $hash = md5($password);
- // $hash = md5($salt.$password).':'.$salt;
- // both variants are valid
- 'store_id' => 0,
- 'website_id' => 0
-);
-
-$newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
-
-// Get new customer info
-var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));
-
-
-// Update customer
-$update = array('firstname'=>'Changed Firstname');
-$proxy->call($sessionId, 'customer.update', array($newCustomerId, $update));
-
-var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));
-
-// Delete customer
-$proxy->call($sessionId, 'customer.delete', $newCustomerId);
- Allows you to retrieve the customer groups.
- -Resource Name: customer_group
- -Methods:
-Allows you to export/import customers from/to Magento.
- -Retrieve information about the specified customer.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -customerId | -ID of the required customer | -
| ArrayOfString | -attributes | -Array of attributes | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -customerInfo | -Array of customerCustomerEntity | -
The customerCustomerEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -customer_id | -ID of the customer | -
| string | -created_at | -Date when the customer was created | -
| string | -updated_at | -Date when the customer was updated | -
| string | -increment_id | -Increment ID | -
| int | -store_id | -Store ID | -
| int | -website_id | -Website ID | -
| string | -created_in | -Store view the customer was created in | -
| string | -Customer email | -|
| string | -firstname | -Customer first name | -
| string | -middlename | -Customer middle name | -
| string | -lastname | -Customer last name | -
| int | -group_id | -Customer group ID | -
| string | -prefix | -Customer prefix | -
| string | -suffix | -Customer suffix | -
| string | -dob | -Customer date of birth | -
| string | -taxvat | -Tax/VAT number | -
| boolean | -confirmation | -Confirmation flag | -
| string | -password_hash | -Password hash | -
| string | -rp_token | -Reset password token | -
| string | -rp_token_created_at | -Date when the password was reset | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'customer.info', '2');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->customerCustomerInfo($sessionId, '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerCustomerInfo((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
-var_dump($result->result);
- array - 'customer_id' => string '2' (length=1) - 'created_at' => string '2012-03-29 12:37:23' (length=19) - 'updated_at' => string '2012-03-30 12:59:21' (length=19) - 'increment_id' => null - 'store_id' => string '2' (length=1) - 'website_id' => string '2' (length=1) - 'confirmation' => null - 'created_in' => string 'English' (length=7) - 'default_billing' => null - 'default_shipping' => string '2' (length=1) - 'disable_auto_group_change' => string '0' (length=1) - 'dob' => null - 'email' => string 'john@example.com' (length=16) - 'firstname' => string 'johny' (length=5) - 'gender' => null - 'group_id' => string '1' (length=1) - 'lastname' => string 'doe' (length=3) - 'middlename' => null - 'password_hash' => string 'cccfb3ecf54c9644a34106783148eff2:sp' (length=35) - 'prefix' => null - 'rp_token' => string '15433dd072f1f4e5aae83231b93f72d0' (length=32) - 'rp_token_created_at' => string '2012-03-30 15:10:31' (length=19) - 'suffix' => null - 'taxvat' => null-
Allows you to retrieve the list of customers.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| array | -filters | -Array of filters by customer attributes (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -storeView | -Array of customerCustomerEntity | -
The customerCustomerEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -customer_id | -ID of the customer | -
| string | -created_at | -Date when the customer was created | -
| string | -updated_at | -Date of when the customer was updated | -
| string | -increment_id | -Increment ID | -
| int | -store_id | -Store ID | -
| int | -website_id | -Website ID | -
| string | -created_in | -Created in | -
| string | -Customer email | -|
| string | -firstname | -Customer first name | -
| string | -middlename | -Customer middle name | -
| string | -lastname | -Customer last name | -
| int | -group_id | -Group ID | -
| string | -prefix | -Customer prefix | -
| string | -suffix | -Customer suffix | -
| string | -dob | -Customer date of birth | -
| string | -taxvat | -Taxvat value | -
| boolean | -confirmation | -Confirmation flag | -
| string | -password_hash | -Password hash | -
Note: The password_hash parameter will only match exactly with the same MD5 and salt as was used when Magento stored the value. If you try to match with an unsalted MD5 hash, or any salt other than what Magento used, it will not match. This is just a straight string comparison.
- -$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'customer.list');
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->customerCustomerList($sessionId);
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$complexFilter = array(
- 'complex_filter' => array(
- array(
- 'key' => 'group_id',
- 'value' => array('key' => 'in', 'value' => '1,3')
- )
- )
-);
-$result = $client->customerCustomerList($session, $complexFilter);
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerCustomerList((object)array('sessionId' => $sessionId->result, 'filters' => null));
-var_dump($result->result);
- array - 0 => - array - 'customer_id' => string '2' (length=1) - 'created_at' => string '2012-03-29 12:37:23' (length=19) - 'updated_at' => string '2012-04-03 11:20:18' (length=19) - 'store_id' => string '2' (length=1) - 'website_id' => string '2' (length=1) - 'created_in' => string 'English' (length=7) - 'default_billing' => string '3' (length=1) - 'default_shipping' => string '3' (length=1) - 'disable_auto_group_change' => string '0' (length=1) - 'email' => string 'test@example.com' (length=16) - 'firstname' => string 'John' (length=4) - 'group_id' => string '1' (length=1) - 'lastname' => string 'Doe' (length=3) - 'password_hash' => string 'cccfb3ecf54c9644a34106783148eff2:sp' (length=35) - 'rp_token' => string '15433dd072f1f4e5aae83231b93f72d0' (length=32) - 'rp_token_created_at' => string '2012-03-30 15:10:31' (length=19) - 1 => - array - 'customer_id' => string '4' (length=1) - 'created_at' => string '2012-04-03 11:21:15' (length=19) - 'updated_at' => string '2012-04-03 11:22:57' (length=19) - 'store_id' => string '0' (length=1) - 'website_id' => string '2' (length=1) - 'created_in' => string 'Admin' (length=5) - 'default_billing' => string '8' (length=1) - 'default_shipping' => string '8' (length=1) - 'disable_auto_group_change' => string '0' (length=1) - 'email' => string 'shon@example.com' (length=16) - 'firstname' => string 'Shon' (length=4) - 'group_id' => string '1' (length=1) - 'lastname' => string 'McMiland' (length=8) - 'password_hash' => string '5670581cabba4e2189e5edee99ed0c86:5q' (length=35)-
Update information about the required customer. Note that you need to pass only those arguments which you want to be updated.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -customerId | -Customer ID | -
| array | -customerData | -Array of customerCustomerEntityToCreate | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the customer is updated | -
The customerCustomerEntityToCreate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -customer_id | -Customer ID | -
| string | -Customer email | -|
| string | -firstname | -Customer first name | -
| string | -lastname | -Customer last name | -
| string | -password | -Customer password | -
| int | -group_id | -Group ID | -
| string | -prefix | -Customer prefix | -
| string | -suffix | -Customer suffix | -
| string | -dob | -Customer date of birth | -
| string | -taxvat | -Customer tax/VAT number | -
| int | -gender | -Customer gender: 1 - Male, 2 - Female | -
| string | -middlename | -Customer middle name/initial | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'customer.update', array('customerId' => '2', 'customerData' => array('firstname' => 'John', 'lastname' => 'Doe', 'email' => 'test@example.com', 'password' => 'john22')));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->customerCustomerUpdate($session, '2', array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deekson', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerCustomerUpdate((object)array('sessionId' => $sessionId->result, 'customerId' => '2', 'customerData' => ((object)array(
-'email' => 'customer-mail@example.org',
-'firstname' => 'Dough',
-'lastname' => 'Deekson'
-))));
-var_dump($result->result);
- Allows you to create, retrieve, update, and delete address data for a required customer.
- -Resource Name: customer_address
- -Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Invalid address data. Details in error message. | -
| 101 | -Customer not exists. | -
| 102 | -Address not exists. | -
| 103 | -Address not deleted. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-
-// Create new customer
-$newCustomer = array(
- 'firstname' => 'First',
- 'lastname' => 'Last',
- 'email' => 'test@example.com',
- 'password' => 'password',
- 'store_id' => 0,
- 'website_id' => 0
-);
-
-$newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
-
-//Create new customer address
-$newCustomerAddress = array(
- 'firstname' => 'First',
- 'lastname' => 'Last',
- 'country_id' => 'USA',
- 'region_id' => '43',
- 'region' => 'New York',
- 'city' => 'New York',
- 'street' => array('street1','street2'),
- 'telephone' => '5555-555',
- 'postcode' => 10021,
-
- 'is_default_billing' => true,
- 'is_default_shipping' => true
-);
-
-$newAddressId = $proxy->call($sessionId, 'customer_address.create', array($newCustomerId, $newCustomerAddress));
-
-var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
-
-//Update customer address
-$proxy->call($sessionId, 'customer_address.update', array($newAddressId, array('firstname'=>'Changed Firstname')));
-
-var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
-
-// Delete customer address
-$proxy->call($sessionId, 'customer_address.delete', $newAddressId);
-
-var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
- Create a new address for the customer
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -customerId | -Customer ID | -
| array | -addressdata | -Array of customerAddressEntityCreate | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -result | -ID of the created customer address | -
The customerAddressEntityCreate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - city |
-Name of the city | -
| string |
- company |
-Name of the company | -
| string |
- country_id |
-Country ID | -
| string |
- fax |
-Fax | -
| string |
- firstname |
-Customer first name | -
| string |
- lastname |
-Customer last name | -
| string |
- middlename |
-Customer middle name | -
| string |
- postcode |
-Postcode | -
| string |
- prefix |
-Customer prefix | -
| int | - region_id |
-ID of the region | -
| string |
- region |
-Name of the region | -
| ArrayOfString | - street |
-Array of street addresses | -
| string |
- suffix |
-Customer suffix | -
| string |
- telephone |
-Telephone number | -
| boolean | - is_default_billing |
-True if the address is the default one for billing | -
| boolean | - is_default_shipping |
-True if the address is the default one for shipping | -
Note: If you want to leave any address fields empty, specify them as empty ones in the request body.
- -$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call(
-$session,
-'customer_address.create',
-array('customerId' => 2, 'addressdata' => array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE)));
-var_dump ($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->customerAddressCreate($session, '2', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE));
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerAddressCreate((object)array('sessionId' => $sessionId->result, 'customerId' => '2', 'addressData' => ((object)array(
-'city' => 'Weaverville',
-'country_id' => 'US',
-'postcode' => '96093',
-'region' => 'Texas',
-'street' => array('Street line 1', 'Streer line 2'),
-'telephone' => '847-431-7700',
-'lastname' => 'Doe',
-'firstname' => 'John',
-'is_default_billing' => true
-))));
-var_dump($result->result);
- Delete the required customer address.
- - -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -addressId | -Address ID | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the customer address is deleted | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'customer_address.delete', '4');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->customerAddressDelete($sessionId, '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerAddressDelete((object)array('sessionId' => $sessionId->result, 'addressId' => '4'));
-var_dump($result->result);
- Retrieve information about the required customer address.
- - -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -addressId | -Address ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -info | -Array of customerAddressEntityItem | -
The customerAddressEntityItem content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - customer_address_id |
-ID of the customer address | -
| string | - created_at |
-Date when the address was created | -
| string | - updated_at |
-Date when the address was updated | -
| string | - increment_id |
-Increment ID | -
| string | - city |
-name of the city | -
| string | - company |
-Name of the company | -
| string | - country_id |
-ID of the country | -
| string | - fax |
-Fax | -
| string | - firstname |
-Customer first name | -
| string | - lastname |
-Customer last name | -
| string | - middlename |
-Customer middle name | -
| string | - postcode |
-Customer postcode | -
| string | - prefix |
-Customer prefix | -
| string | - region |
-Name of the region | -
| int | - region_id |
-Region ID | -
| string | - street |
-Name of the street | -
| string | - suffix |
-Customer suffix | -
| string | - telephone |
-Telephone number | -
| boolean | - is_default_billing |
-True if the address is the default one for billing | -
| boolean | - is_default_shipping |
-True if the address is the default one for shipping | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'customer_address.info', '2');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->customerAddressInfo($sessionId, '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerAddressInfo((object)array('sessionId' => $sessionId->result, 'addressId' => '2'));
-var_dump($result->result);
- array - 'customer_address_id' => string '2' (length=1) - 'created_at' => string '2012-03-29 13:20:08' (length=19) - 'updated_at' => string '2012-03-29 13:20:08' (length=19) - 'increment_id' => null - 'city' => string 'Las Vegas' (length=9) - 'company' => null - 'country_id' => string 'US' (length=2) - 'fax' => null - 'firstname' => string 'johny' (length=5) - 'lastname' => string 'doe' (length=3) - 'middlename' => null - 'postcode' => string '89032' (length=5) - 'prefix' => null - 'region' => string 'Nevada' (length=6) - 'region_id' => string '39' (length=2) - 'street' => string '3406 Hiney Road' (length=15) - 'suffix' => null - 'telephone' => string '702-283-9556' (length=12) - 'vat_id' => null - 'vat_is_valid' => null - 'vat_request_date' => null - 'vat_request_id' => null - 'vat_request_success' => null - 'is_default_billing' => boolean false - 'is_default_shipping' => boolean true-
Retrieve the list of customer addresses.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -customerId | -Customer ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of customerAddressEntity | -
The customerAddressEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - customer_address_id |
-ID of the customer address | -
| string | - created_at |
-Date when the address was created | -
| string | - updated_at |
-Date when the address was updated | -
| string | - increment_id |
-Increment ID | -
| string | - city |
-City | -
| string | - company |
-Name of the company | -
| string | - country_id |
-ID of the country | -
| string | - fax |
-Fax | -
| string | - firstname |
-Customer first name | -
| string | - lastname |
-Customer last name | -
| string | - middlename |
-Customer middle name | -
| string | - postcode |
-Customer postcode | -
| string | - prefix |
-Customer prefix | -
| string | - region |
-Name of the region | -
| int | - region_id |
-Region ID | -
| string | - street |
-Name of the street | -
| string | - suffix |
-Customer suffix | -
| string | - telephone |
-Telephone number | -
| boolean | - is_default_billing |
-True if the address is the default one for billing | -
| boolean | - is_default_shipping |
-True if the address is the default one for shipping | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'customer_address.list', '2');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->customerAddressList($sessionId, '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerAddressList((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
-var_dump($result->result);
- array - 0 => - array - 'customer_address_id' => string '2' (length=1) - 'created_at' => string '2012-03-29 13:20:08' (length=19) - 'updated_at' => string '2012-03-29 13:39:29' (length=19) - 'city' => string 'Las Vegas' (length=9) - 'country_id' => string 'US' (length=2) - 'firstname' => string 'johny' (length=5) - 'lastname' => string 'doe' (length=3) - 'postcode' => string '89032' (length=5) - 'region' => string 'Nevada' (length=6) - 'region_id' => string '39' (length=2) - 'street' => string '3406 Hiney Road' (length=15) - 'telephone' => string '702-283-9556' (length=12) - 'is_default_billing' => boolean false - 'is_default_shipping' => boolean true - 1 => - array - 'customer_address_id' => string '3' (length=1) - 'created_at' => string '2012-03-29 13:39:29' (length=19) - 'updated_at' => string '2012-03-29 13:39:29' (length=19) - 'city' => string 'Corpus Christi' (length=14) - 'country_id' => string 'US' (length=2) - 'firstname' => string 'johny' (length=5) - 'lastname' => string 'doe' (length=3) - 'postcode' => string '78476' (length=5) - 'region' => string 'Texas' (length=5) - 'region_id' => string '57' (length=2) - 'street' => string '3672 Boone Street' (length=17) - 'telephone' => string '361-280-8488' (length=12) - 'vat_id' => string 'GB999 9999 73' (length=13) - 'is_default_billing' => boolean false - 'is_default_shipping' => boolean false-
Update address data of the required customer
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| int | -addressId | -Address ID | -
| array | -addressdata | -Array of customerAddressEntityCreate | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the customer address is updated | -
The customerAddressEntityCreate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - city |
-Name of the city | -
| string |
- company |
-Name of the company | -
| string |
- country_id |
-Country ID | -
| string |
- fax |
-Fax | -
| string |
- firstname |
-Customer first name | -
| string |
- lastname |
-Customer last name | -
| string |
- middlename |
-Customer middle name | -
| string |
- postcode |
-Postcode | -
| string |
- prefix |
-Customer prefix | -
| int | - region_id |
-ID of the region | -
| string |
- region |
-Name of the region | -
| ArrayOfString | - street |
-Array of streets | -
| string |
- suffix |
-Customer suffix | -
| string |
- telephone |
-Telephone number | -
| boolean | - is_default_billing |
-True if the address is the default one for billing | -
| boolean | - is_default_shipping |
-True if the address is the default one for shipping | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call(
-$session,
-'customer_address.update',
-array('addressId' => 8, 'addressdata' => array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => TRUE, 'is_default_shipping' => FALSE)));
-var_dump ($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->customerAddressUpdate($session, '8', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE));
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerAddressUpdate((object)array('sessionId' => $sessionId->result, 'addressId' => '8', 'addressData' => ((object)array(
-'firstname' => 'John',
-'lastname' => 'Doe',
-'street' => array('Street line 1', 'Streer line 2'),
-'city' => 'Weaverville',
-'country_id' => 'US',
-'region' => 'Texas',
-'region_id' => 3,
-'postcode' => '96093',
-'telephone' => '530-623-2513',
-'is_default_billing' => TRUE,
-'is_default_shipping' => TRUE
-))));
-var_dump($result->result);
- Allows you to export customer groups from Magento
- -Retrieve the list of customer groups
- - -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -An array of customerGroupEntity | -
The customerGroupEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - customer_group_id |
-ID of the customer group | -
| string | - customer_group_code |
-Customer group code | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'customer_group.list');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->customerGroupList($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->customerGroupList((object)array('sessionId' => $sessionId->result));
-var_dump($result->result);
- array - 0 => - array - 'customer_group_id' => string '0' (length=1) - 'customer_group_code' => string 'NOT LOGGED IN' (length=13) - 1 => - array - 'customer_group_id' => string '1' (length=1) - 'customer_group_code' => string 'General' (length=7) - 2 => - array - 'customer_group_id' => string '2' (length=1) - 'customer_group_code' => string 'Wholesale' (length=9) - 3 => - array - 'customer_group_id' => string '3' (length=1) - 'customer_group_code' => string 'Retailer' (length=8)-
The Mage_Directory module allows you to retrieve country and region data.
- -Allows you to retrieve a list of countries.
- -Resource Name: directory_country
- -Aliases:
-Methods:
-Allows you to retrieve a list of regions within a country.
- -Resource Name: directory_region
- -Aliases:
-Methods:
-Allows you to retrieve the list of countries from Magento.
- -Module: Mage_Directory
- -Resource: directory_country
- -Aliases:
-Retrieve the list of countries from Magento.
- -Aliases:
-| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| Type | -Name | -Description | -
|---|---|---|
| array | -countries | -An array of directoryCountryEntity | -
The directoryCountryEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -country_id | -ID of the retrieved country | -
| string | -iso2_code | -ISO 2-alpha code | -
| string | -iso3_code | -ISO 3-alpha code | -
| string | -name | -Name of the retrieved country | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$countries = $proxy->call($sessionId, 'country.list');
-var_dump($countries); // Countries list.
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->directoryCountryList($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->directoryCountryList((object)array('sessionId' => $sessionId->result));
-var_dump($result->result);
- array - 0 => - array - 'country_id' => string 'AD' (length=2) - 'iso2_code' => string 'AD' (length=2) - 'iso3_code' => string 'AND' (length=3) - 'name' => string 'Andorra' (length=7) - 1 => - array - 'country_id' => string 'AE' (length=2) - 'iso2_code' => string 'AE' (length=2) - 'iso3_code' => string 'ARE' (length=3) - 'name' => string 'United Arab Emirates' (length=20) - 2 => - array - 'country_id' => string 'AF' (length=2) - 'iso2_code' => string 'AF' (length=2) - 'iso3_code' => string 'AFG' (length=3) - 'name' => string 'Afghanistan' (length=11)-
Allows you to export the list of regions from Magento
- -Aliases:
-Retrieve the list of regions in the specified country.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -country | -Country code in ISO2 or ISO3 | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | - directoryRegionEntityArray |
-An array of directoryRegionEntity | -
The directoryRegionEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -region_id | -ID of the region | -
| string | -code | -Region code | -
| string | -name | -Name of the region | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Country not exists. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$regions = $proxy->call($sessionId, 'region.list', 'US');
-
-var_dump($regions); // Region list for USA.
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->directoryRegionList($sessionId,'US');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->directoryRegionList((object)array('sessionId' => $sessionId->result, 'country' => 'US'));
-var_dump($result->result);
- array - 0 => - array - 'region_id' => string '1' (length=1) - 'code' => string 'AL' (length=2) - 'name' => string 'Alabama' (length=7) - 1 => - array - 'region_id' => string '2' (length=1) - 'code' => string 'AK' (length=2) - 'name' => string 'Alaska' (length=6) - 2 => - array - 'region_id' => string '3' (length=1) - 'code' => string 'AS' (length=2) - 'name' => string 'American Samoa' (length=14) - 3 => - array - 'region_id' => string '4' (length=1) - 'code' => string 'AZ' (length=2) - 'name' => string 'Arizona' (length=7)-
| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1003 | -Provided data is invalid | -
| 1004 | -Gift card account with requested code does not exist | -
| 1005 | -Error happened while adding gift card to quote | -
Allows you to add a gift card to the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -giftcardAccountCode | -Gift card account code | -
| int | -quoteId | -Shopping cart ID (quote ID) | -
| int | -storeId | -Store ID (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the gift card is added to the quote | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1004 | -Gift card account with requested code does not exist | -
| 1005 | -Error happened while adding gift card to quote | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$code = "giftcardAccountCode";
-$quoteId = 15;
-
-$giftcardList = $proxy->call(
- $sessionId,
- "cart_giftcard.add",
- array(
- $code,
- $quoteId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartGiftcardAdd($sessionId, 'giftcardAccountCode', '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartGiftcardAdd((object)array('sessionId' => $sessionId->result, 'giftcardAccountCode' => 'giftcardAccountCode', 'quoteId' => '15', 'storeId' => '3'));
-
-var_dump($result->result);
- Allows you to retrieve the list of gift cards used in the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -quoteId | -Shopping cart ID (quote ID) | -
| string | -storeId | -Store ID (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of enterpriseGiftcardaccountListEntity | -
The enterpriseGiftcardaccountListEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -giftcardaccount_id | -Gift card account ID | -
| string |
- code |
-Gift card code | -
| string |
- used_amount |
-Used amount (in store currency) | -
| string |
- base_amount |
-Base amount (in base currency) | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$quoteId = 15;
-
-$giftcardList = $proxy->call(
- $sessionId,
- "cart_giftcard.list",
- array(
- $quoteId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartGiftcardList($sessionId, '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartGiftcardList((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'storeId' => '3'));
-
-var_dump($result->result);
- array - 0 => - array - 'giftcardaccount_id' => string '5' (length=1) - 'code' => string 'code' (length=12) - 'used_amount' => float 141.34 - 'base_amount' => string '200.0000' (length=8) - 1 => - array - 'giftcardaccount_id' => string '6' (length=1) - 'code' => string 'code' (length=12) - 'used_amount' => float 35.34 - 'base_amount' => string '50.0000' (length=7)-
Allows you to remove a gift card from the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -giftcardAccountCode | -Gift card account code | -
| string |
-quoteId | -Shopping cart ID (quote ID) | -
| string |
-storeId | -Store ID (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the gift card is removed from the shopping cart | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1004 | -Gift card account with requested code does not exist | -
| 1005 | -Error happened while adding gift card to quote | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$code = "giftcardAccountCode";
-$quoteId = 15;
-
-$giftcardList = $proxy->call(
- $sessionId,
- "cart_giftcard.remove",
- array(
- $code,
- $quoteId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartGiftcardRemove($sessionId, 'giftcardAccountCode', '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartGiftcardRemove((object)array('sessionId' => $sessionId->result, 'giftcardAccountCode' => 'giftcardAccountCode', 'quoteId' => '15', 'storeId' => '3'));
-
-var_dump($result->result);
- Allows you to retrieve information on a gift card and redeem gift card amount.
- -Resource Name: giftcard_customer
- - -Allows you to retrieve, add, and remove a gift card from/to a shopping cart.
- -Resource Name: cart_giftcard
- - -Allows you to create, update, remove, and retrieve information on a gift card account.
- -Resource Name: giftcard_account
- - -Allows you to operate with giftcards.
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Gift card does not exists. | -
| 101 | -Invalid filters specified. Details in error message. | -
| 102 | -Unable to save data. | -
| 104 | -Provided email notification data is invalid | -
| 105 | -Provided gift card account data is invalid | -
| 106 | -Gift card account with requested id does not exist | -
| 107 | -Error occurs while deleting gift card | -
Allows you to create a new gift card account.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| array | -giftcardAccountData | -Array of giftcardAccountCreateGiftcardAccountData | -
| array | -notificationData | -Array of giftcardAccountCreateNotificationData (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| string | -ID of the created gift card account | -
The giftcardAccountCreateGiftcardAccountData content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - status |
-Gift card status: available, used, redeemed, expired | -
| string |
- date_expires |
- Gift card expiration date in the YYYY-MM-DD format |
-
| string |
- website_id |
- Gift card website ID |
-
| string |
- balance |
- Initial gift card balance |
-
| string |
- state |
-State: active or not active | -
| string |
- is_redeemable |
-Defines whether the gift card is redeemable | -
The giftcardAccountCreateNotificationData content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - recipient_name |
-Recipient name | -
| string | - recipient_email |
-Recipient email address | -
| string | - recipient_store |
-Recipient store | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 105 | -Provided gift card account data is invalid. | -
| 104 | -Provided email notification data is invalid | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$giftcardToCreate = array(
- "status" => 'available',
- "is_redeemable" => 1,
- "balance" => 200,
- "website_id" => 2,
- "date_expires" => null
-);
-
-$giftcardId = $proxy->call(
- $sessionId,
- "giftcard_account.create",
- array(
- $giftcardToCreate
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->giftcardAccountCreate($sessionId, array(
-'status' => 'available',
-'date_expires' => null,
-'website_id' => '2',
-'balance' => '200',
-'state' => '1',
-'is_redeemable' => '1'),
-array(
-'recipient_name' => 'name',
-'recipient_email' => 'email',
-'recipient_store' => null)
-);
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftcardAccountCreate((object)array('sessionId' => $sessionId->result, 'giftcardAccountData' => array(
-'status' => 'available',
-'date_expires' => null,
-'website_id' => '2',
-'balance' => '200',
-'state' => '1',
-'is_redeemable' => '1'),
-'notificationData' => array(
-'recipient_name' => 'name',
-'recipient_email' => 'email',
-'recipient_store' => null)
-));
-
-var_dump($result->result);
- Allows you to receive full information about the selected gift card account.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -giftcardAccountId | -Gift card account ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of giftcardAccountEntity | -
The giftcardAccountEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | -giftcard_id | -Gift card account ID | -
| string | - code |
-Gift card account code | -
| int | - store_id |
-Gift card account store ID | -
| string | - date_created |
-Creation date in the YYYY-MM-DD format | -
| string | - expire_date |
-Expiration date in the YYYY-MM-DD format | -
| int | - is_active |
-Defines whether the gift card account is active | -
| int | - is_redeemable |
-Defines whether the gift card account is redeemable | -
| string | - status |
-Gift card account status | -
| double | - balance |
-Gift card account initial balance | -
| array | - history |
-Array of giftcardAccountEntityHistory | -
The giftcardAccountEntityHistory content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - record_id |
-Record ID | -
| string | - date |
-Date | -
| string | - action |
- History action |
-
| double | - balance_delta |
-Balance delta | -
| double | - balance |
-Balance | -
| string | - info |
- Record comment |
-
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Gift card does not exists. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$giftcardId = 1;
-$giftcardInfo = $proxy->call(
- $sessionId,
- "giftcard_account.info",
- array(
- $giftcardId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->giftcardAccountInfo($sessionId, '1');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftcardAccountInfo((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '1'));
-
-var_dump($result->result);
- array - 'giftcard_id' => string '1' (length=1) - 'code' => string '02DQ9T1K0Y0V' (length=12) - 'store_id' => string '0' (length=1) - 'date_created' => string '2012-04-06' (length=10) - 'expire_date' => null - 'is_active' => string '0' (length=1) - 'status' => string 'Available' (length=9) - 'balance' => string '0.0000' (length=6) - 'is_redeemable' => string '1' (length=1) - 'history' => - array - 0 => - array - 'record_id' => string '1' (length=1) - 'date' => string '2012-04-06 14:31:57' (length=19) - 'action' => string 'Created' (length=7) - 'balance_delta' => string '0.0000' (length=6) - 'balance' => string '0.0000' (length=6) - 'info' => null-
Allows you to retrieve the list of available gift card accounts.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| array | -filters | -Array of filters (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of giftcardAccountEntity | -
The giftcardAccountEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - giftcard_id |
-Gift card ID | -
| string | - code |
-Gift card code | -
| int | - store_id |
-Gift card store ID | -
| string | - date_created |
- Creation date in the YYYY-MM-DD format |
-
| string | - expire_date |
- Expiration date in the YYYY-MM-DD format |
-
| int | - is_active |
-Defines whether the gift card is active | -
| string | - status |
-Gift card status | -
| double | - balance |
-Gift card balance | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Invalid filters specified. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$giftcardList = $proxy->call(
- $sessionId,
- "giftcard_account.list"
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->giftcardAccountList($sessionId);
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$complexFilter = array(
- 'complex_filter' => array(
- array(
- 'key' => 'state',
- 'value' => array('key' => 'in', 'value' => '2,1')
- )
- )
-);
-$result = $client->giftcardAccountList($session, $complexFilter);
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftcardAccountList((object)array('sessionId' => $sessionId->result, 'filters' => null));
-
-var_dump($result->result);
- array - 0 => - array - 'giftcard_id' => string '1' (length=1) - 'code' => string 'code' (length=12) - 'store_id' => string '2' (length=1) - 'date_created' => string '2012-04-06' (length=10) - 'expire_date' => string '2012-04-22' (length=10) - 'is_active' => string '0' (length=1) - 'status' => string 'Available' (length=9) - 'balance' => string '300.0000' (length=8) - 1 => - array - 'giftcard_id' => string '2' (length=1) - 'code' => string 'code' (length=12) - 'store_id' => string '2' (length=1) - 'date_created' => string '2012-04-09' (length=10) - 'expire_date' => string '2012-04-25' (length=10) - 'is_active' => string '1' (length=1) - 'status' => string 'Available' (length=9) - 'balance' => string '500.0000' (length=8)-
Allows you to remove the specified gift card account.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | -giftcardAccountId | -Gift card account ID | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the gift card account is removed | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 106 | -Gift card account with requested id does not exist | -
| 107 | -Error occurs while deleting gift card | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$giftcardId = 2;
-$result = $proxy->call(
- $sessionId,
- "giftcard_account.remove",
- array(
- $giftcardId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->giftcardAccountRemove($sessionId, '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftcardAccountRemove((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '2'));
-
-var_dump($result->result);
- Allows you to update the required gift card account.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -giftcardAccountId | -Gift card account ID | -
| array | -giftcardData | -Array of giftcardAccountEntityToUpdate | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True is the gift card account is updated | -
The giftcardAccountEntityToUpdate content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| boolean | - is_active |
-Defines whether the gift card account is active | -
| boolean | - is_redeemable |
-Defines whether the gift card account is redeemable | -
| int | - store_id |
-Store view ID | -
| double | - balance |
-Gift card account initial balance | -
| string | - date_expires |
-Expiration date in the YYYY-MM-DD format | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 102 | -Unable to save data. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$giftcardId = 1;
-$giftcardToUpdate = array(
- "balance" => 700
-);
-
-$result = $proxy->call(
- $sessionId,
- "giftcard_account.update",
- array(
- $giftcardId,
- $giftcardToUpdate
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
-
-$sessionId = $proxy->login('apiUser', 'apiKey');Â
-Â
-$result = $proxy->giftcardAccountUpdate($sessionId, '3', array(
-'date_expires' => null,Â
-'store_id' => '2',Â
-'balance' => '700',Â
-'is_active' => TRUE,Â
-'is_redeemable' => TRUE)); Â Â
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftcardAccountUpdate((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '3', 'giftcardData' => array(
-'balance' => '700',
-'is_active' => TRUE,
-'is_redeemable' => TRUE,
-'store_id' => '2',
-'date_expires' => null)));
-
-var_dump($result->result);
- | Fault Code | -Fault Message | -
|---|---|
| 100 | -Gift card does not exists. | -
| 101 | -Gift card is not valid. | -
| 103 | -Redemption functionality is disabled. | -
| 104 | -Unable to redeem gift card. | -
Allows you to receive information about the gift card for a selected customer.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -code | -Gift card code | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of giftcardCustomerEntity | -
The giftcardCustomerEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| double | - balance |
-Gift card balance | -
| string | - expire_date |
-Gift card expiration date in the YYYY-MM-DD format | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Gift card does not exists. | -
| 101 | -Gift card is not valid. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$code = "code";
-
-$giftcardInfo = $proxy->call(
- $sessionId,
- "giftcard_customer.info",
- array(
- $code
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->giftcardCustomerInfo($sessionId, 'code');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftcardCustomerInfo((object)array('sessionId' => $sessionId->result, 'code' => 'code'));
-
-var_dump($result->result);
- array - 'balance' => string '500.0000' (length=8) - 'expire_date' => string '2012-04-25' (length=10)-
Allows you to redeem amount from a giftcard to the customer store credit.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | -code | -Gift card code | -
| string |
-customer_id | -Customer ID | -
| string |
-store_id | -Store view ID | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -True if the amount is redeemed | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Gift card does not exists. | -
| 101 | -Gift card is not valid. | -
| 103 | -Redemption functionality is disabled. | -
| 104 | -Unable to redeem gift card. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$code = "giftcardcode";
-$customerId = 1;
-$storeId = 1;
-
-$giftcardInfo = $proxy->call(
- $sessionId,
- "giftcard_customer.redeem",
- array(
- $code,
- $customerId,
- $storeId
- )
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->giftcardCustomerRedeem($sessionId, 'giftcardcode', '1', '1');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftcardCustomerRedeem((object)array('sessionId' => $sessionId->result, 'code' => 'giftcardcode', 'customerId' => '1', 'storeId' => '1'));
-
-var_dump($result->result);
- This module allows you to set a gift message for a quote or for a product in a quote.
- - -| Fault Code | -Fault Message | -
|---|---|
| 1001 | -Can not make operation because store is not exists | -
| 1002 | -Can not make operation because quote is not exists | -
| 1101 | -Gift message data is not valid. | -
| 1102 | -Product's data is not valid. | -
| 1103 | -Quote item is not exists | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-// Create a quote, get quote identifier
-$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
-
-// set gift message for quote
-$giftMessage = array (
- 'from' => 'test',
- 'to' => 'test',
- 'message' => 'test'
-);
-
-$giftMessageSetForQuoteResult = $proxy->call($sessionId,"giftmessage.setForQuote", array($shoppingCartId, $giftMessage, 'magento_store'));
-print_r( $giftMessageSetForQuoteResult );
-
-
-// add products into shopping cart
-$arrProducts = array(
- array(
- 'product_id' => '1',
- 'qty' => 2
- ),
- array(
- 'sku' => 'testSKU',
- 'qty' => 4
- )
-);
-$resultCartProductAdd = $proxy->call($sessionId, 'cart_product.add', array($shoppingCartId, $arrProducts));
-
-// set gift message for product
-$giftMessage = array (
- 'from' => 'test for Product',
- 'to' => 'test for Product',
- 'message' => 'test for Product'
-);
-
-/**
-* Note:
-* array for product should be the same as for cart_product.add
-*/
-$giftMessageSetForProductResult = $proxy->call(
- $sessionId,
- "giftmessage.setForQuoteProduct",
- array(
- $shoppingCartId,
- array(
- array(
- 'product' => $arrProducts[0],
- 'giftmessage' => $giftMessage,
- ),
- array(
- 'product' => $arrProducts[1],
- 'giftmessage' => $giftMessage,
- )
- ),
- 'magento_store'
- )
-);
-
-print_r( $giftMessageSetForProductResult );
- Allows you to set a global gift message for the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -quoteId | -Shopping cart ID (quote ID) | -
| array | -giftMessage | -Array of giftMessageEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -giftMessageResponse | -
The giftMessageEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - from |
-Gift message sender | -
| string |
- to |
-Gift message recipient | -
| string |
- message |
-Gift message text | -
The giftMessageResponse content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - entityId |
-Entity ID | -
| boolean | - result |
-Result of adding a message | -
| string | - error |
-Error | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'giftmessage.setForQuote', array('quoteId' => '10', 'giftMessage' => array('from' => 'John', 'to' => 'Sara', 'message' => 'Gift message text')));
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
-
-$sessionId = $proxy->login('apiUser', 'apiKey');Â
-Â
-$result = $proxy->giftMessageSetForQuote($sessionId, 10, array(
-'from' => 'John',
-'to' => 'Sara',
-'message' => 'Gift message text'
-)); Â
-Â
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftMessageSetForQuote((object)array('sessionId' => $sessionId->result, 'quoteId' => '10', 'giftMessage' => array(
-'from' => 'John',
-'to' => 'Sara',
-'message' => 'Gift message text'
-)));
-
-var_dump($result);
- array - 'entityId' => string '15' (length=2) - 'result' => boolean true - 'error' => string '' (length=0)-
Allows you to set a gift message for an item in the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -quoteItemId | -Shopping cart (quote) item ID | -
| array | -giftMessage | -Array of giftMessageEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -giftMessageResponse | -
The giftMessageEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - from |
-Gift message sender | -
| string | - to |
-Gift message recipient | -
| string | - message |
-Gift message | -
The giftMessageResponse content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - entityId |
-Entity ID | -
| boolean | - result |
-Result of adding a message | -
| string | - error |
-Error | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'giftmessage.setForQuoteItem', array('quoteItemId' => '1', 'giftMessage' => array('from' => 'John', 'to' => 'Sara', 'message' => 'Gift message text')));
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->giftMessageSetForQuoteItem($sessionId, '1', array(
-'from' => 'John',
-'to' => 'Sara',
-'message' => 'Gift message text'
-));
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));Â
-Â
-$result = $proxy->giftMessageSetForQuoteItem((object)array('sessionId' => $sessionId->result, 'quoteItemId' => '1', 'giftMessage' => array(
-'from' => 'John',
-'to' => 'Sara',
-'message' => 'Gift message text'
-))); Â
-Â
-var_dump($result);
- array - 'entityId' => string '1' (length=1) - 'result' => boolean true - 'error' => string '' (length=0)-
Allows you to set a gift message for a product in the shopping cart (quote).
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -quoteId | -Shopping cart ID (quote ID) | -
| array | - productsAndMessages |
-Array of giftMessageAssociativeProductsEntity | -
| string | -store | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of giftMessageResponse | -
The giftMessageAssociativeProductsEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -product | -Array of shoppingCartProductEntity | -
| array | - message |
-Array of giftMessageEntity | -
The giftMessageResponse content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - entityId |
-Entity ID | -
| boolean | - result |
-Result | -
| string | - error |
-Error | -
The shoppingCartProductEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - product_id |
- ID of the product |
-
| string | - sku |
- SKU of the product |
-
| double | - qty |
- Number of products |
-
| associativeArray |
- options |
-An array of options | -
| associativeArray |
- bundle_option |
- An array of bundle item options |
-
| associativeArray |
- bundle_option_qty |
- An array of bundle items quantity |
-
| ArrayOfString | - links |
- An array of links |
-
The giftMessageEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - from |
-Gift message sender | -
| string | - to |
-Gift message recipient | -
| string | - message |
-Gift message | -
Faults:
-No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->call($sessionId, 'giftmessage.setForQuoteProduct', array(10, array(
-'product' => array(
- 'product_id' => '5',
- 'sku' => 'sku',
- 'qty' => '1',
- 'options' => null,
- 'bundle_option' => null,
- 'bundle_option_qty' => null,
- 'links' => null),
-'message' => array(
- 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
-)));
-
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->giftMessageSetForQuoteProduct($sessionId, '10', array(array(
-'product' => array(
- 'product_id' => '5',
- 'sku' => 'sku',
- 'qty' => '1',
- 'options' => null,
- 'bundle_option' => null,
- 'bundle_option_qty' => null,
- 'links' => null),
-'message' => array(
- 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
-)));
-
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->giftMessageSetForQuoteProduct((object)array('sessionId' => $sessionId->result, 'quoteId' => '10', 'productsAndMessages' => array(array(
-'product' => array(
- 'product_id' => '5',
- 'sku' => 'sku',
- 'qty' => '1',
- 'options' => null,
- 'bundle_option' => null,
- 'bundle_option_qty' => null,
- 'links' => null),
-'message' => array(
- 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
-))));
-
-var_dump($result->result);
- Allows you to retrieve the customer store credit balance amount.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -customerId | -Customer ID | -
| string | -websiteId | -Website ID | -
Return:
- -| Type | -Description | -
|---|---|
| string/float | -Virtual balance amount | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Provided data is invalid. | -
| 101 | -No balance found with requested parameters. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$customerId = 4;
-$websiteId = 2;
-
-$balanceAmount = $proxy->call($sessionId, 'storecredit.balance', array($customerId, $websiteId));
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->enterpriseCustomerbalanceBalance($sessionId, '4', '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->enterpriseCustomerbalanceBalance((object)array('sessionId' => $sessionId->result, 'customerId' => '4', 'websiteId' => '2'));
-var_dump($result->result);
- Allows you to retrieve the customer store credit history information.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -customerId | -Customer ID | -
| string | -websiteId | -Website ID (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of enterpriseCustomerbalanceHistoryItemEntity | -
The enterpriseCustomerbalanceHistoryItemEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -history_id | - History item ID |
-
| string |
- balance_id |
- Customer balance ID |
-
| string |
- updated_at |
-Date when the balance was updated | -
| string |
- action |
- Code of the reason for balance change |
-
| string |
- balance_amount |
- Balance amount after changing |
-
| string |
- balance_delta |
- Balance change amount |
-
| string |
- additional_info |
- Comment text |
-
| string |
- is_customer_notified |
-Defines whether the customer is notified | -
| string |
- customer_id |
- Balance owner ID |
-
| string |
- website_id |
-Website ID | -
| string |
- base_currency_code |
- Currency code for the customer balance |
-
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Provided data is invalid. | -
| 102 | -No history found with requested parameters. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$customerId = 4;
-
-$balanceHistory = $proxy->call($sessionId, 'storecredit.history', array($customerId));
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->enterpriseCustomerbalanceHistory($sessionId, '4');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->enterpriseCustomerbalanceHistory((object)array('sessionId' => $sessionId->result, 'customerId' => '4', 'websiteId' => '2'));
-var_dump($result->result);
- array - 0 => - array - 'history_id' => string '2' (length=1) - 'balance_id' => string '1' (length=1) - 'updated_at' => string '2012-04-06 13:50:33' (length=19) - 'action' => string '1' (length=1) - 'balance_amount' => string '300.0000' (length=8) - 'balance_delta' => string '-200.0000' (length=9) - 'additional_info' => string 'By admin: john@example.com. (update balance)' (length=44) - 'is_customer_notified' => string '0' (length=1) - 'customer_id' => string '4' (length=1) - 'website_id' => string '2' (length=1) - 'base_currency_code' => null - 1 => - array - 'history_id' => string '1' (length=1) - 'balance_id' => string '1' (length=1) - 'updated_at' => string '2012-04-06 13:44:58' (length=19) - 'action' => string '2' (length=1) - 'balance_amount' => string '500.0000' (length=8) - 'balance_delta' => string '500.0000' (length=8) - 'additional_info' => string 'By admin: john@example.com. (new balance)' (length=41) - 'is_customer_notified' => string '0' (length=1) - 'customer_id' => string '4' (length=1) - 'website_id' => string '2' (length=1) - 'base_currency_code' => null-
Allows you to operate with customer virtual balance.
- - -Aliases: storecredit
- -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Provided data is invalid. | -
| 101 | -No balance found with requested parameters. | -
| 102 | -No history found with requested parameters. | -
Allows you to operate with customer virtual balance.
- -Aliases: storecredit
- -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Provided data is invalid. | -
| 101 | -No balance found with requested parameters. | -
| 102 | -No history found with requested parameters. | -
Aliases: storecredit_quote
- -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Provided data is invalid. | -
| 103 | -No quote found with requested id. | -
| 104 | -Store credit can not be used for quote created by guest. | -
| 105 | -No store found with requested id or code. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$customerId = 10002;
-$websiteId = 1;
-// Get customer balance amount
-$balanceAmount = $proxy->call($sessionId, 'storecredit.balance', array($customerId, $websiteId));
-echo $balanceAmount . "<br />";
-// Get store credit history for specified customer
-$balanceHistory = $proxy->call($sessionId, 'storecredit.history', array($customerId));
-print_r($balanceHistory);
-
-$quoteId = 2;
-$store = 'default';
-// Set customer balance use in shopping cart (quote)
-$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.setAmount', array($quoteId, $store));
-echo $balanceAmountUsedInQuote . "<br />";
-// Unset customer balance use in shopping cart (quote)
-$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.removeAmount', array($quoteId));
-echo $balanceAmountUsedInQuote;
- Allows you to operate with customer virtual balance.
- -Aliases: storecredit_quote
- -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Provided data is invalid. | -
| 103 | -No quote found with requested id. | -
| 104 | -Store credit can not be used for quote created by guest. | -
| 105 | -No store found with requested id or code. | -
Allows you to remove store credit amount from the shopping cart (quote) and increase the customer store credit.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -quoteId | -Shopping cart ID (quote ID) | -
| string | -store | -Store view code or ID (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean | -Result of removing the amount | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Provided data is invalid. | -
| 103 | -No quote found with requested id. | -
| 104 | -Store credit can not be used for quote created by guest. | -
| 105 | -No store found with requested id or code. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$quoteId = 15;
-
-$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.removeAmount', array($quoteId));
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartCustomerbalanceRemoveAmount($sessionId, '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartCustomerbalanceRemoveAmount((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'store' => null));
-var_dump($result->result);
- Allows you to set amount from the customer store credit to the shopping cart.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -quoteId | -Shopping cart ID (quote ID) | -
| string | -store | -Store view code or ID (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| float | -Customer balance amount used in the shopping cart (quote) | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Provided data is invalid. | -
| 103 | -No quote found with requested id. | -
| 104 | -Store credit can not be used for quote created by guest. | -
| 105 | -No store found with requested id or code. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$quoteId = 2;
-$store = 'default';
-
-$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.setAmount', array($quoteId, $store));
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->shoppingCartCustomerbalanceSetAmount($sessionId, '15');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->shoppingCartCustomerbalanceSetAmount((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'store' => null));
-var_dump($result->result);
- The Magento SOAP v1 API provides you with the ability to manage your eCommerce stores by providing calls for working with resources such as customers, categories, products, and sales orders. It also allows you to manage shopping carts and inventory.
- -A SOAP v2 API version has been available since Magento 1.3, and a WS-I compliant version has been available since Magento 1.6.
- -The Magento API supports SOAP and XML-RPC, where SOAP is the default protocol.
- -To connect to Magento SOAP web services, load the WSDL into your SOAP client from either of these URLs:
- -http://magentohost/api/?wsdl-
http://magentohost/api/soap/?wsdl-
where magentohost is the domain for your Magento host.
- -As of v1.3, you may also use the following URL to access the Magento API v2, which has been added to improve compatibility with Java and .NET:
- -http://magentohost/api/v2_soap?wsdl=1-
The following PHP example shows how to make SOAP calls to the Magento API v1:
- -$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'somestuff.method');
-$result = $client->call($session, 'somestuff.method', 'arg1');
-$result = $client->call($session, 'somestuff.method', array('arg1', 'arg2', 'arg3'));
-$result = $client->multiCall($session, array(
- array('somestuff.method'),
- array('somestuff.method', 'arg1'),
- array('somestuff.method', array('arg1', 'arg2'))
-));
-
-
-// If you don't need the session anymore
-$client->endSession($session);
- To use XML-RPC, load the following URL into your XML-RPC client:
- -http://magentohost/api/xmlrpc/-
where magentohost is the domain for your Magento host.
- -The following PHP example shows how to make XML-RPC calls:
- -$client = new Zend_XmlRpc_Client('http://magentohost/api/xmlrpc/');
-
-// If somestuff requires API authentication,
-// we should get session token
-$session = $client->call('login', array('apiUser', 'apiKey'));
-
-$client->call('call', array($session, 'somestuff.method', array('arg1', 'arg2', 'arg3')));
-$client->call('call', array($session, 'somestuff.method', array('arg1')));
-$client->call('call', array($session, 'somestuff.method'));
-$client->call('multiCall', array($session,
- array(
- array('somestuff.method', 'arg1'),
- array('somestuff.method', array('arg1', 'arg2')),
- array('somestuff.method')
- )
-));
-
-// If you don't need the session anymore
-$client->call('endSession', array($session));
- The XML-RPC only supports the version 1 of the Magento API.
- -The following table contains the API methods that can be called from your SOAP or XML-RPC client on the Magento v1 API.
- - - -| Method | -Description | -Return Value | -
|---|---|---|
| startSession() | -Start the API session and return session ID. | -string | -
| endSession(sessionId) | -End the API session. | -boolean | -
| login(apiUser, apiKey) | -Start the API session, return the session ID, and authorize the API user. | -string | -
| call(sessionId, resourcePath,array arguments) | -Call the API resource that is allowed in the current session. See Note below. | -mixed | -
| multiCall(sessionId, array calls,array options) | -Call the API resource’s methods that are allowed for current session. See Notes below. | -array | -
| resources(sessionId) | -Return a list of available API resources and methods allowed for the current session. | -array | -
| globalFaults(sessionId) | -Return a list of fault messages and their codes that do not depend on any resource. | -array | -
| resourceFaults(sessionId, resourceName) | -Return a list of the specified resource fault messages, if this resource is allowed in the current session. | -array | -
Note: For call and multiCall, if no session is specified, you can call only resources that are not protected by ACL.
- -Note: For multiCall, if the "break" option is specified, multiCall breaks on first error.
- -The Magento SOAP API v2 does not support the call() and multiCall() methods, and instead provides a separate method for each API resource.
- -The following table contains fault codes that apply to all SOAP/XML-RPC API calls.
- -| Fault Code | -Fault Message | -
|---|---|
| 0 | -Unknown Error | -
| 1 | -Internal Error. Please see log for details. | -
| 2 | -Access denied. | -
| 3 | -Invalid API path. | -
| 4 | -Resource path is not callable. | -
Since Magento 1.3, version v2 of the SOAP API has also been available. The main difference between v1 and v2 is that instead of using methods call and multiCall, it has separate methods for each action.
- -For example, consider the following PHP code using SOAP v1.
-$params = array(array(
- 'status'=>array('eq'=>'pending'),
- 'customer_is_guest'=>array('eq'=>'1'))
-));
-$result = $client->call($sessionId, 'sales_order.list', $params);
- With SOAP v2, the following code would be equivalent.
-$params = array('filter' => array(
- array('key' => 'status', 'value' => 'pending'),
- array('key' => 'customer_is_guest', 'value' => '1')
-));
-$result = $client->salesOrderList($sessionId, $params);
- Note that the WSDL for SOAP v1 and SOAP v2 are different. Note that in SOAP v1, customizing the API did not involve changing the WSDL. In SOAP v2, changes to the WSDL are required.
- -You can configure the SOAP v2 API to be WS-I compliant in the system configuration menu. To do this, set Services > Magento Core API > WS-I Compliance to Yes.
- -Note that the WSDL for the SOAP v2 API is different when in WS-I compliant mode.
- -Using the WS-I compliant SOAP v2 API WSDL, it is easy to automatically generate client classes for Java, .NET, and other languages using standard libraries.
- - - diff --git a/guides/m1x/api/soap/miscellaneous/magento.info.html b/guides/m1x/api/soap/miscellaneous/magento.info.html deleted file mode 100644 index c5585033ea..0000000000 --- a/guides/m1x/api/soap/miscellaneous/magento.info.html +++ /dev/null @@ -1,118 +0,0 @@ ---- -layout: m1x_soap -title: Magento Info ---- - -Allows you to get information about the current Magento installation.
- -Aliases: magento
- - -Allows you to retrieve information about Magento version and edition.
- -Aliases: magento.info
- -Arguments:
- -| Type |
- Name |
- Description |
-
|---|---|---|
| string |
- sessionId |
-Session ID | -
Returns:
- -| Type |
- Name |
- Description |
-
|---|---|---|
| string | -magento_version | -Magento version | -
| string | -magento_edition | -Magento edition (Community, Professional, Enterprise) | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$magentoInfo = $proxy->call(
- $sessionId,
- 'magento.info'
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->magentoInfo($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->magentoInfo((object)array('sessionId' => $sessionId->result));
-
-var_dump($result->result);
- array - 'magento_edition' => string 'Community' (length=9) - 'magento_version' => string '1.4.2.0-rc1' (length=11)-
The following APIs allow you to access additional Magento information.
- -Allows you to retrieve information on the store view.
- -Resource Name: Store
- -Allows you to get information about the current Magento installation.
- -Resource Name: core_magento
- -Aliases: magento
- - -Allows you to retrieve information about the required store view.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -storeId | -Store view ID or code (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of storeEntity | -
The storeEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - store_id |
-Store view ID | -
| string | - code |
-Store view code | -
| int | - website_id |
-Website ID | -
| int | - group_id |
-Group ID | -
| string | - name |
-Store name | -
| int | - sort_order |
-Store view sort order | -
| int | - is_active |
-Defines whether the store is active | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 101 | -Requested store view not found. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'store.info', '2');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->storeInfo($sessionId, '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->storeInfo((object)array('sessionId' => $sessionId->result, 'storeId' => '2'));
-
-var_dump($result->result);
- array - 'store_id' => string '2' (length=1) - 'code' => string 'english' (length=7) - 'website_id' => string '2' (length=1) - 'group_id' => string '2' (length=1) - 'name' => string 'English' (length=7) - 'sort_order' => string '0' (length=1) - 'is_active' => string '1' (length=1)-
Allows you to retrieve the list of store views.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of storeEntity | -
The storeEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - store_id |
-Store view ID | -
| string | - code |
-Store view code | -
| int | - website_id |
-Website ID | -
| int | - group_id |
-Group ID | -
| string | - name |
-Store view name | -
| int | - sort_order |
-Store view sort order | -
| int | - is_active |
-Defines whether the store is active | -
Faults:
-No Faults
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'store.list');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->storeList($sessionId);
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->storeList((object)array('sessionId' => $sessionId->result));
-
-var_dump($result->result);
- array - 0 => - array - 'store_id' => string '1' (length=1) - 'code' => string 'default' (length=7) - 'website_id' => string '1' (length=1) - 'group_id' => string '1' (length=1) - 'name' => string 'Default Store View' (length=18) - 'sort_order' => string '0' (length=1) - 'is_active' => string '1' (length=1) - 1 => - array - 'store_id' => string '2' (length=1) - 'code' => string 'english' (length=7) - 'website_id' => string '2' (length=1) - 'group_id' => string '2' (length=1) - 'name' => string 'English' (length=7) - 'sort_order' => string '0' (length=1) - 'is_active' => string '1' (length=1)-
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
- -Allows you to manage orders.
- -Resource Name: sales_order
- -Aliases:
-Methods:
-Allows you to manage invoices.
- -Resource Name: sales_order_invoice
- -Aliases:
-Methods:
-Allows you to manage shipments and tracking numbers.
- -Resource Name: sales_order_shipment
- -Aliases:
-Methods:
-Allows you to manage order credit memos.
- -Resource Name: sales_order_creditmemo
- -Aliases:
-The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
- -Allows you to manage orders.
- -Resource Name: sales_order
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested order not exists. | -
| 101 | -Invalid filters given. Details in error message. | -
| 102 | -Invalid data given. Details in error message. | -
| 103 | -Order status not changed. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-// Getting list of orders created by John Doe
-var_dump($proxy->call($sessionId, 'sales_order.list', array(array('customer_firstname'=>array('eq'=>'John'), 'customer_lastname'=>array('eq'=>'Doe')))));
-
-
-// Get order info 100000003
-var_dump($proxy->call($sessionId, 'sales_order.info', '100000003'));
-
-
-// Hold order 100000003
-$proxy->call($sessionId, 'sales_order.hold', '100000003');
-
-// Unhold order 100000003
-$proxy->call($sessionId, 'sales_order.unhold', '100000003');
-
-// Hold order and add comment 100000003
-$proxy->call($sessionId, 'sales_order.addComment', array('100000003', 'holded', 'You order is holded', true));
-
-// Unhold order and add comment 100000003
-$proxy->call($sessionId, 'sales_order.addComment', array('100000003', 'pending', 'You order is pending', true));
-
-// Get order info 100000003
-var_dump($proxy->call($sessionId, 'sales_order.info', '100000003'));
- Aliases:
-Allows you to add a new comment to the order.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - orderIncrementId |
-Order increment ID | -
| string | - status |
-Order status (pending, processing, etc.) | -
| string | - comment |
-Order comment (optional) | -
| string | - notify |
-Notification flag (optional) | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the comment is added to the order | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order.addComment', array('orderIncrementId' => '200000004', 'status' => 'processing'));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderAddComment($sessionId, '200000004', 'processing');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderAddComment((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000004', 'status' => 'processing', 'comment' => 'comment to the order', 'notify' => null));
-var_dump($result->result);
- Aliases:
-Allows you to cancel the required order.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - orderIncrementId |
-Order increment ID | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the order is canceled | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order.cancel', '200000004');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderCancel($sessionId, '200000004');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderCancel((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000004'));
-var_dump($result->result);
- Aliases:
-Allows you to place the required order on hold.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - orderIncrementId |
-Order increment ID | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the order is placed on hold | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order.hold', '200000006');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderHold($sessionId, '200000006');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderHold((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
-var_dump($result->result);
- Aliases:
-Allows you to retrieve the required order information.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - orderIncrementId |
-Order increment ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of salesOrderEntity | -
The salesOrderEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- store_id |
-Store ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- is_active |
-Defines whether the order is active | -
| string |
- customer_id |
-Customer ID | -
| string |
- tax_amount |
-Tax amount | -
| string |
- shipping_amount |
-Shipping amount | -
| string |
- discount_amount |
-Discount amount | -
| string |
- subtotal |
-Subtotal sum | -
| string |
- grand_total |
-Grand total sum | -
| string |
- total_paid |
-Total paid | -
| string |
- total_refunded |
-Total refunded | -
| string |
- total_qty_ordered |
-Total quantity ordered | -
| string |
- total_canceled |
-Total canceled | -
| string |
- total_invoiced |
-Total invoiced | -
| string |
- total_online_refunded |
-Total online refunded | -
| string |
- total_offline_refunded |
-Total offline refunded | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- base_shipping_amount |
-Base shipping amount | -
| string |
- base_discount_amount |
-Base discount amount | -
| string |
- base_subtotal |
-Base subtotal | -
| string |
- base_grand_total |
-Base grand total | -
| string |
- base_total_paid |
-Base total paid | -
| string |
- base_total_refunded |
-Base total refunded | -
| string |
- base_total_qty_ordered |
-Base total quantity ordered | -
| string |
- base_total_canceled |
-Base total canceled | -
| string |
- base_total_invoiced |
-Base total invoiced | -
| string |
- base_total_online_refunded |
-Base total online refunded | -
| string |
- base_total_offline_refunded |
-Base total offline refunded | -
| string |
- billing_address_id |
-Billing address ID | -
| string |
- billing_firstname |
-First name in the billing address | -
| string |
- billing_lastname |
-Last name in the billing address | -
| string |
- shipping_address_id |
-Shipping address ID | -
| string |
- shipping_firstname |
-First name in the shipping address | -
| string |
- shipping_lastname |
-Last name in the shipping address | -
| string |
- billing_name |
-Billing name | -
| string |
- shipping_name |
-Shipping name | -
| string |
- store_to_base_rate |
-Store to base rate | -
| string |
- store_to_order_rate |
-Store to order rate | -
| string |
- base_to_global_rate |
-Base to global rate | -
| string |
- base_to_order_rate |
-Base to order rate | -
| string |
- weight |
-Weight | -
| string |
- store_name |
-Store name | -
| string |
- remote_ip |
-Remote IP | -
| string |
- status |
-Order status | -
| string |
- state |
-Order state | -
| string |
- applied_rule_ids |
-Applied rule IDs | -
| string |
- global_currency_code |
-Global currency code | -
| string |
- base_currency_code |
-Base currency code | -
| string |
- store_currency_code |
-Store currency code | -
| string |
- order_currency_code |
-Order currency code | -
| string |
- shipping_method |
-Shipping method | -
| string |
- shipping_description |
-Shipping description | -
| string |
- customer_email |
-Email address of the customer | -
| string |
- customer_firstname |
-Customer first name | -
| string |
- customer_lastname |
-Customer last name | -
| string |
- quote_id |
-Shopping cart ID | -
| string |
- is_virtual |
-Defines whether the product is a virtual one | -
| string |
- customer_group_id |
-Customer group ID | -
| string |
- customer_note_notify |
-Customer notification | -
| string |
- customer_is_guest |
-Defines whether the customer is a guest | -
| string |
- email_sent |
-Defines whether the email notification is sent | -
| string |
- order_id |
-Order ID | -
| string |
- gift_message_id |
-Gift message ID | -
| string |
- gift_message |
-Gift message | -
| array | - shipping_address |
-Array of salesOrderAddressEntity | -
| array | - billing_address |
-Array of salesOrderAddressEntity | -
| array | - items |
-Array of salesOrderItemEntity | -
| array | - payment |
-Array of salesOrderPaymentEntity | -
| array | - status_history |
-Array of salesOrderStatusHistoryEntity | -
The salesOrderAddressEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- is_active |
-Defines whether the address is active | -
| string |
- address_type |
-Address type | -
| string |
- firstname |
-First name | -
| string |
- lastname |
-Last name | -
| string |
- company |
-Company name | -
| string |
- street |
-Street name | -
| string |
- city |
-City | -
| string |
- region |
-Region | -
| string |
- postcode |
-Post code | -
| string |
- country_id |
-Country ID | -
| string |
- telephone |
-Telephone number | -
| string |
- fax |
-Fax number | -
| string |
- region_id |
-Region ID | -
| string |
- address_id |
-Address ID | -
The salesOrderItemEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - item_id |
-Item ID | -
| string |
- order_id |
-Order ID | -
| string |
- quote_item_id |
-Shopping cart item ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- product_id |
-Product ID | -
| string |
- product_type |
-Product type | -
| string |
- product_options |
-Product options | -
| string |
- weight |
-Weight | -
| string |
- is_virtual |
-Defines whether the product is a virtual one | -
| string |
- sku |
- Product SKU |
-
| string |
- name |
- Product name |
-
| string |
- applied_rule_ids |
-Applied rule IDs | -
| string |
- free_shipping |
-Defines whether free shipping is applied | -
| string |
- is_qty_decimal |
-Defines whether the items quantity is decimal | -
| string |
- no_discount |
-Defines whether no discount is applied | -
| string |
- qty_canceled |
-Items quantity canceled | -
| string |
- qty_invoiced |
-Items quantity invoiced | -
| string |
- qty_ordered |
-Items quantity ordered | -
| string |
- qty_refunded |
-Items quantity refunded | -
| string |
- qty_shipped |
-Items quantity shipped | -
| string |
- cost |
-Cost | -
| string |
- price |
-Price | -
| string |
- base_price |
-Base price | -
| string |
- original_price |
-Original price | -
| string |
- base_original_price |
-Base original price | -
| string |
- tax_percent |
-Tax percent | -
| string |
- tax_amount |
-Tax amount | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- tax_invoiced |
-Tax invoiced | -
| string |
- base_tax_invoiced |
-Base tax invoiced | -
| string |
- discount_percent |
-Discount percent | -
| string |
- discount_amount |
-Discount amount | -
| string |
- base_discount_amount |
-Base discount amount | -
| string |
- discount_invoiced |
-Discount invoiced | -
| string |
- base_discount_invoiced |
-Base discount invoiced | -
| string |
- amount_refunded |
-Amount refunded | -
| string |
- base_amount_refunded |
-Base amount refunded | -
| string |
- row_total |
-Row total | -
| string |
- base_row_total |
-Base row total | -
| string |
- row_invoiced |
-Row invoiced | -
| string |
- base_row_invoiced |
-Base row invoiced | -
| string |
- row_weight |
-Row weight | -
| string |
- gift_message_id |
-Gift message ID | -
| string |
- gift_message |
-Gift message | -
| string |
- gift_message_available |
-Defines whether the gift message is available | -
| string |
- base_tax_before_discount |
-Base tax before discount | -
| string |
- tax_before_discount |
-Tax before discount | -
| string |
- weee_tax_applied |
-Applied fixed product tax | -
| string |
- weee_tax_applied_amount |
-Applied fixed product tax amount | -
| string |
- weee_tax_applied_row_amount |
-Applied fixed product tax row amount | -
| string |
- base_weee_tax_applied_amount |
-Applied fixed product tax amount (in base currency) | -
| string |
- base_weee_tax_applied_row_amount |
-Applied fixed product tax row amount (in base currency) | -
| string |
- weee_tax_disposition |
-Fixed product tax disposition | -
| string |
- weee_tax_row_disposition |
-Fixed product tax row disposition | -
| string |
- base_weee_tax_disposition |
-Fixed product tax disposition (in base currency) | -
| string |
- base_weee_tax_row_disposition |
-Fixed product tax row disposition (in base currency) | -
The salesOrderPaymentEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- is_active |
-Active flag | -
| string |
- amount_ordered |
-Amount ordered | -
| string |
- shipping_amount |
-Shipping amount | -
| string |
- base_amount_ordered |
-Base amount ordered | -
| string |
- base_shipping_amount |
-Base shipping amount | -
| string |
- method |
-Payment method | -
| string |
- po_number |
-Purchase order number | -
| string |
- cc_type |
-Credit card type | -
| string |
- cc_number_enc |
-Credit card number | -
| string |
- cc_last4 |
-Credit card last 4 digits | -
| string |
- cc_owner |
-Credit card owner | -
| string |
- cc_exp_month |
-Credit card expiration month | -
| string |
- cc_exp_year |
-Credit card expiration year | -
| string |
- cc_ss_start_month |
-Credit card start month (Switch/Solo) | -
| string |
- cc_ss_start_year |
-Credit card start year (Switch/Solo) | -
| string |
- payment_id |
-Payment ID | -
The salesOrderStatusHistoryEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- is_active |
-Active flag | -
| string |
- is_customer_notified |
-Defines whether the customer is notified | -
| string |
- status |
-Order status | -
| string |
- comment |
-Order comment | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order.info', 'orderIncrementId');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderInfo($sessionId, '200000006');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderInfo((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
-var_dump($result->result);
- array - 'state' => string 'new' (length=3) - 'status' => string 'pending' (length=7) - 'coupon_code' => null - 'protect_code' => string 'defe18' (length=6) - 'shipping_description' => string 'Flat Rate - Fixed' (length=17) - 'is_virtual' => string '0' (length=1) - 'store_id' => string '2' (length=1) - 'customer_id' => string '2' (length=1) - 'base_discount_amount' => string '0.0000' (length=6) - 'base_discount_canceled' => null - 'base_discount_invoiced' => null - 'base_discount_refunded' => null - 'base_grand_total' => string '619.9700' (length=8) - 'base_shipping_amount' => string '10.0000' (length=7) - 'base_shipping_canceled' => null - 'base_shipping_invoiced' => null - 'base_shipping_refunded' => null - 'base_shipping_tax_amount' => string '0.0000' (length=6) - 'base_shipping_tax_refunded' => null - 'base_subtotal' => string '609.9700' (length=8) - 'base_subtotal_canceled' => null - 'base_subtotal_invoiced' => null - 'base_subtotal_refunded' => null - 'base_tax_amount' => string '0.0000' (length=6) - 'base_tax_canceled' => null - 'base_tax_invoiced' => null - 'base_tax_refunded' => null - 'base_to_global_rate' => string '1.0000' (length=6) - 'base_to_order_rate' => string '1.0000' (length=6) - 'base_total_canceled' => null - 'base_total_invoiced' => null - 'base_total_invoiced_cost' => null - 'base_total_offline_refunded' => null - 'base_total_online_refunded' => null - 'base_total_paid' => null - 'base_total_qty_ordered' => null - 'base_total_refunded' => null - 'discount_amount' => string '0.0000' (length=6) - 'discount_canceled' => null - 'discount_invoiced' => null - 'discount_refunded' => null - 'grand_total' => string '619.9700' (length=8) - 'shipping_amount' => string '10.0000' (length=7) - 'shipping_canceled' => null - 'shipping_invoiced' => null - 'shipping_refunded' => null - 'shipping_tax_amount' => string '0.0000' (length=6) - 'shipping_tax_refunded' => null - 'store_to_base_rate' => string '1.0000' (length=6) - 'store_to_order_rate' => string '1.0000' (length=6) - 'subtotal' => string '609.9700' (length=8) - 'subtotal_canceled' => null - 'subtotal_invoiced' => null - 'subtotal_refunded' => null - 'tax_amount' => string '0.0000' (length=6) - 'tax_canceled' => null - 'tax_invoiced' => null - 'tax_refunded' => null - 'total_canceled' => null - 'total_invoiced' => null - 'total_offline_refunded' => null - 'total_online_refunded' => null - 'total_paid' => null - 'total_qty_ordered' => string '2.0000' (length=6) - 'total_refunded' => null - 'can_ship_partially' => null - 'can_ship_partially_item' => null - 'customer_is_guest' => string '0' (length=1) - 'customer_note_notify' => string '1' (length=1) - 'billing_address_id' => string '1' (length=1) - 'customer_group_id' => string '1' (length=1) - 'edit_increment' => null - 'email_sent' => string '1' (length=1) - 'forced_shipment_with_invoice' => null - 'payment_auth_expiration' => null - 'quote_address_id' => null - 'quote_id' => string '1' (length=1) - 'shipping_address_id' => string '2' (length=1) - 'adjustment_negative' => null - 'adjustment_positive' => null - 'base_adjustment_negative' => null - 'base_adjustment_positive' => null - 'base_shipping_discount_amount' => string '0.0000' (length=6) - 'base_subtotal_incl_tax' => string '609.9700' (length=8) - 'base_total_due' => null - 'payment_authorization_amount' => null - 'shipping_discount_amount' => string '0.0000' (length=6) - 'subtotal_incl_tax' => string '609.9700' (length=8) - 'total_due' => null - 'weight' => string '1.2000' (length=6) - 'customer_dob' => null - 'increment_id' => string '200000001' (length=9) - 'applied_rule_ids' => null - 'base_currency_code' => string 'USD' (length=3) - 'customer_email' => string 'john@example.com' (length=16) - 'customer_firstname' => string 'johny' (length=5) - 'customer_lastname' => string 'doe' (length=3) - 'customer_middlename' => null - 'customer_prefix' => null - 'customer_suffix' => null - 'customer_taxvat' => null - 'discount_description' => null - 'ext_customer_id' => null - 'ext_order_id' => null - 'global_currency_code' => string 'USD' (length=3) - 'hold_before_state' => null - 'hold_before_status' => null - 'order_currency_code' => string 'USD' (length=3) - 'original_increment_id' => null - 'relation_child_id' => null - 'relation_child_real_id' => null - 'relation_parent_id' => null - 'relation_parent_real_id' => null - 'remote_ip' => string '127.0.0.1' (length=9) - 'shipping_method' => string 'flatrate_flatrate' (length=17) - 'store_currency_code' => string 'USD' (length=3) - 'store_name' => string 'website -English store -English' (length=29) - 'x_forwarded_for' => null - 'customer_note' => null - 'created_at' => string '2012-03-30 11:40:30' (length=19) - 'updated_at' => string '2012-03-30 11:40:32' (length=19) - 'total_item_count' => string '2' (length=1) - 'customer_gender' => null - 'hidden_tax_amount' => string '0.0000' (length=6) - 'base_hidden_tax_amount' => string '0.0000' (length=6) - 'shipping_hidden_tax_amount' => string '0.0000' (length=6) - 'base_shipping_hidden_tax_amnt' => string '0.0000' (length=6) - 'hidden_tax_invoiced' => null - more elements...-
Aliases:
-Allows you to retrieve the list of orders. Additional filters can be applied.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| array | -filters | -Array of filters for the list of sales orders (optional) | -
Returns:
- -| Type | -name | -Description | -
|---|---|---|
| array | -result | -Array of salesOrderEntity | -
The salesOrderEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- store_id |
-Store ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- is_active |
-Defines whether the order is active | -
| string |
- customer_id |
-Customer ID | -
| string |
- tax_amount |
-Tax amount | -
| string |
- shipping_amount |
-Shipping amount | -
| string |
- discount_amount |
-Discount amount | -
| string |
- subtotal |
-Subtotal sum | -
| string |
- grand_total |
-Grand total sum | -
| string |
- total_paid |
-Total paid | -
| string |
- total_refunded |
-Total refunded | -
| string |
- total_qty_ordered |
-Total quantity ordered | -
| string |
- total_canceled |
-Total canceled | -
| string |
- total_invoiced |
-Total invoiced | -
| string |
- total_online_refunded |
-Total online refunded | -
| string |
- total_offline_refunded |
-Total offline refunded | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- base_shipping_amount |
-Base shipping amount | -
| string |
- base_discount_amount |
-Base discount amount | -
| string |
- base_subtotal |
-Base subtotal | -
| string |
- base_grand_total |
-Base grand total | -
| string |
- base_total_paid |
-Base total paid | -
| string |
- base_total_refunded |
-Base total refunded | -
| string |
- base_total_qty_ordered |
-Base total quantity ordered | -
| string |
- base_total_canceled |
-Base total canceled | -
| string |
- base_total_invoiced |
-Base total invoiced | -
| string |
- base_total_online_refunded |
-Base total online refunded | -
| string |
- base_total_offline_refunded |
-Base total offline refunded | -
| string |
- billing_address_id |
-Billing address ID | -
| string |
- billing_firstname |
-First name in the billing address | -
| string |
- billing_lastname |
-Last name in the billing address | -
| string |
- shipping_address_id |
-Shipping address ID | -
| string |
- shipping_firstname |
-First name in the shipping address | -
| string |
- shipping_lastname |
-Last name in the shipping address | -
| string |
- billing_name |
-Billing name | -
| string |
- shipping_name |
-Shipping name | -
| string |
- store_to_base_rate |
-Store to base rate | -
| string |
- store_to_order_rate |
-Store to order rate | -
| string |
- base_to_global_rate |
-Base to global rate | -
| string |
- base_to_order_rate |
-Base to order rate | -
| string |
- weight |
-Weight | -
| string |
- store_name |
-Store name | -
| string |
- remote_ip |
-Remote IP | -
| string |
- status |
-Order status | -
| string |
- state |
-Order state | -
| string |
- applied_rule_ids |
-Applied rule IDs | -
| string |
- global_currency_code |
-Global currency code | -
| string |
- base_currency_code |
-Base currency code | -
| string |
- store_currency_code |
-Store currency code | -
| string |
- order_currency_code |
-Order currency code | -
| string |
- shipping_method |
-Shipping method | -
| string |
- shipping_description |
-Shipping description | -
| string |
- customer_email |
-Email address of the customer | -
| string |
- customer_firstname |
-Customer first name | -
| string |
- customer_lastname |
-Customer last name | -
| string |
- quote_id |
-Shopping cart ID | -
| string |
- is_virtual |
-Defines whether the product is a virtual one | -
| string |
- customer_group_id |
-Customer group ID | -
| string |
- customer_note_notify |
-Customer notification | -
| string |
- customer_is_guest |
-Defines whether the customer is a guest | -
| string |
- email_sent |
-Defines whether the email notification is sent | -
| string |
- order_id |
-Order ID | -
| string |
- gift_message_id |
-Gift message ID | -
| string |
- gift_message |
-Gift message | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'order.list');
-var_dump ($result);
- $params = array(array(
- 'filter' => array(
- array(
- 'key' => 'status',
- 'value' => 'pending'
- ),
- array(
- 'key' => 'created_at',
- 'value' => '2001-11-25 12:12:07',
- )
- ),
- 'complex_filter' => array(
- array(
- 'key' => 'order_id',
- 'value' => array(
- 'key' => 'in',
- 'value' => '12,23'
- ),
- ),
- array(
- 'key' => 'protect_code',
- 'value' => array(
- 'key' => 'eq',
- 'value' => 'ebb2a0'
- ),
- ),
- )
- ));
-
-$result = $client->__call('salesOrderList', $params);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$filter = array('filter' => array(array('key' => 'status', 'value' => 'closed')));
-$result = $client->salesOrderList($session, $filter);
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderList((object)array('sessionId' => $sessionId->result, 'filters' => null));
-var_dump($result->result);
- <?xml version="1.0" encoding="UTF-8"?> -<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" - xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" - SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> - <SOAP-ENV:Body> - <ns1:salesOrderList> - <sessionId xsi:type="xsd:string">abbc417256a3ffb93d130a77a2fd3665</sessionId> - <filters xsi:type="ns1:filters"> - <filter SOAP-ENC:arrayType="ns1:associativeEntity[2]" xsi:type="ns1:associativeArray"> - <item xsi:type="ns1:associativeEntity"> - <key xsi:type="xsd:string">status</key> - <value xsi:type="xsd:string">pending</value> - </item> - <item xsi:type="ns1:associativeEntity"> - <key xsi:type="xsd:string">created_at</key> - <value xsi:type="xsd:string">2011-11-29 15:41:11</value> - </item> - </filter> - <complex_filter SOAP-ENC:arrayType="ns1:complexFilter[2]" xsi:type="ns1:complexFilterArray"> - <item xsi:type="ns1:complexFilter"> - <key xsi:type="xsd:string">order_id</key> - <value xsi:type="ns1:associativeEntity"> - <key xsi:type="xsd:string">in</key> - <value xsi:type="xsd:string">Array</value> - </value> - </item> - <item xsi:type="ns1:complexFilter"> - <key xsi:type="xsd:string">protect_code</key> - <value xsi:type="ns1:associativeEntity"> - <key xsi:type="xsd:string">in</key> - <value xsi:type="xsd:string">a4ffa8</value> - </value> - </item> - </complex_filter> - </filters> - </ns1:salesOrderList> - </SOAP-ENV:Body> -</SOAP-ENV:Envelope>-
Aliases:
-Allows you to unhold the required order.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - orderIncrementId |
-Order increment ID | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the order is unheld | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order.unhold', '200000006');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$result = $proxy->salesOrderUnhold($sessionId, '200000006');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderUnhold((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
-var_dump($result->result);
- Allows you to operate with credit memos for orders.
- - -Aliases: order_creditmemo
- -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested credit memo does not exist. | -
| 101 | -Invalid filter given. Details in error message. | -
| 102 | -Invalid data given. Details in error message. | -
| 103 | -Requested order does not exist. | -
| 104 | -Credit memo status not changed. | -
| 105 | -Money can not be refunded to the store credit account as order was created by guest. | -
| 106 | -Credit memo for requested order can not be created. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-// Create creditmemo
-$orderIncrementId = '100000683'; //increment id of the invoiced order
-$data = array(
- 'qtys' => array(
- '712' => 1
- ),
- 'shipping_amount' => 3,
- 'adjustment_positive' => 0.7,
- 'adjustment_negative' => 0.06
-);
-$creditmemoIncrementId = $proxy->call($sessionId, 'order_creditmemo.create', array($orderIncrementId, $data));
-echo $creditmemoIncrementId . "<br />";
-
-// Add comment to created creditmemo
-$commentText = "Credit memo comment successfully added";
-$isCommentAdded = $proxy->call($sessionId, 'order_creditmemo.addComment', array($creditmemoIncrementId, $commentText, true));
-
-// Retrieve information about created creditmemo
-$creditmemoInfo = $proxy->call($sessionId, 'order_creditmemo.info', array($creditmemoIncrementId));
-print_r($creditmemoInfo);
-
-// Retrieve list of creditmemos by filter
-$filter = array(
- 'increment_id' => array(
- 'or' => array(
- array(
- 'from' => '100000617',
- 'to' => '100000619',
- ),
- array(
- 'from' => $creditmemoIncrementId,
- 'to' => NULL,
- )
- )
- )
-);
-$creditmemoList = $proxy->call($sessionId, 'order_creditmemo.list', array($filter));
-print_r($creditmemoList);
- Aliases: order_creditmemo
- -Allows you to add a new comment to an existing credit memo. Email notification can be sent to the user email.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | -creditmemoIncrementId | -Credit memo increment ID | -
| string | -comment | -Comment text (optional) | -
| int | -notifyCustomer | -Notify customer by email flag (optional) | -
| int | -includeComment | -Include comment text into the email notification (optional) | -
Return:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the comment is added to the credit memo | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested credit memo does not exist. | -
| 102 | -Invalid data given. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$creditmemoIncrementId = '200000001'; //increment id of existing credit memo
-$commentText = "Credit memo comment successfully added";
-
-$isCommentAdded = $proxy->call($sessionId, 'order_creditmemo.addComment', array($creditmemoIncrementId, $commentText, true));
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderCreditmemoAddComment($sessionId, '200000001');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderCreditmemoAddComment((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000001', 'comment' => 'credit memo comment', 'notifyCustomer' => 1, 'includeComment' => 1));
-var_dump($result->result);
- Allows you to cancel an existing credit memo.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -creditmemoIncrementId | -Credit memo increment ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -result | -Result of canceling the credit memo | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested credit memo does not exist. | -
| 104 | -Credit memo status not changed. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$creditmemoIncrementId = '100000637'; //increment id of existing credit memo
-
-$isCreditMemoCanceled = $proxy->call($sessionId, 'order_creditmemo.cancel', array($creditmemoIncrementId));
- Allows you to create a new credit memo for the invoiced order. Comments can be added and an email notification can be sent to the user email.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -orderIncrementId | -Order increment ID | -
| array | -creditmemoData | -Array of salesOrderCreditmemoData (optional) | -
| string | -comment | -Comment text (optional) | -
| int | -notifyCustomer | -Notify customer by email flag (optional) | -
| int | -includeComment | -Include comment text into an email notification (optional) | -
| string | -refundToStoreCreditAmount | -Payment amount to be refunded to the customer store credit (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -result | -Created credit memo increment ID | -
The salesOrderCreditmemoData content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| array | - qtys |
-Array of orderItemIdQty | -
| double | - shipping_amount |
- Refund shipping amount (optional) |
-
| double | - adjustment_positive |
- Adjustment refund amount (optional) |
-
| double | - adjustment_negative |
- Adjustment fee amount (optional) |
-
The orderItemIdQty content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - order_item_id |
-Order item ID to be refunded | -
| double | - qty |
-Items quantity to be refunded | -
Faults:
- - -| Fault Code | -Fault Message | -
|---|---|
| 102 | -Invalid data given. Details in error message. | -
| 103 | -Requested order does not exist. | -
| 105 | -Money can not be refunded to the store credit account as order was created by guest. | -
| 106 | -Credit memo for requested order can not be created. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'order_creditmemo.create', '200000010');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderCreditmemoCreate($sessionId, '200000010');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderCreditmemoCreate((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000010',
-'creditmemoData' => array(
-'qtys' => array(
-'order_item_id' => 3,
-'qty' => '1'),
-'shipping_amount' => null,
-'adjustment_positive' => '0',
-'adjustment_negative' => null),
-'comment' => 'comment for credit memo',
-'notifyCustomer' => null,
-'includeComment' => 1,
-'refundToStoreCreditAmount' => '1'
-));
-var_dump($result->result);
- Allows you to retrieve full information about the specified credit memo.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -creditmemoIncrementId | -Credit memo increment ID | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of salesOrderCreditmemoEntity | -
The salesOrderCreditmemoEntity content is as follows:
- - - -| Type | -Name | -Description | -
|---|---|---|
| string | -updated_at | -Date of updating | -
| string |
- created_at |
-Date of creation | -
| string |
- increment_id |
-Increment ID | -
| string |
- transaction_id |
-Transaction ID | -
| string |
- global_currency_code |
-Global currency code | -
| string |
- base_currency_code |
-Base currency code | -
| string |
- order_currency_code |
-Order currency code | -
| string |
- store_currency_code |
-Store currency code | -
| string |
- cybersource_token |
-Cybersource token | -
| string |
- invoice_id |
-ID of the invoice for which the credit memo was created | -
| string |
- billing_address_id |
-Billing address ID | -
| string |
- shipping_address_id |
-Shipping address ID | -
| string |
- state |
-State | -
| string |
- creditmemo_status |
-Credit memo status | -
| string |
- email_sent |
-Defines whether the email is sent | -
| string |
- order_id |
-ID of the order for which the credit memo was created | -
| string |
- tax_amount |
-Tax amount | -
| string |
- shipping_tax_amount |
-Shipping tax amount | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- base_adjustment_positive |
- Adjustment refund amount (using base currency) |
-
| string |
- base_grand_total |
-Base grand total | -
| string |
- adjustment |
-Adjustment | -
| string |
- subtotal |
-Subtotal | -
| string |
- discount_amount |
-Discount amount | -
| string |
- base_subtotal |
-Base subtotal | -
| string |
- base_adjustment |
-Base adjustment | -
| string |
- base_to_global_rate |
-Base to global rate | -
| string |
- store_to_base_rate |
-Store to base rate | -
| string |
- base_shipping_amount |
-Base shipping amount | -
| string |
- adjustment_negative |
- Adjustment fee amount |
-
| string |
- subtotal_incl_tax |
-Subtotal including tax | -
| string |
- shipping_amount |
-Shipping amount | -
| string |
- base_subtotal_incl_tax |
-Base subtotal including tax | -
| string |
- base_adjustment_negative |
- Adjustment fee amount (using base currency) |
-
| string |
- grand_total |
-Grand total | -
| string |
- base_discount_amount |
-Base discount amount | -
| string |
- base_to_order_rate |
-Base to order rate | -
| string |
- store_to_order_rate |
-Store to order rate | -
| string |
- base_shipping_tax_amount |
-Base shipping tax amount | -
| string |
- adjustment_positive |
- Adjustment refund amount |
-
| string |
- store_id |
-Store ID | -
| string |
- hidden_tax_amount |
-Hidden tax amount | -
| string |
- base_hidden_tax_amount |
-Base hidden tax amount | -
| string |
- shipping_hidden_tax_amount |
-Shipping hidden tax amount | -
| string |
- base_shipping_hidden_tax_amnt |
-Base shipping hidden tax amount | -
| string |
- shipping_incl_tax |
-Shipping including tax | -
| string |
- base_shipping_incl_tax |
-Base shipping including tax | -
| string |
- base_customer_balance_amount |
-Base customer balance amount | -
| string |
- customer_balance_amount |
-Customer balance amount | -
| string |
- bs_customer_bal_total_refunded |
- Refunded base customer balance amount |
-
| string |
- customer_bal_total_refunded |
-Customer balance total refunded | -
| string |
- base_gift_cards_amount |
-Base gift cards amount | -
| string |
- gift_cards_amount |
-Gift cards amount | -
| string |
- gw_base_price |
- Gift wrapping price refunded amount (using base currency) |
-
| string |
- gw_price |
- Gift wrapping price refunded amount |
-
| string |
- gw_items_base_price |
-Gift wrapping items base price | -
| string |
- gw_items_price |
-Gift wrapping items price | -
| string |
- gw_card_base_price |
-Gift wrapping card base price | -
| string |
- gw_card_price |
-Gift wrapping card price | -
| string |
- gw_base_tax_amount |
- Gift wrapping tax amount refunded (using base currency) |
-
| string |
- gw_tax_amount |
- Gift wrapping tax amount refunded |
-
| string |
- gw_items_base_tax_amount |
-Gift wrapping items base tax amount | -
| string |
- gw_items_tax_amount |
-Gift wrapping items tax amount | -
| string |
- gw_card_base_tax_amount |
-Gift wrapping card base tax amount | -
| string |
- gw_card_tax_amount |
-Gift wrapping card tax amount | -
| string |
- base_reward_currency_amount |
-Base reward currency amount | -
| string |
- reward_currency_amount |
-Reward currency amount | -
| string |
- reward_points_balance |
-Reward points balance | -
| string |
- reward_points_balance_refund |
-Reward points balance refund | -
| string |
- creditmemo_id |
-Credit memo ID | -
| array | - items |
-Array of salesOrderCreditmemoItemEntity | -
| array | - comments |
-Array of salesOrderCreditmemoCommentEntity | -
The salesOrderCreditmemoItemEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -item_id | -Credit memo item ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- weee_tax_applied_row_amount |
-Applied fixed product tax row amount | -
| string |
- base_price |
-Base price | -
| string |
- base_weee_tax_row_disposition |
-Fixed product tax row disposition (in base currency) | -
| string |
- tax_amount |
-Tax amount | -
| string |
- base_weee_tax_applied_amount |
- Applied fixed product tax amount (in base currency) |
-
| string |
- weee_tax_row_disposition |
- Fixed product tax row disposition |
-
| string |
- base_row_total |
-Base row total | -
| string |
- discount_amount |
-Discount amount | -
| string |
- row_total |
-Row total | -
| string |
- weee_tax_applied_amount |
- Applied fixed product tax amount |
-
| string |
- base_discount_amount |
-Base discount amount | -
| string |
- base_weee_tax_disposition |
- Fixed product tax disposition (in base currency) |
-
| string |
- price_incl_tax |
-Price including tax | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- weee_tax_disposition |
- Fixed product tax disposition |
-
| string |
- base_price_incl_tax |
-Base price including tax | -
| string |
- qty |
-Quantity | -
| string |
- base_cost |
-Base cost | -
| string |
- base_weee_tax_applied_row_amount |
- Applied fixed product tax row amount (in base currency) |
-
| string |
- price |
-Price | -
| string |
- base_row_total_incl_tax |
-Base row total including tax | -
| string |
- row_total_incl_tax |
-Row total including tax | -
| string |
- product_id |
-Product ID | -
| string |
- order_item_id |
-Order item ID | -
| string |
- additional_data |
-Additional data | -
| string |
- description |
-Description | -
| string |
- weee_tax_applied |
- Applied fixed product tax |
-
| string |
- sku |
-Item SKU | -
| string |
- name |
-Name | -
| string |
- hidden_tax_amount |
-Hidden tax amount | -
| string |
- base_hidden_tax_amount |
-Base hidden tax amount | -
The salesOrderCreditmemoCommentEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - parent_id |
-Parent ID | -
| string |
- created_at |
-Date of creation | -
| string |
- comment |
-Comment data | -
| string |
- is_customer_notified |
-Defines whether the customer is notified | -
| string |
- comment_id |
-Comment ID | -
| string |
- is_visible_on_front |
-Defines whether the comment is visible on the frontend | -
Faults:
- -| Fault Code | -Fault Description | -
|---|---|
| 100 | -Requested credit memo does not exist. | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'order_creditmemo.info', '200000001');
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderCreditmemoInfo($sessionId, '200000001');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderCreditmemoInfo((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000001'));
-var_dump($result->result);
- array(
- 'store_id' => '1',
- 'adjustment_positive' => NULL,
- 'base_shipping_tax_amount' => '0.0000',
- 'store_to_order_rate' => '1.0000',
- 'base_discount_amount' => '0.0000',
- 'base_to_order_rate' => '1.0000',
- 'grand_total' => '90.0000',
- 'base_adjustment_negative' => NULL,
- 'base_subtotal_incl_tax' => '75.0000',
- 'shipping_amount' => '15.0000',
- 'subtotal_incl_tax' => '75.0000',
- 'adjustment_negative' => NULL,
- 'base_shipping_amount' => '15.0000',
- 'store_to_base_rate' => '1.0000',
- 'base_to_global_rate' => '1.0000',
- 'base_adjustment' => '0.0000',
- 'base_subtotal' => '75.0000',
- 'discount_amount' => '0.0000',
- 'subtotal' => '75.0000',
- 'adjustment' => '0.0000',
- 'base_grand_total' => '90.0000',
- 'base_adjustment_positive' => NULL,
- 'base_tax_amount' => '0.0000',
- 'shipping_tax_amount' => '0.0000',
- 'tax_amount' => '0.0000',
- 'order_id' => '744',
- 'email_sent' => NULL,
- 'creditmemo_status' => NULL,
- 'state' => '2',
- 'shipping_address_id' => '1488',
- 'billing_address_id' => '1487',
- 'invoice_id' => NULL,
- 'cybersource_token' => NULL,
- 'store_currency_code' => 'USD',
- 'order_currency_code' => 'USD',
- 'base_currency_code' => 'USD',
- 'global_currency_code' => 'USD',
- 'transaction_id' => NULL,
- 'increment_id' => '100000684',
- 'created_at' => '2011-05-27 10:53:03',
- 'updated_at' => '2011-05-27 10:53:03',
- 'hidden_tax_amount' => '0.0000',
- 'base_hidden_tax_amount' => '0.0000',
- 'shipping_hidden_tax_amount' => NULL,
- 'base_shipping_hidden_tax_amnt' => NULL,
- 'shipping_incl_tax' => '15.0000',
- 'base_shipping_incl_tax' => '15.0000',
- 'base_customer_balance_amount' => NULL,
- 'customer_balance_amount' => NULL,
- 'bs_customer_bal_total_refunded' => '0.0000',
- 'customer_bal_total_refunded' => '0.0000',
- 'base_gift_cards_amount' => NULL,
- 'gift_cards_amount' => NULL,
- 'gw_base_price' => NULL,
- 'gw_price' => NULL,
- 'gw_items_base_price' => NULL,
- 'gw_items_price' => NULL,
- 'gw_card_base_price' => NULL,
- 'gw_card_price' => NULL,
- 'gw_base_tax_amount' => NULL,
- 'gw_tax_amount' => NULL,
- 'gw_items_base_tax_amount' => NULL,
- 'gw_items_tax_amount' => NULL,
- 'gw_card_base_tax_amount' => NULL,
- 'gw_card_tax_amount' => NULL,
- 'base_reward_currency_amount' => NULL,
- 'reward_currency_amount' => NULL,
- 'reward_points_balance' => NULL,
- 'reward_points_balance_refund' => NULL,
- 'base_customer_balance_total_refunded' => '0.0000',
- 'customer_balance_total_refunded' => '0.0000',
- 'gw_printed_card_base_price' => NULL,
- 'gw_printed_card_price' => NULL,
- 'gw_printed_card_base_tax_amount' => NULL,
- 'gw_printed_card_tax_amount' => NULL,
- 'reward_points_balance_to_refund' => NULL,
- 'creditmemo_id' => '684',
- 'order_increment_id' => '100000744',
- 'items' => array(
- 0 => array(
- 'parent_id' => '684',
- 'weee_tax_applied_row_amount' => '0.0000',
- 'base_price' => '55.0000',
- 'base_weee_tax_row_disposition' => '0.0000',
- 'tax_amount' => '0.0000',
- 'base_weee_tax_applied_amount' => '0.0000',
- 'weee_tax_row_disposition' => '0.0000',
- 'base_row_total' => '55.0000',
- 'discount_amount' => NULL,
- 'row_total' => '55.0000',
- 'weee_tax_applied_amount' => '0.0000',
- 'base_discount_amount' => NULL,
- 'base_weee_tax_disposition' => '0.0000',
- 'price_incl_tax' => '55.0000',
- 'base_tax_amount' => '0.0000',
- 'weee_tax_disposition' => '0.0000',
- 'base_price_incl_tax' => '55.0000',
- 'qty' => '1.0000',
- 'base_cost' => NULL,
- 'base_weee_tax_applied_row_amnt' => NULL,
- 'price' => '55.0000',
- 'base_row_total_incl_tax' => '55.0000',
- 'row_total_incl_tax' => '55.0000',
- 'product_id' => '20',
- 'order_item_id' => '775',
- 'additional_data' => NULL,
- 'description' => NULL,
- 'weee_tax_applied' => 'a:0:{}',
- 'sku' => 'test_product_sku',
- 'name' => 'Test Product',
- 'hidden_tax_amount' => '0.0000',
- 'base_hidden_tax_amount' => '0.0000',
- 'item_id' => '708'
- ),
- 1 => array(
- 'parent_id' => '684',
- 'weee_tax_applied_row_amount' => '0.0000',
- 'base_price' => '10.0000',
- 'base_weee_tax_row_disposition' => '0.0000',
- 'tax_amount' => '0.0000',
- 'base_weee_tax_applied_amount' => '0.0000',
- 'weee_tax_row_disposition' => '0.0000',
- 'base_row_total' => '20.0000',
- 'discount_amount' => NULL,
- 'row_total' => '20.0000',
- 'weee_tax_applied_amount' => '0.0000',
- 'base_discount_amount' => NULL,
- 'base_weee_tax_disposition' => '0.0000',
- 'price_incl_tax' => '10.0000',
- 'base_tax_amount' => '0.0000',
- 'weee_tax_disposition' => '0.0000',
- 'base_price_incl_tax' => '10.0000',
- 'qty' => '2.0000',
- 'base_cost' => NULL,
- 'base_weee_tax_applied_row_amnt' => NULL,
- 'price' => '10.0000',
- 'base_row_total_incl_tax' => '20.0000',
- 'row_total_incl_tax' => '20.0000',
- 'product_id' => '21',
- 'order_item_id' => '776',
- 'additional_data' => NULL,
- 'description' => NULL,
- 'weee_tax_applied' => 'a:0:{}',
- 'sku' => 'test_product_sku_2',
- 'name' => 'Test 2',
- 'hidden_tax_amount' => '0.0000',
- 'base_hidden_tax_amount' => '0.0000',
- 'item_id' => '709'
- )
- ),
- 'comments' => array(
- 0 => array(
- 'parent_id' => '684',
- 'is_customer_notified' => '0',
- 'is_visible_on_front' => '0',
- 'comment' => 'Test CreditMemo successfully created',
- 'created_at' => '2011-05-27 10:53:03',
- 'comment_id' => '118'
- ),
- 1 => array(
- 'parent_id' => '684',
- 'is_customer_notified' => '0',
- 'is_visible_on_front' => '0',
- 'comment' => 'Test CreditMemo comment successfully added',
- 'created_at' => '2011-05-27 10:53:03',
- 'comment_id' => '119'
- )
- )
-);
- Allows you to retrieve the list of credit memos by filters.
- -Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| associative array | -filters | -Filters (optional) | -
Return:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of salesOrderCreditmemoEntity | -
The salesOrderCreditmemoEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -updated_at | -Date of updating | -
| string |
- created_at |
-Date of creation | -
| string |
- increment_id |
-Increment ID | -
| string |
- transaction_id |
-Transaction ID | -
| string |
- global_currency_code |
-Global currency code | -
| string |
- base_currency_code |
-Base currency code | -
| string |
- order_currency_code |
-Order currency code | -
| string |
- store_currency_code |
-Store currency code | -
| string |
- cybersource_token |
-Cybersource token | -
| string |
- invoice_id |
-ID of the invoice for which the credit memo was created | -
| string |
- billing_address_id |
-Billing address ID | -
| string |
- shipping_address_id |
-Shipping address ID | -
| string |
- state |
-State | -
| string |
- creditmemo_status |
-Credit memo status | -
| string |
- email_sent |
-Defines whether the email is sent | -
| string |
- order_id |
-ID of the order for which the credit memo was created | -
| string |
- tax_amount |
-Tax amount | -
| string |
- shipping_tax_amount |
-Shipping tax amount | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- base_adjustment_positive |
- Adjustment refund amount (using base currency) |
-
| string |
- base_grand_total |
-Base grand total | -
| string |
- adjustment |
-Adjustment | -
| string |
- subtotal |
-Subtotal | -
| string |
- discount_amount |
-Discount amount | -
| string |
- base_subtotal |
-Base subtotal | -
| string |
- base_adjustment |
-Base adjustment | -
| string |
- base_to_global_rate |
-Base to global rate | -
| string |
- store_to_base_rate |
-Store to base rate | -
| string |
- base_shipping_amount |
-Base shipping amount | -
| string |
- adjustment_negative |
- Adjustment fee amount |
-
| string |
- subtotal_incl_tax |
-Subtotal including tax | -
| string |
- shipping_amount |
-Shipping amount | -
| string |
- base_subtotal_incl_tax |
-Base subtotal including tax | -
| string |
- base_adjustment_negative |
- Adjustment fee amount (using base currency) |
-
| string |
- grand_total |
-Grand total | -
| string |
- base_discount_amount |
-Base discount amount | -
| string |
- base_to_order_rate |
-Base to order rate | -
| string |
- store_to_order_rate |
-Store to order rate | -
| string |
- base_shipping_tax_amount |
-Base shipping tax amount | -
| string |
- adjustment_positive |
- Adjustment refund amount |
-
| string |
- store_id |
-Store ID | -
| string |
- hidden_tax_amount |
-Hidden tax amount | -
| string |
- base_hidden_tax_amount |
-Base hidden tax amount | -
| string |
- shipping_hidden_tax_amount |
-Shipping hidden tax amount | -
| string |
- base_shipping_hidden_tax_amnt |
-Base shipping hidden tax amount | -
| string |
- shipping_incl_tax |
-Shipping including tax | -
| string |
- base_shipping_incl_tax |
-Base shipping including tax | -
| string |
- base_customer_balance_amount |
-Base customer balance amount | -
| string |
- customer_balance_amount |
-Customer balance amount | -
| string |
- bs_customer_bal_total_refunded |
- Refunded base customer balance amount |
-
| string |
- customer_bal_total_refunded |
-Customer balance total refunded | -
| string |
- base_gift_cards_amount |
-Base gift cards amount | -
| string |
- gift_cards_amount |
-Gift cards amount | -
| string |
- gw_base_price |
- Gift wrapping price refunded amount (using base currency) |
-
| string |
- gw_price |
- Gift wrapping price refunded amount |
-
| string |
- gw_items_base_price |
-Gift wrapping items base price | -
| string |
- gw_items_price |
-Gift wrapping items price | -
| string |
- gw_card_base_price |
-Gift wrapping card base price | -
| string |
- gw_card_price |
-Gift wrapping card price | -
| string |
- gw_base_tax_amount |
- Gift wrapping tax amount refunded (using base currency) |
-
| string |
- gw_tax_amount |
- Gift wrapping tax amount refunded |
-
| string |
- gw_items_base_tax_amount |
-Gift wrapping items base tax amount | -
| string |
- gw_items_tax_amount |
-Gift wrapping items tax amount | -
| string |
- gw_card_base_tax_amount |
-Gift wrapping card base tax amount | -
| string |
- gw_card_tax_amount |
-Gift wrapping card tax amount | -
| string |
- base_reward_currency_amount |
-Base reward currency amount | -
| string |
- reward_currency_amount |
-Reward currency amount | -
| string |
- reward_points_balance |
-Reward points balance | -
| string |
- reward_points_balance_refund |
-Reward points balance refund | -
| string |
- creditmemo_id |
-Credit memo ID | -
| array | - items |
-Array of salesOrderCreditmemoItemEntity | -
| array | - comments |
-Array of salesOrderCreditmemoCommentEntity | -
The salesOrderCreditmemoItemEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -item_id | -Credit memo item ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- weee_tax_applied_row_amount |
- Applied fixed product tax row amount |
-
| string |
- base_price |
-Base price | -
| string |
- base_weee_tax_row_disposition |
- Fixed product tax row disposition (in base currency) |
-
| string |
- tax_amount |
-Tax amount | -
| string |
- base_weee_tax_applied_amount |
- Applied fixed product tax amount (in base currency) |
-
| string |
- weee_tax_row_disposition |
- Fixed product tax row disposition |
-
| string |
- base_row_total |
-Base row total | -
| string |
- discount_amount |
-Discount amount | -
| string |
- row_total |
-Row total | -
| string |
- weee_tax_applied_amount |
- Applied fixed product tax amount |
-
| string |
- base_discount_amount |
-Base discount amount | -
| string |
- base_weee_tax_disposition |
- Fixed product tax disposition (in base currency) |
-
| string |
- price_incl_tax |
-Price including tax | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- weee_tax_disposition |
- Fixed product tax disposition |
-
| string |
- base_price_incl_tax |
-Base price including tax | -
| string |
- qty |
-Quantity | -
| string |
- base_cost |
-Base cost | -
| string |
- base_weee_tax_applied_row_amount |
- Applied fixed product tax row amount (in base currency) |
-
| string |
- price |
-Price | -
| string |
- base_row_total_incl_tax |
-Base row total including tax | -
| string |
- row_total_incl_tax |
-Row total including tax | -
| string |
- product_id |
-Product ID | -
| string |
- order_item_id |
-Order item ID | -
| string |
- additional_data |
-Additional data | -
| string |
- description |
-Description | -
| string |
- weee_tax_applied |
- Applied fixed product tax |
-
| string |
- sku |
-Item SKU | -
| string |
- name |
-Name | -
| string |
- hidden_tax_amount |
-Hidden tax amount | -
| string |
- base_hidden_tax_amount |
-Base hidden tax amount | -
The salesOrderCreditmemoCommentEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - parent_id |
-Parent ID | -
| string |
- created_at |
-Date of creation | -
| string |
- comment |
-Comment data | -
| string |
- is_customer_notified |
-Defines whether the customer is notified | -
| string |
- comment_id |
-Comment ID | -
| string |
- is_visible_on_front |
-Defines whether the comment is visible on the frontend | -
Faults:
- -| Fault Code | -Fault Description | -
|---|---|
| 101 | -Invalid filter given. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-$filter = array(
- 'order_id' => array(
- 'or' => array(
- array(
- 'from' => '673',
- 'to' => '674',
- ),
- array(
- 'from' => '677',
- 'to' => NULL,
- )
- )
- ),
- 'increment_id' => array(
- 'or' => array(
- array(
- 'from' => '100000617',
- 'to' => '100000619',
- ),
- array(
- 'from' => '100000619',
- 'to' => NULL,
- )
- )
- )
-);
-$creditmemoList = $proxy->call($sessionId, 'order_creditmemo.list', array($filter));
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderCreditmemoList($sessionId, '200000001');
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$complexFilter = array(
- 'complex_filter' => array(
- array(
- 'key' => 'state',
- 'value' => array('key' => 'in', 'value' => '2,3')
- )
- )
-);
-$result = $client->salesOrderCreditmemoList($session, $complexFilter);
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderCreditmemoList((object)array('sessionId' => $sessionId->result));
-var_dump($result->result);
- array( - 0 => array( - 'store_id' => '1', - 'adjustment_positive' => NULL, - 'base_shipping_tax_amount' => '0.0000', - 'store_to_order_rate' => '1.0000', - 'base_discount_amount' => '0.0000', - 'base_to_order_rate' => '1.0000', - 'grand_total' => '60.0000', - 'base_adjustment_negative' => NULL, - 'base_subtotal_incl_tax' => '55.0000', - 'shipping_amount' => '5.0000', - 'subtotal_incl_tax' => '55.0000', - 'adjustment_negative' => NULL, - 'base_shipping_amount' => '5.0000', - 'store_to_base_rate' => '1.0000', - 'base_to_global_rate' => '1.0000', - 'base_adjustment' => '0.0000', - 'base_subtotal' => '55.0000', - 'discount_amount' => '0.0000', - 'subtotal' => '55.0000', - 'adjustment' => '0.0000', - 'base_grand_total' => '60.0000', - 'base_adjustment_positive' => NULL, - 'base_tax_amount' => '0.0000', - 'shipping_tax_amount' => '0.0000', - 'tax_amount' => '0.0000', - 'order_id' => '674', - 'email_sent' => NULL, - 'creditmemo_status' => NULL, - 'state' => '2', - 'shipping_address_id' => '1348', - 'billing_address_id' => '1347', - 'invoice_id' => NULL, - 'cybersource_token' => NULL, - 'store_currency_code' => 'USD', - 'order_currency_code' => 'USD', - 'base_currency_code' => 'USD', - 'global_currency_code' => 'USD', - 'transaction_id' => NULL, - 'increment_id' => '100000617', - 'created_at' => '2011-05-26 10:49:45', - 'updated_at' => '2011-05-26 10:49:45', - 'hidden_tax_amount' => '0.0000', - 'base_hidden_tax_amount' => '0.0000', - 'shipping_hidden_tax_amount' => NULL, - 'base_shipping_hidden_tax_amnt' => NULL, - 'shipping_incl_tax' => '5.0000', - 'base_shipping_incl_tax' => '5.0000', - 'base_customer_balance_amount' => NULL, - 'customer_balance_amount' => NULL, - 'bs_customer_bal_total_refunded' => '0.0000', - 'customer_bal_total_refunded' => '0.0000', - 'base_gift_cards_amount' => NULL, - 'gift_cards_amount' => NULL, - 'gw_base_price' => NULL, - 'gw_price' => NULL, - 'gw_items_base_price' => NULL, - 'gw_items_price' => NULL, - 'gw_card_base_price' => NULL, - 'gw_card_price' => NULL, - 'gw_base_tax_amount' => NULL, - 'gw_tax_amount' => NULL, - 'gw_items_base_tax_amount' => NULL, - 'gw_items_tax_amount' => NULL, - 'gw_card_base_tax_amount' => NULL, - 'gw_card_tax_amount' => NULL, - 'base_reward_currency_amount' => NULL, - 'reward_currency_amount' => NULL, - 'reward_points_balance' => NULL, - 'reward_points_balance_refund' => NULL, - 'creditmemo_id' => '617', - ), - 1 => array( - 'store_id' => '1', - 'adjustment_positive' => NULL, - ....................................... - 'creditmemo_id' => '620', - ) -);-
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
- -Allows you to manage invoices.
- -Resource Name: sales_order_invoice
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested shipment does not exists. | -
| 101 | -Invalid filters given. Details in error message. | -
| 102 | -Invalid data given. Details in error message. | -
| 103 | -Requested order does not exists | -
| 104 | -Invoice status not changed. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$notInvoicedOrderId = '100000003';
-
-// Create new invoice
-$newInvoiceId = $proxy->call($sessionId, 'sales_order_invoice.create', array($notInvoicedOrderId, array(), 'Invoice Created', true, true));
-
-// View new invoice
-$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
-
-var_dump($invoice);
-
-// Add Comment
-$proxy->call($sessionId, 'sales_order_invoice.addComment', array($newInvoiceId, 'Invoice comment, some text', true, false));
-
-// View invoice with new comment
-$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
-
-var_dump($invoice);
-
-$proxy->call($sessionId, 'sales_order_invoice.capture', $newInvoiceId);
-
-// View captured invoice
-$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
-var_dump($invoice);
- Aliases:
-Allows you to add a new comment to the order invoice.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- invoiceIncrementId |
-Invoice increment ID | -
| string |
- comment |
-Invoice comment (optional) | -
| int |
- email |
-Send invoice on email flag (optional) | -
| int |
- includeComment |
-Include comment in email flag (optional) | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the comment is added to the invoice | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apikey');
-
-$result = $client->call($session, 'sales_order_invoice.addComment', array('invoiceIncrementId' => '200000006', 'comment' => 'invoice comment'));
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderInvoiceAddComment($sessionId, '200000006');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderInvoiceAddComment((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '200000006', 'comment' => 'invoice comment', 'email' => null, 'includeComment' => null));
-var_dump($result->result);
- Aliases:
-Allows you to cancel the required invoice. Note that not all order invoices can be canceled. Only some payment methods support canceling the order invoice (e.g., Google Checkout, PayPal Pro, PayPal Express Checkout).
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - invoiceIncrementId |
-Invoice increment ID | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean | -True if the order invoice is canceled. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$invoiceIncrementId = '100000013';
-
-$result = $proxy->call(
- $session,
- 'sales_order_invoice.cancel',
- $invoiceIncrementId
-);
- Aliases:
-Allows you to capture the required invoice. Note that not all order invoices can be captured. Only some payment methods support capturing the order invoice (e.g., PayPal Pro).
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - invoiceIncrementId |
-Invoice increment ID | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the order invoice is captured. | -
Notes:
- -You should check the invoice to see if it can be captured before attempting to capture the invoice. Otherwise, the API call will generate an error.
- -Invoices have states as defined in the model Mage_Sales_Model_Order_Invoice:
-Also note that there is a method call in the model that checks this for you - canCapture(). And it also verifies that the payment can be captured, so the invoice state might not be the only condition that is required to allow it to be captured.
- -$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$orderIncrementId = '100000016';
-
-//Create invoice for order
-$invoiceIncrementId = $proxy->call(
- $session,
- 'sales_order_invoice.create',
- array(
- 'orderIncrementId' => $orderIncrementId,
- array('order_item_id' => '15', 'qty' => '1')
- )
-);
-
-//Capture invoice amount
-$result = $proxy->call(
- $session,
- 'sales_order_invoice.capture',
- $invoiceIncrementId
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionID = $proxy->login('apiUser', 'apiKey');
-
-$orderIncrementId = '100000016';
-
-//Create invoice for order
-$qty = array(
-Â Â Â array('order_item_id' => '15', 'qty' => '1')
-);
-$invoiceIncrementId = $proxy->salesOrderInvoiceCreate(
- $sessionID,
- $orderIncrementId,
- Â $qty);
-
-//Capture invoice amount
-$result = $proxy->salesOrderInvoiceCapture(
- $sessionID,
- $invoiceIncrementId
-);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderInvoiceCapture((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '100000016'));
-
-var_dump($result->result);
- Aliases:
-Allows you to create a new invoice for an order.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- invoiceIncrementId |
-Order increment ID | -
| array | - itemsQty |
-Array of orderItemIdQty (quantity of items to invoice) | -
| string |
- comment |
-Invoice comment (optional) | -
| string |
- email |
-Send invoice on email (optional) | -
| string |
- includeComment |
-Include comments in email (optional) | -
Returns:
- -| Type | -Description | -
|---|---|
| string | -ID of the created invoice | -
The orderItemIdQty content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - order_item_id |
-Order item ID | -
| double | - qty |
-Quantity | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call(
- $session,
- 'sales_order_invoice.create',
- array('orderIncrementId' => '200000008', array('15' => '1', '16' => '1'))
- // orderItemIdQty Array is Keyed with Order Item ID, with Value of qty to invoice
-);
-var_dump ($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-//Create invoice for order
-
-// orderItemIdQty Array is Keyed with Order Item ID, with Value of qty to invoice
-$qty = array('15' => '1', '16' => '1');
-
-$invoiceIncrementId = $proxy->salesOrderInvoiceCreate(
- $sessionID,
- '200000008',
- Â $qty
-);
-var_dump($invoiceIncrementId);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderInvoiceCreate((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000008', 'itemsQty' => array('15' => '1', '16' => '1'), 'comment' => null,
-'email' => null,
-'includeComment' => null
-));
-var_dump($result->result);
- Aliases:
-Allows you to retrieve information about the required invoice.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | -invoiceIncrementId | -Invoice increment ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | - Array of salesOrderInvoiceEntity |
-
The salesOrderInvoiceEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- store_id |
-Store ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- is_active |
-Defines whether the invoice is active | -
| string |
- global_currency_code |
-Global currency code | -
| string |
- base_currency_code |
-Base currency code | -
| string |
- store_currency_code |
-Store currency code | -
| string |
- order_currency_code |
-Order currency code | -
| string |
- store_to_base_rate |
-Store to base rate | -
| string |
- store_to_order_rate |
-Store to order rate | -
| string |
- base_to_global_rate |
-Base to global rate | -
| string |
- base_to_order_rate |
-Base to order rate | -
| string |
- subtotal |
-Subtotal | -
| string |
- base_subtotal |
-Base subtotal | -
| string |
- base_grand_total |
-Base grand total | -
| string |
- discount_amount |
-Discount amount | -
| string |
- base_discount_amount |
-Base discount amount | -
| string |
- shipping_amount |
-Shipping amount | -
| string |
- base_shipping_amount |
-Base shipping amount | -
| string |
- tax_amount |
-Tax amount | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- billing_address_id |
-Billing address ID | -
| string |
- billing_firstname |
-First name in the billing address | -
| string |
- billing_lastname |
-Last name in the billing address | -
| string |
- order_id |
-Order ID | -
| string |
- order_increment_id |
-Order increment ID | -
| string |
- order_created_at |
-Date of order creation | -
| string |
- state |
-Order state | -
| string |
- grand_total |
-Grand total | -
| string |
- invoice_id |
-Invoice ID | -
| array | - items |
-Array of salesOrderInvoiceItemEntity | -
| array | - comments |
-Array of salesOrderInvoiceCommentEntity | -
The salesOrderInvoiceItemEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- is_active |
-Active flag | -
| string |
- weee_tax_applied |
-Applied fixed product tax | -
| string |
- qty |
-Quantity | -
| string |
- cost |
-Cost | -
| string |
- price |
-Price | -
| string |
- tax_amount |
-Tax amount | -
| string |
- row_total |
-Row total | -
| string |
- base_price |
-Base price | -
| string |
- base_tax_amount |
-Base tax amount | -
| string |
- base_row_total |
-Base row total | -
| string |
- base_weee_tax_applied_amount |
-Applied fixed product tax amount (in base currency) | -
| string |
- base_weee_tax_applied_row_amount |
-Applied fixed product tax row amount (in base currency) | -
| string |
- weee_tax_applied_amount |
-Applied fixed product tax amount | -
| string |
- weee_tax_applied_row_amount |
-Applied fixed product tax row amount | -
| string |
- weee_tax_disposition |
-Fixed product tax disposition | -
| string |
- weee_tax_row_disposition |
-Fixed product tax row disposition | -
| string |
- base_weee_tax_disposition |
-Fixed product tax disposition (in base currency) | -
| string |
- base_weee_tax_row_disposition |
-Fixed product tax row disposition (in base currency) | -
| string |
- sku |
-SKU | -
| string |
- name |
-Name | -
| string |
- order_item_id |
-Order item ID | -
| string |
- product_id |
-Product ID | -
| string |
- item_id |
-Item ID | -
The salesOrderInvoiceCommentEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- parent_id |
-Parent ID | -
| string |
- created_at |
-Date of creation | -
| string |
- updated_at |
-Date of updating | -
| string |
- is_active |
-Active flag | -
| string |
- comment |
-Invoice comment | -
| string |
- is_customer_notified |
-Defines whether the customer is notified | -
| string |
- comment_id |
-Comment ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order_invoice.info', '200000006');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderInvoiceInfo($sessionId, '200000006');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderInvoiceInfo((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '200000006'));
-var_dump($result->result);
- array
- 'store_id' => string '2' (length=1)
- 'base_grand_total' => string '384.9800' (length=8)
- 'shipping_tax_amount' => string '0.0000' (length=6)
- 'tax_amount' => string '0.0000' (length=6)
- 'base_tax_amount' => string '0.0000' (length=6)
- 'store_to_order_rate' => string '1.0000' (length=6)
- 'base_shipping_tax_amount' => string '0.0000' (length=6)
- 'base_discount_amount' => string '0.0000' (length=6)
- 'base_to_order_rate' => string '1.0000' (length=6)
- 'grand_total' => string '384.9800' (length=8)
- 'shipping_amount' => string '5.0000' (length=6)
- 'subtotal_incl_tax' => string '379.9800' (length=8)
- 'base_subtotal_incl_tax' => string '379.9800' (length=8)
- 'store_to_base_rate' => string '1.0000' (length=6)
- 'base_shipping_amount' => string '5.0000' (length=6)
- 'total_qty' => string '1.0000' (length=6)
- 'base_to_global_rate' => string '1.0000' (length=6)
- 'subtotal' => string '379.9800' (length=8)
- 'base_subtotal' => string '379.9800' (length=8)
- 'discount_amount' => string '0.0000' (length=6)
- 'billing_address_id' => string '3' (length=1)
- 'is_used_for_refund' => null
- 'order_id' => string '2' (length=1)
- 'email_sent' => null
- 'can_void_flag' => string '0' (length=1)
- 'state' => string '2' (length=1)
- 'shipping_address_id' => string '4' (length=1)
- 'store_currency_code' => string 'USD' (length=3)
- 'transaction_id' => null
- 'order_currency_code' => string 'USD' (length=3)
- 'base_currency_code' => string 'USD' (length=3)
- 'global_currency_code' => string 'USD' (length=3)
- 'increment_id' => string '200000006' (length=9)
- 'created_at' => string '2012-03-30 12:02:19' (length=19)
- 'updated_at' => string '2012-03-30 12:02:19' (length=19)
- 'hidden_tax_amount' => string '0.0000' (length=6)
- 'base_hidden_tax_amount' => string '0.0000' (length=6)
- 'shipping_hidden_tax_amount' => string '0.0000' (length=6)
- 'base_shipping_hidden_tax_amnt' => null
- 'shipping_incl_tax' => string '5.0000' (length=6)
- 'base_shipping_incl_tax' => string '5.0000' (length=6)
- 'base_total_refunded' => null
- 'cybersource_token' => null
- 'invoice_id' => string '1' (length=1)
- 'order_increment_id' => string '200000002' (length=9)
- 'items' =>
- array
- 0 =>
- array
- 'parent_id' => string '1' (length=1)
- 'base_price' => string '379.9800' (length=8)
- 'tax_amount' => string '0.0000' (length=6)
- 'base_row_total' => string '379.9800' (length=8)
- 'discount_amount' => null
- 'row_total' => string '379.9800' (length=8)
- 'base_discount_amount' => null
- 'price_incl_tax' => string '379.9800' (length=8)
- 'base_tax_amount' => string '0.0000' (length=6)
- 'base_price_incl_tax' => string '379.9800' (length=8)
- 'qty' => string '1.0000' (length=6)
- 'base_cost' => null
- 'price' => string '379.9800' (length=8)
- 'base_row_total_incl_tax' => string '379.9800' (length=8)
- 'row_total_incl_tax' => string '379.9800' (length=8)
- 'product_id' => string '1' (length=1)
- 'order_item_id' => string '3' (length=1)
- 'additional_data' => null
- 'description' => null
- 'sku' => string 'n2610-slider' (length=12)
- 'name' => string 'Nokia 2610 Phone' (length=16)
- 'hidden_tax_amount' => string '0.0000' (length=6)
- 'base_hidden_tax_amount' => string '0.0000' (length=6)
- 'base_weee_tax_applied_amount' => string '0.0000' (length=6)
- 'base_weee_tax_applied_row_amnt' => string '0.0000' (length=6)
- 'base_weee_tax_applied_row_amount' => string '0.0000' (length=6)
- 'weee_tax_applied_amount' => string '0.0000' (length=6)
- 'weee_tax_applied_row_amount' => string '0.0000' (length=6)
- 'weee_tax_applied' => string 'a:0:{}' (length=6)
- 'weee_tax_disposition' => string '0.0000' (length=6)
- 'weee_tax_row_disposition' => string '0.0000' (length=6)
- 'base_weee_tax_disposition' => string '0.0000' (length=6)
- 'base_weee_tax_row_disposition' => string '0.0000' (length=6)
- 'item_id' => string '1' (length=1)
- 'comments' =>
- array
- empty
- Aliases:
-Allows you to retrieve the list of order invoices. Additional filters can also be applied.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| array | - filters |
-Array of filters for the list of invoices (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of salesOrderInvoiceEntity | -
The salesOrderInvoiceEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- created_at |
-Date of invoice creation | -
| string |
- order_currency_code |
-Order currency code (e.g., EUR) | -
| string |
- order_id |
-Order ID | -
| string |
- state |
-Order state | -
| string |
- grand_total |
-Grand total amount invoiced | -
| string |
- invoice_id |
-Invoice ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order_invoice.list');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderInvoiceList($sessionId);
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$complexFilter = array(
- 'complex_filter' => array(
- array(
- 'key' => 'state',
- 'value' => array('key' => 'in', 'value' => '2,3')
- )
- )
-);
-$result = $client->salesOrderInvoiceList($session, $complexFilter);
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderInvoiceList((object)array('sessionId' => $sessionId->result));
-var_dump($result->result);
- array - 0 => - array - 'order_id' => string '2' (length=1) - 'increment_id' => string '200000001' (length=9) - 'created_at' => string '2012-03-30 12:02:19' (length=19) - 'state' => string '2' (length=1) - 'grand_total' => string '384.9800' (length=8) - 'order_currency_code' => string 'USD' (length=3) - 'invoice_id' => null - 1 => - array - 'order_id' => string '3' (length=1) - 'increment_id' => string '200000002' (length=9) - 'created_at' => string '2012-03-30 12:06:20' (length=19) - 'state' => string '2' (length=1) - 'grand_total' => string '339.9900' (length=8) - 'order_currency_code' => string 'USD' (length=3) - 'invoice_id' => null-
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
- -Allows you to manage shipments and tracking numbers.
- -Resource Name: sales_order_shipment
- -Aliases:
-Methods:
-| Fault Code | -Fault Message | -
|---|---|
| 100 | -Requested shipment not exists. | -
| 101 | -Invalid filters given. Details in error message. | -
| 102 | -Invalid data given. Details in error message. | -
| 103 | -Requested order not exists. | -
| 104 | -Requested tracking not exists. | -
| 105 | -Tracking not deleted. Details in error message. | -
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$notShipedOrderId = '100000003';
-
-// Create new shipment
-$newShipmentId = $proxy->call($sessionId, 'sales_order_shipment.create', array($notShipedOrderId, array(), 'Shipment Created', true, true));
-
-// View new shipment
-$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);
-
-var_dump($shipment);
-
-
-// Get allowed carriers for shipping
-$allowedCarriers = $proxy->call($sessionId, 'sales_order_shipment.getCarriers', $notShipedOrderId);
-
-end($allowedCarriers);
-
-$choosenCarrier = key($allowedCarriers);
-
-var_dump($allowedCarriers);
-var_dump($choosenCarrier);
-
-// Add tracking
-$newTrackId = $proxy->call($sessionId, 'sales_order_shipment.addTrack', array($newShipmentId, $choosenCarrier, 'My Track', rand(5000, 9000)));
-
-$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);
-
-var_dump($shipment);
- Aliases:
-Allows you to add a new comment to the order shipment.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- shipmentIncrementId |
-Shipment increment ID | -
| string |
- comment |
-Shipment comment (optional) | -
| string |
- email |
-Send email flag (optional) | -
| string |
- includeInEmail |
-Include comment in email flag (optional) | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the comment is added to the order shipment | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order_shipment.addComment', array('shipmentIncrementId' => '200000002', 'comment' => 'comment for the shipment', 'email' => null));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderShipmentAddComment($sessionId, '200000002');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderShipmentAddComment((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'comment' => 'comment for the shipment', 'email' => null, 'includeInEmail' => null));
-var_dump($result->result);
- Aliases:
-Allows you to add a new tracking number to the order shipment.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string |
- shipmentIncrementId |
-Shipment increment ID | -
| string |
- carrier |
-Carrier code (ups, usps, dhl, fedex, or dhlint) | -
| string |
- title |
-Tracking title | -
| string |
- trackNumber |
-Tracking number | -
Returns:
- -| Type | -Description | -
|---|---|
| int | -Tracking number ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order_shipment.addTrack', array('shipmentIncrementId' => '200000002', 'carrier' => 'ups', 'title' => 'tracking title', 'trackNumber' => '123123'));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderShipmentAddTrack($sessionId, '200000002', 'ups', 'tracking title', '123123');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderShipmentAddTrack((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'carrier' => 'ups', 'title' => 'tracking title', 'trackNumber' => '123123'));
-var_dump($result->result);
- Aliases:
-Allows you to create a new shipment for an order.
- - -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - orderIncrementId |
-Order increment ID | -
| array | - itemsQty |
-Array of orderItemIdQty (optional) | -
| string | - comment |
-Shipment comment (optional) | -
| int | - email |
-Send email flag (optional) | -
| int | - includeComment |
-Include comment in email flag (optional) | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - shipmentIncrementId |
-Shipment increment ID | -
The orderItemIdQty content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| int | - order_item_id |
-Order item ID | -
| double | - qty |
-Quantity of items to be shipped | -
Notes: The array of orderItemQty is used for partial shipment. To create shipment for all order items, you do not need to specify these attributes.
- -$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-$session = $proxy->login('apiUser', 'apiKey');
-
-$orderIncrementId = '200000006';
-$orderItemId = 3;
-$qty = 5;
-$itemsQty = array(
- $orderItemId => $qty,
- );
-
-$result = $proxy->call(
- $session,
- 'order_shipment.create',
- array(
- $orderIncrementId,
- $itemsQty
- )
-);
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-$sessionId = $proxy->login('apiUser', 'apiKey');
-
-$itemsQty = array(
- array(
- 'order_item_id' => 3,
- 'qty' => 3
- ),
- array(
- 'order_item_id' => 4,
- 'qty' => 5
- ));
-
-$result = $proxy->salesOrderShipmentCreate($sessionId, '200000006', $itemsQty, 'shipment comment');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$itemsQty = array(
- array(
- 'order_item_id' => 3,
- 'qty' => 3
- ),
- array(
- 'order_item_id' => 4,
- 'qty' => 5
- ));
-
-$result = $proxy->salesOrderShipmentCreate((object)array(
- 'sessionId' => $sessionId->result,
- 'orderIncrementId' => '200000006',
- 'itemsQty' => $itemsQty,
- 'comment' => 'shipment comment',
- 'email' => null, 'includeComment' => null));
-
-var_dump($result->result);
- Aliases:
-Allows you to retrieve the list of allowed carriers for an order.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - orderIncrementId |
-Order increment ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| associativeArray | -result | -Array of carriers | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order_shipment.getCarriers', '200000010');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderShipmentGetCarriers($sessionId, '200000010');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderShipmentGetCarriers((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000010'));
-var_dump($result->result);
- array - 'custom' => string 'Custom Value' (length=12) - 'dhl' => string 'DHL (Deprecated)' (length=16) - 'fedex' => string 'Federal Express' (length=15) - 'ups' => string 'United Parcel Service' (length=21) - 'usps' => string 'United States Postal Service' (length=28) - 'dhlint' => string 'DHL' (length=3)-
Aliases:
-Allows you to retrieve the shipment information.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | -sessionId | -Session ID | -
| string | - shipmentIncrementId |
-Order shipment increment ID | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of salesOrderShipmentEntity | -
The salesOrderShipmentEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Shipment increment ID | -
| string |
- store_id |
-Store ID | -
| string |
- created_at |
-Date of shipment creation | -
| string |
- updated_at |
-Date of shipment updating | -
| string |
- shipping_address_id |
-Shipping address ID | -
| string |
- order_id |
-Order ID | -
| string |
- total_qty |
-Total quantity of items to ship | -
| string |
- shipment_id |
-Shipment ID | -
| array | - items |
-Array of salesOrderShipmentItemEntity | -
| array | - tracks |
-Array of salesOrderShipmentTrackEntity | -
| array | - comments |
-Array of salesOrderShipmentCommentEntity | -
The salesOrderShipmentItemEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string |
- parent_id |
-Parent ID | -
| string |
- sku |
-Shipment item SKU | -
| string |
- name |
-Shipment item name | -
| string |
- order_item_id |
-Order item ID | -
| string |
- product_id |
-Product ID | -
| string |
- weight |
-Weight | -
| string |
- price |
-Price | -
| string |
- qty |
-Quantity of items | -
| string |
- item_id |
-Item ID | -
The salesOrderShipmentTrackEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string |
- parent_id |
-Parent ID | -
| string |
- created_at |
-Date of tracking number creation | -
| string |
- updated_at |
-Date of tracking number updating | -
| string |
- carrier_code |
-Carrier code | -
| string |
- title |
-Track title | -
| string |
- number |
-Tracking number | -
| string |
- order_id |
-Order ID | -
| string |
- track_id |
-Track ID | -
The salesOrderShipmentCommentEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string |
- parent_id |
-Parent ID | -
| string |
- created_at |
-Date of comment creation | -
| string |
- comment |
-Shipment comment text | -
| string |
- is_customer_notified |
-Defines whether the customer is notified | -
| string |
- comment_id |
-Comment ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-$session = $client->login('apiUser', 'apiKey');
-$result = $client->call($session, 'sales_order_shipment.info', '200000003');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderShipmentInfo($sessionId, '200000003');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderShipmentInfo((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000003'));
-var_dump($result->result);
- Aliases:
-Allows you to retrieve the list of order shipments. Additional filters can be applied.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| array | - filters |
-Array of filters for the list of shipments | -
Returns:
- -| Type | -Name | -Description | -
|---|---|---|
| array | -result | -Array of salesOrderShipmentEntity | -
The salesOrderShipmentEntity content is as follows:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - increment_id |
-Increment ID | -
| string |
- created_at |
-Date of shipment creation | -
| string |
- total_qty |
-Total quantity of items to ship | -
| string |
- shipment_id |
-Shipment ID | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order_shipment.list');
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderShipmentList($sessionId);
-var_dump($result);
- $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-// If some stuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-$complexFilter = array(
- 'complex_filter' => array(
- array(
- 'key' => 'created_at',
- 'value' => array('key' => 'in', 'value' => '2012-03-30 12:54:46')
- )
- )
-);
-$result = $client->salesOrderShipmentList($session, $complexFilter);
-
-var_dump ($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderShipmentList((object)array('sessionId' => $sessionId->result));
-var_dump($result->result);
- array - 0 => - array - 'increment_id' => string '200000001' (length=9) - 'created_at' => string '2012-03-30 12:35:29' (length=19) - 'total_qty' => string '2.0000' (length=6) - 'shipment_id' => null - 1 => - array - 'increment_id' => string '200000002' (length=9) - 'created_at' => string '2012-03-30 12:54:46' (length=19) - 'total_qty' => string '1.0000' (length=6) - 'shipment_id' => null-
Aliases:
-Allows you to remove a tracking number from the order shipment.
- -Aliases:
-Arguments:
- -| Type | -Name | -Description | -
|---|---|---|
| string | - sessionId |
-Session ID | -
| string | - shipmentIncrementId |
-Shipment increment ID | -
| string | - trackId |
-Track ID | -
Returns:
- -| Type | -Description | -
|---|---|
| boolean\int | -True (1) if the tracking number is removed from the shipment | -
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
-
-// If somestuff requires API authentication,
-// then get a session token
-$session = $client->login('apiUser', 'apiKey');
-
-$result = $client->call($session, 'sales_order_shipment.removeTrack', array('shipmentIncrementId' => '200000002', 'trackId' => '2'));
-var_dump($result);
-
-// If you don't need the session anymore
-//$client->endSession($session);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
-$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
-
-$result = $proxy->salesOrderShipmentRemoveTrack($sessionId, '200000002', '2');
-var_dump($result);
- $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
-
-$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
-
-$result = $proxy->salesOrderShipmentRemoveTrack((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'trackId' => '2'));
-var_dump($result->result);
- Magento provides you with the ability to use two modes for SOAP API V2. These are with WS-I compliance mode enabled and WS-I compliance mode disabled. The first one was introduced to make the system flexible, namely, to increase compatibility with .NET and Java programming languages.
- -To enable/disable the WS-I compliance mode, perform the following steps:
-
The WS-I compliant mode uses the same WSDL endpoint as SOAP API V2 does. The key difference is that XML namespaces are used in WS-I compliance mode.
-
WSDL file with disabled WS-I compliance mode:
-
WSDL file with enabled WS-I compliance mode:
-
-{% include m1x/eol_message.html %}
-
-Welcome to the documentation home page for the Magento Enterprise Edition (EE) 1.13 and Community Edition (CE) 1.8 releases! Let's start out by telling you a little bit about them.
-Magento recognizes that merchants and systems integrators require higher performance in key areas—such as product search, product browsing, and checkout. Merchants and integrators are now commonly coming to Magento with:
-To address these ever-growing needs, Magento systematically examined performance and scalability characteristics. Our engineers continually measured performance on a range of environments and use cases to identify and remove bottlenecks, and then conducted extensive testing to confirm improvements.
-We characterized performance based on variations in deployment and business configurations to ensure improvement for a range of merchant sizes and configurations.
-In this release, we focused primarily on improvements to indexing, tax calculations, caching, and checkout performance.
-We're excited about the changes you'll find, including:
-
-{% include m1x/eol_message.html %}
-The focus of the Magento Enterprise Edition 1.13 release is performance and scalability. The benchmarking results - presented here demonstrate that we have addressed the following concerns:
- -We identified the following areas for enhancement in Magento Enterprise Edition 1.13:
- -Magento Enterprise Edition 1.13 delivers the following improvements over Magento Enterprise Edition 1.12:
- -Before we introduce you to the benchmarks, an overview of our multi-node benchmarking facility is in order. We - started with a basic multi-node cluster with load balancer and caching and separate DB node, and installed - Apache. This is a familiar hardware configuration for the Magento developer community. Once provisioned, we - installed both Magento Enterprise Edition 1.13 and Magento Enterprise Edition 1.12 on the cluster to compare - their performance.
- -This is a representation of the multi-node Magento Enterprise Edition 1.12/1.13 installation used for performance - testing. It consists of four physical nodes, three of which are virtualized.
- -
- We used HP ProLiant SL230s Gen8 servers with 8x16GB DDR3 and 2x Intel Xeon E5â€2660 CPUs for our benchmarking.
- -We used a physical disk of a usable 1.2 TB managed by a RAID10 controller. The load balancer we used is - nginx.
- -The cluster resides in our Las Vegas data center, connected to the Internet via a gigabit connection. We tested - the cluster using the popular Gatling suite from our engineering offices in Austin, TX.
- -
- This section presents the merchant scenarios we simulated for our testing. These scenarios are based on - real-world experience and industry standards with respect to shopper flows and catalog sizes.
- -We used real-world, established eCommerce metrics to simulate shopper flows.
- -
- The catalogs we simulated also reflect real-world, established eCommerce experience.
- -
- The simulated merchant profile we benchmarked against represents the profile of our enterprise customers. We - established these metrics based on the day-to-day experience of large merchants operating a successful eCommerce - business. Again, we used what we consider to be a typical hardware and software configuration.
- -These benchmarks were generated during extensive testing of our multi-node configuration running Magento - Enterprise Edition 1.13 described above. Our configuration was modeled after what a commercial hosting partner - would put into production, and the results reflect accurate gains over Magento Enterprise Edition 1.12.
- -The duration of the test sessions is 72 seconds, which significantly stresses the multi-node configuration.
- -In Magento Enterprise Edition 1.12, any change to a product would result in a full re-index. Magento Enterprise - Edition 1.13 introduces a new feature--incremental re-indexing. With incremental re-indexing, only those items - that were changed or added will be re-indexed, reducing the processing time to a fraction of what was required - before.
- -Take the example of a merchant with a catalog containing 500,000 products. In Magento Enterprise Edition 1.12, - any change to a product would result in a full re-index operation. In Magento Enterprise Edition 1.13, - incremental re-indexing means the merchant will only re-index items that were changed. The test focused on - measuring the improvements provided by the incremental re-indexing feature in Magento Enterprise Edition 1.13. - The table below compares improvements to common admin actions, such as changing a product description, prices or - inventory.
- -
- As part of the benchmarking effort, we also measured the improvements in the full re-indexing feature on Magento - Enterprise Edition 1.13, where indexing a 500,000-item catalog was 53% faster than Magento Enterprise Edition - 1.12. Faster re-indexing means less load on the system and that changes to the catalog propagate faster to the - storefront.
- -
- The Magento Enterprise Edition 1.13 indexer component contains a number of individual indexers such as Product - Flat Data and Product Price. When a Magento admin changes the price of a product, it is only necessary to - execute the Product Price indexer for pricing changes to propagate to the frontend. The completion times of - these individual indexers were measured in the benchmark environment for Magento Enterprise Edition 1.13 and - Magento Enterprise Edition 1.12.
- -This section presents the results for full re-index completion times for the individual indexers in Magento - Enterprise Edition 1.13 compared to Magento Enterprise Edition 1.12.
- -
- When Magento Enterprise Edition 1.12 and Magento Enterprise Edition 1.13 were compared, with both running on our - multi-node benchmarking configuration, Magento Enterprise Edition 1.13 loaded pages 65% faster than Magento - Enterprise Edition 1.12.
- -Guest checkout and registered user checkout are two flows that are crucial to storefront operation. This section - presents the results of page load time measurements for these two flows.
- -In the guest checkout flow pages, Magento Enterprise Edition 1.13 provides a substantial decrease in load times - over its predecessor, most of the time more than twice as fast.
- -
- The bar chart below presents the improvements in page load times for registered checkout flow.
- -
- In addition to page load times, the benchmark also focused on measuring throughput improvements, particularly - page views per day and orders per day.
- -During our testing, which simulated a storefront running at peak hours, EE 1.13 executed 33% more orders and 31% - more page views than Magento Enterprise Edition 1.12 on the multi-node benchmarking configuration. Notably, - Magento Enterprise Edition 1.13 served 47K pages during the test run (10 minutes).
- -
- What we noted during the benchmarking tests:
- -Magento Enterprise Edition 1.13 was engineered for performance--and clearly delivers on the goal as measured by - important metrics.
- -In addition, we have focused on providing these benefits without the need to upgrade existing hardware, improving - your return on assets and investment.
- -| Concurrent session (users) | -1000 | -
| Peak load duration | -10 minutes | -
| Session duration | -72 seconds | -
| CPU utilization | -95% | -
| - | ||||||||||||
| Magento EE v1.13 | -- | - | - | - | - | - | - | - | - | - | - | - |
| Requests | -- | Total | -OK | -KO | -- | Min | -Max | -Mean | -Std Dev | -95th Pct | -99th Pct | -Req/s | -
| Global Information0 | -- | 62161 | -62087 | -74 | -- | 80 | -12910 | -1735 | -1869 | -5780 | -8060 | -75 | -
| product page0 | -- | 28573 | -28573 | -0 | -- | 80 | -9390 | -709 | -996 | -2670 | -4920 | -34 | -
| Click add to cart1 | -- | 10458 | -10458 | -0 | -- | 440 | -7170 | -1868 | -1139 | -4010 | -4980 | -13 | -
| Click add to cart Redirect 12 | -- | 10458 | -10458 | -0 | -- | 960 | -12910 | -3816 | -2239 | -8050 | -9960 | -13 | -
| click checkout3 | -- | 3486 | -3486 | -0 | -- | 1100 | -10800 | -3459 | -1965 | -7130 | -8970 | -4 | -
| Registered Checkout:Login and Pick Address4 | -- | 3366 | -3366 | -0 | -- | 200 | -7380 | -1155 | -1482 | -4870 | -5900 | -4 | -
| Registered Checkout:Login and Pick Address Redirect 15 | -- | 3366 | -3366 | -0 | -- | 700 | -11440 | -2605 | -1662 | -5640 | -7710 | -4 | -
| Guest Checkout start6 | -- | 120 | -120 | -0 | -- | 360 | -2490 | -908 | -487 | -1860 | -2420 | -0 | -
| Registered:Pick Billing Address 17 | -- | 120 | -120 | -0 | -- | 390 | -4240 | -1457 | -974 | -3510 | -4210 | -0 | -
| Registered:Pick Billing Address 2-18 | -- | 120 | -120 | -0 | -- | 410 | -3690 | -1218 | -685 | -2460 | -3070 | -0 | -
| Registered:Pick Billing Address 2-29 | -- | 120 | -120 | -0 | -- | 400 | -3600 | -1201 | -714 | -2700 | -3510 | -0 | -
| Registered:Go to pick Shipping Method10 | -- | 120 | -120 | -0 | -- | 340 | -2900 | -1072 | -633 | -2330 | -2700 | -0 | -
| Guest:Pick Billing Address 111 | -- | 120 | -120 | -0 | -- | 610 | -4620 | -1688 | -941 | -3580 | -4440 | -0 | -
| Guest:Pick Billing Address 212 | -- | 120 | -120 | -0 | -- | 380 | -3530 | -1049 | -589 | -2050 | -2750 | -0 | -
| Guest:Go to pick Shipping Method13 | -- | 120 | -120 | -0 | -- | 300 | -2080 | -796 | -401 | -1530 | -1960 | -0 | -
| Set Shipping Method (Flatrate) 114 | -- | 240 | -240 | -0 | -- | 510 | -4830 | -1780 | -1066 | -3930 | -4720 | -0 | -
| Set Shipping Method (Flatrate): Goto Payment15 | -- | 240 | -240 | -0 | -- | 300 | -3150 | -905 | -516 | -1940 | -2300 | -0 | -
| Set Payment Method (Check/MO) 116 | -- | 240 | -240 | -0 | -- | 670 | -5290 | -1787 | -987 | -3660 | -4920 | -0 | -
| Set Payment Method (Check/MO) 217 | -- | 240 | -240 | -0 | -- | 300 | -2760 | -904 | -518 | -2010 | -2440 | -0 | -
| Set Payment Method (Check/MO) 318 | -- | 220 | -220 | -0 | -- | 370 | -8180 | -2696 | -1725 | -5810 | -7590 | -0 | -
| /checkout/../success/19 | -- | 240 | -240 | -0 | -- | 250 | -2830 | -931 | -583 | -1970 | -2530 | -0 | -
| /checkout/../success/ Redirect 120 | -- | 74 | -0 | -74 | -- | 1030 | -8350 | -2473 | -1620 | -5590 | -7310 | -0 | -
| - | - | - | - | - | - | - | - | - | - | - | - | - |
| - | - | - | - | - | - | - | - | - | - | - | - | - |
| - | - | - | - | - | - | - | - | - | - | - | - | - |
| - | - | - | - | - | - | - | - | - | - | - | - | - |
| Magento EE v1.12 | -- | - | - | - | - | - | - | - | - | - | - | - |
| Requests | -- | Total | -OK | -KO | -- | Min | -Max | -Mean | -Std Dev | -95th Pct | -99th Pct | -Req/s | -
| Global Information0 | -- | 48044 | -47887 | -157 | -- | 40 | -40580 | -4985 | -3290 | -10650 | -13870 | -58 | -
| product page0 | -- | 21327 | -21286 | -41 | -- | 40 | -20040 | -4557 | -2820 | -9740 | -12350 | -26 | -
| Click add to cart1 | -- | 8340 | -8324 | -16 | -- | 40 | -12130 | -4216 | -2217 | -7520 | -9000 | -10 | -
| Click add to cart Redirect 12 | -- | 8324 | -8320 | -4 | -- | 40 | -16500 | -7022 | -3449 | -11780 | -13500 | -10 | -
| click checkout3 | -- | 2780 | -2779 | -1 | -- | 920 | -12350 | -6311 | -2829 | -9760 | -10950 | -3 | -
| Guest Checkout start4 | -- | 90 | -90 | -0 | -- | 390 | -3690 | -2103 | -795 | -3210 | -3410 | -0 | -
| Registered Checkout:Login and Pick Address5 | -- | 2690 | -2690 | -0 | -- | 180 | -19120 | -3298 | -4984 | -15470 | -16940 | -3 | -
| Guest:Pick Billing Address 16 | -- | 90 | -90 | -0 | -- | 600 | -7750 | -4348 | -1605 | -6430 | -7400 | -0 | -
| Registered Checkout:Login and Pick Address Redirect 17 | -- | 2690 | -2688 | -2 | -- | 40 | -24360 | -5433 | -3350 | -11780 | -14060 | -3 | -
| Guest:Pick Billing Address 28 | -- | 90 | -90 | -0 | -- | 520 | -8240 | -3412 | -1423 | -5480 | -6810 | -0 | -
| Guest:Go to pick Shipping Method9 | -- | 90 | -90 | -0 | -- | 310 | -4780 | -2334 | -888 | -3300 | -4450 | -0 | -
| Registered:Pick Billing Address 110 | -- | 90 | -90 | -0 | -- | 370 | -10090 | -3657 | -2453 | -8660 | -9600 | -0 | -
| Registered:Pick Billing Address 2-111 | -- | 90 | -90 | -0 | -- | 540 | -17670 | -4148 | -2741 | -10220 | -12510 | -0 | -
| Registered:Pick Billing Address 2-212 | -- | 90 | -90 | -0 | -- | 530 | -12640 | -3983 | -2411 | -8290 | -11590 | -0 | -
| Registered:Go to pick Shipping Method13 | -- | 90 | -90 | -0 | -- | 360 | -6290 | -2546 | -1401 | -5050 | -5980 | -0 | -
| Set Shipping Method (Flatrate) 114 | -- | 180 | -180 | -0 | -- | 450 | -7640 | -3926 | -1884 | -6550 | -7450 | -0 | -
| Set Shipping Method (Flatrate): Goto Payment15 | -- | 180 | -180 | -0 | -- | 380 | -6290 | -2451 | -1256 | -4270 | -4830 | -0 | -
| Set Payment Method (Check/MO) 116 | -- | 180 | -180 | -0 | -- | 570 | -8290 | -3923 | -1996 | -6460 | -7300 | -0 | -
| Set Payment Method (Check/MO) 217 | -- | 180 | -180 | -0 | -- | 330 | -5230 | -2318 | -1238 | -4210 | -4810 | -0 | -
| Set Payment Method (Check/MO) 318 | -- | 180 | -180 | -0 | -- | 940 | -40580 | -12673 | -7957 | -25910 | -29540 | -0 | -
| /checkout/../success/19 | -- | 180 | -180 | -0 | -- | 230 | -3330 | -1437 | -854 | -2870 | -3150 | -0 | -
| /checkout/../success/ Redirect 120 | -- | 93 | -0 | -93 | -- | 780 | -10470 | -5031 | -2251 | -7920 | -8880 | -0 | -
| - |

- {% include m1x/eol_message.html %}
-
-
-
-
-
- These Release Notes contain the following information:
-Magento has the following patches available for multiple Magento CE versions.
- -EE_1.14.0.1 in the name. These patches were all tested against CE 1.8.x as well.Patch name: SUPEE-3941
-/app/code/community directory structure, the Magento administrator
- sees an error message in the Magento Connect Manager.Patch name: SUPEE-3762.
- Refreshing the SOAP v2
- index page (http://your-magento-host-name/index.php/api/v2_soap/index/) results in all
- administrators and customers viewing the Magento installation page.
Magento has fixed an issue that prevented some Discover credit cards from validating properly. The issue was that - certain Discover credit card number ranges were not recognized as being valid. As a result of the fix, all Discover - cards should validate properly.
-The issue affects Magento CE versions 1.4.2.0–1.8.1.0.
-To get a fix for the issue, see Discover credit card validation issue: Magento EE 1.9.1.1–1.13.1.0 and CE - 1.4.2.0–1.8.1.0.
-You can use PHP 5.4 with Magento CE versions 1.6.0.0–1.8.1.0.
-To get the patch, see Getting the PHP 5.4 - patch for Magento Enterprise Edition (EE) and Community Edition (CE).
-For more information about PHP 5.4, see the PHP migration page and the PHP changelog.
- -This section discusses how to get patches referenced in these Release Notes.
-To get patches for Magento CE:
-See the following sections for information about changes in this release:
-Magento CE 1.8.1.0 helps advance overall product quality and ease operations by providing significant tax - calculation improvements, a wide range of bug fixes, and several security enhancements.
- -CE 1.8.1.0 resolves Value Added Tax (VAT) and Fixed Product Tax (FPT) issues so that Magento administrators can - create invoices and credit memos to give merchants merchants access to accurate and consistent tax calculations - and displays. We've also addressed:
-CE 1.8.1.0 includes bug fixes across important feature areas, including the shopping cart, checkout, content - management system, and product import and export function. Many of these updates came from a hackathon held with - Magento community developers, which demonstrates the vitality of our development community and their powerful - ability to help us advance the platform.
- -CE 1.8.1.0 includes several security enhancements that were identified through our rigorous security assessment - process. Magento complements its own comprehensive internal testing with quarterly penetration testing by expert - consultants and actively works with the development community to identify security issues in order to harden the - platform against potential threats.
- - - -Magento addressed the following security issues:
-frontend cookie to protect user sessions.
-
- - There is a known Issue After Upgrading to CE 1.8.1 that affects - you only if you do not follow the recommended procedure to upgrade to a new environment as - discussed in Getting Ready For - Your Upgrade.
-Symptom: After completing the upgrade, when you log in to the Admin Panel and click - System > Configuration, a fatal error similar to the following displays in your - browser:
-Class 'Mage_Googlecheckout_Helper_Data' not found in /var/www/html/magento/app/Mage.php on line 547- -
Solution:
-root privileges, delete all files except config.xml from the
- following directory:magento-install-dir/app/code/core/Mage/GoogleCheckout/etc-
See the following sections for a discussion of changes in this release:
-*) wildcard character for the value of State when you set up a new
- tax rate. This enables you to apply the same tax rate to all states or provinces in a particular country.http://xmlapi.dhl-usa.com/ApiLanding.asp-
Tax calculation issues can be divided into the following sections:
-The following general fixes were made to Magento tax configuration and calculations:
-NOT LOGGED IN customer group.)The following tax rounding issues were resolved:
-The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web - store:
-Fixes in this release can be divided into the following categories:
- - -'Zend_Date_Exception' with message 'Invalid year, it must be between -10000 and 10000'Mage_Catalog_Block_Product_Abstract class that caused errors to display on product view pages in
- your web store.Mage_Page_Block_Template_Links::addLinkBlock to enable you to sort an array of results by
- position.See the following sections for information about changes in this release:
-The USPS changed the names of their Priority and Express shipping options in their API in July 2013. To enable you - to continue utilizing USPS Priority and Express mail methods, CE 1.8 includes a patch that addresses the - issue.
-Following are details about the upgrade impact:
-Tax calculation issues can be divided into the following sections:
-The following general fixes were made to Magento tax configuration and calculations:
-Sub item price = Sub item base price * Applicable tiered price adjustment or discount, then rounded
- Bundle price = Sum (round(sub item price * qty))round(unit price * non-integer quantity)For details, see the Magento - User Guide.
- - -The following issues relate to one-cent rounding errors in the web store or shopping cart:
-The following issues relate to errors in calculating taxes that include FPT in the web store or shopping cart:
-The following issues relate to price calculations when coupon codes or other discounts are applied in the web store - or shopping cart:
-The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web - store:
-The following are fixed in the Magento SOAP v2.0 APIs (with exceptions noted):
-8888 in the following example):
- $result = $client->call($sessionId, 'catalog_product.info', '8888', null, null, 'sku');
-
- salesOrderAddComment.
-
- shoppingCartProductMoveToCustomerQuote method works properly.
-
- from-to complex filters to perform "window" filtration on a single
- field. For example, you can use from and to on the created_at return a list
- of sales orders using the salesOrderList.
-
- productGetSpecialPrice method returns special price information for a product, whether or not
- WS-I Compliance is
- enabled.
-
- shoppingCartPaymentList method returns the list of the available payment
- methods for the shopping cart appropriately. The following error is no longer returned:
- SOAP-ERROR: Encoding: object has no 'code' property in name
-
- productAttributeAddOption and catalogProductAttributeUpdate methods are now supported when WS-I
- Compliance is enabled.
-
- salesOrderCreditmemoCreate is now correct; that is, it matches the code.
-
- C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin> wsdl /out:Magento.cs /v
- http://magentohost/api/v2_soap/?wsdl
-
- catalogProductAttributeInfo.
-
- product_custom_option.add operation with multicall no
- longer results in redundant options.
-
- Fixes in this release can be divided into the following categories:
-There has been an error processing your request. Please contact us or try again later).
-
- 10,50 (using a comma character and not a period) for Adjustment
- Fee now results in the correct amount of credit being applied to the transaction.
-
- /sitemap/catalog/string.
-
- SAMPLE printed on them only when you request a sample label.
-
- The following fixes relate to administering and using shopping cart price rules and catalog price rules:
-QTY) of all products imports correctly.
-
- use_cfg_max_sale_qty) is correct.
-
- user@example.com and User@example.com).
-
- .csv) file have been resolved.
-
- state correctly. (Before the fix, city was sent as the value for state.)
-
- Gateway error: Void error: V18A4B18E0F9 has been captured errors when canceling
- partially invoiced orders when the Payflow Pro processor was used to process the payment.
-
- This
- customer email already exists.
-
- .htaccess.sample provided with Magento now includes php_value memory_limit 512M to be
- consistent with the Magento system
- requirements.mage_ because you specified a tables prefix during installation).Magento acknowledges and thanks everyone in the Magento Community who contributed to this release, including Colin - Mollenhour for Redis modules.
- -
- {% include m1x/eol_message.html %}
-
-
-
- These Release Notes contain the following information:
- -Magento has the following patches available for multiple Magento EE versions.
- -EE_1.14.0.1 in the name. These patches were all tested against EE 1.13.x as well.Patch name: PATCH_SUPEE-3941_EE_1.14.0.1_v1-2014-08-12-12-10-06.sh
-/app/code/community directory structure, the Magento administrator
- sees an error message in the Magento Connect Manager.Patch name: PATCH_SUPEE-3762_EE_1.14.0.1_v1.sh.
- Refreshing the SOAP v2
- index page (http://your-magento-host-name/index.php/api/v2_soap/index/) results in all
- administrators and customers viewing the Magento installation page.
Patch name: PATCH_SUPEE-3819_EE_1.14.0.1_v1.sh. - Multiple Magento - administrators can simultaneously add new products; or edit descriptions, edit prices, or edit stock quantities of - existing products without causing deadlocks, key violations, or critical data errors. Together with applying the - patch, you must set all indexers to Update when scheduled as follows:
-Magento has fixed an issue that prevented some Discover credit cards from validating properly. The issue was that - certain Discover credit card number ranges were not recognized as being valid. As a result of the fix, all Discover - cards should validate properly.
-The issue affects EE versions 1.9.1.1 through 1.13.1.0.
-To get a fix for the issue, see Discover credit card validation issue: Magento EE 1.9.1.1–1.13.1.0 and CE - 1.4.2.0–1.8.1.0.
-You can use PHP 5.4 with Magento EE versions 11.0.0.0–1.13.1.0.
-To get the patch, see Getting the PHP 5.4 - patch for Magento Enterprise Edition (EE) and Community Edition (CE).
-For more information about PHP 5.4, see the PHP migration page and the - PHP changelog.
- -This section discusses how to get patches referenced in these Release Notes. Magento has other patches available - from the EE support portal and the partner portal; you - can use the following instructions to install any of those patches as well.
-To get patches for Magento EE:
--
See the following sections for information about changes in this release:
-Magento EE 1.13.1.0 helps advance overall product quality and ease operations by providing significant tax - calculation improvements, a wide range of bug fixes, and several security enhancements.
- -EE 1.13.1.0 resolves Value Added Tax (VAT) and Fixed Product Tax (FPT) issues so that Magento administrators can - create invoices and credit memos to give merchants merchants access to accurate and consistent tax calculations - and displays. We've also addressed:
-EE 1.13.1.0 includes bug fixes across important feature areas, including the shopping cart, checkout, content - management system, and product import and export function. Many of these updates came from a hackathon held with - Magento community developers, which demonstrates the vitality of our development community and their powerful - ability to help us advance the platform.
- -EE 1.13.1.0 includes several security enhancements that were identified through our rigorous security assessment - process. Magento complements its own comprehensive internal testing with quarterly penetration testing by expert - consultants and actively works with the development community to identify security issues in order to harden the - platform against potential threats.
- -Magento addressed the following security issues:
-frontend cookie to protect user sessions.
-
- There is a known issue after upgrading to EE 1.13.1 that affects you only if you do not follow - the recommended procedure to upgrade to a new environment as discussed in Getting Ready For Your - Upgrade.
-Symptom: After completing the upgrade, when you log in to the Admin Panel and click - System > Configuration, a fatal error similar to the following displays in your - browser:
-Class 'Mage_Googlecheckout_Helper_Data' not found in /var/www/html/magento/app/Mage.php on line 547- -
Solution:
-root privileges, delete all files except config.xml from the
- following directory:magento-install-dir/app/code/core/Mage/GoogleCheckout/etc-
See the following sections for a discussion of changes in this release:
-*) wildcard character for the value of State when you set up a new
- tax rate. This enables you to apply the same tax rate to all states or provinces in a particular country.http://xmlapi.dhl-usa.com/ApiLanding.asp.
Tax calculation issues can be divided into the following sections:
-The following general fixes were made to Magento tax configuration and calculations:
-NOT LOGGED IN customer group.)The following tax rounding issues were resolved:
-The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web - store:
-Fixes in this release can be divided into the following categories:
-'Zend_Date_Exception' with message 'Invalid year, it must be between -10000 and 10000'Mage_Catalog_Block_Product_Abstract class that caused errors to display on product view pages in
- your web store.Mage_Page_Block_Template_Links::addLinkBlock to enable you to sort an array of results by
- position.In response to customer feedback about EE 1.13.0.0 and EE 1.13.0.1, Magento has modified the functionality to - smooth the migration path from earlier EE versions and support duplicate category URL keys.
-See the following sections for a discussion of changes in this release:
-Important:
-This section discusses how search engine optimization (SEO) works in EE 1.13.0.2. This section is not - intended to be a tutorial on SEO.
-See one of the following for more information:
-The following sections quickly summarize the changes you'll see in EE 1.13.0.2:
- - -Product URL key uniqueness
-In EE 1.12, it was possible to have multiple products with the same URL key; however, every time the indexer
- ran, it silently assigned a numerical suffix to duplicates (for example, shoes became
- shoes-1 and so on).
Every time this happened, another URL rewrite was created, resulted in a set of chained redirects for - the same product. Having multiple URLs for a product dilutes the effectiveness of URL in search engine - weightings, especially if you enabled canonical URLs. (As discussed in this - article on Google's blog, a canonical URL is a public specification of your preferred URL. The - canonical URL is used by any search engine when crawling and indexing your site.)
-This behavior was not clear to merchants and had the effect of diluting search engine weightings.
-In EE 1.13.0.2, there is a single, unique way to access a product (or multiple ways if you use the category - path in URLs).
-No more chained redirects
-Per-entity indexing
-Similar to chained redirects, in EE 1.12, if a product had the same URL key as its parent category, the indexer - assigned an incrementing numeric suffix to either the category or the product. This was done without the - merchant's knowledge and was confusing as well. -
In EE 1.12, if you named a top-level category slippers and had product also named
- slippers, the indexer allowed to access to the category using a URL like the following:
- http://www.example.com/slippers-1
In EE 1.13.0.2, the same product can be accessed using a URL like:
- http://www.example.com/slippers
-
There is a new Admin Panel setting to specify how indexing should be prioritized. This setting, - System > Configuration > CATALOG > Catalog > Search - Engine Optimizations > Priority for Duplicated URL Keys, is discussed in more - detail in Prioritizing URL Resolution.
-The following entities can be indexed and therefore have a requirement for URL key uniqueness:
-Uniqueness rules for each entity type follow:
-| Entity type | -Uniqueness rule | -
|---|---|
| Product, including custom URL redirects† | -All product URL keys must be globally unique. | -
| Category | -
- Category URL keys must be unique only in the same level in the hierarchy; for example -website- Note: Uniqueness rules apply to inactive categories as well. You cannot use the same URL - key for both an active and inactive category at the same level in the category hierarchy. - |
-
| CMS | -CMS URL keys, like category URL keys, must be unique only in the same level in the - hierarchy. | -
†—Custom URL redirect refers to a product's Create Custom Redirect - for old URL option.
- -The following table shows category URL keys that are allowed. (The URL key is shoes for all entities
- in the table.)
| URL examples | -Reason allowed | -
|---|---|
http://example.com/mens/shoes- http://example.com/womens/shoes |
- Different category hierarchies. | -
http://example1.com/shoes- http://example2.com/shoes |
- Different domains. | -
http://example.com/shoes (store view 1)- http://example.com/shoes (store view 2) |
- Different store views. | -
Notes:
-Suppose you have the following set of URL keys. All of them are allowed because they're for different entity types. -
-| Entity type | -Entity name | -URL key | -Sample URL | -
|---|---|---|---|
| Category | -shoes | -shoes | -http://www.example.com/shoes.html | -
| Product | -shoes | -shoes | -http://www.example.com/shoes.html | -
| Custom URL redirects | -shoes | -shoes | -http://www.example.com/shoes.html | -
Question: What happens when a web store visitor requests
- http://www.example.com/shoes.html?
Answer: You control the response in the Admin Panel. Click System > - Configuration > CATALOG > Search Engine Optimizations. In the right pane, click an - option from the Priority for Duplicated URL Keys list. Some examples follow:
-| Priority setting | -Result | -
|---|---|
Default setting:
-
|
- Custom URL redirect | -
-
|
- Shoes category | -
†—Custom URL redirect refers to a product's Create Custom Redirect - for old URL option.
-The other options are:
-In the event no URL key matches your priority setting, Magento continues through the priorities in order until a - match is found.
-For more information about SEO, see:
-- After changing the - value for product or category suffix, previous suffixes do not work.
-For example, if a category URL suffix was set to .html and you change it to .php, - categories that had been using the .html suffix display an HTTP 404 (Not Found) error in your web store.
-(In the Admin Panel, click System > Configuration > CATALOG > - Catalog > Search Engine Optimizations. In the right pane, the options are named - Product URL Suffix and Category URL Suffix.)
- -The United States Postal Service (USPS) changed the names of their Priority and Express shipping options in their - API on Sunday, July 28, 2013. Magento has a patch available; however, this patch is not included in new EE 1.13.0.2 - installations.
-For new EE 1.13.0.2 installations to continue utilizing USPS Priority and Express mail methods, you must - install the patch we've created to address the issue.
-Get the patch from the EE support portal by logging in to magentocommerce.com.
- -testurlkey, the new product's URL key might is testurlkey-1.product1
- and you create a new product with the name Product1 and the product has an ID of 500, the new
- product's URL key is product1-500.http://www.example.com/mens/shoes
- domain-name/product-url-key because product URL keys must be globally
- unique.domain-name/product-url-key but the product can also be accessed using
- its full URL (including the category hierarchy). Examples:producturlkey and it's assigned to the Apparel > Womens >
- Purses category, the product can be accessed using both of the following URLs:http://www.example.com/producturlkeyhttp://www.example.com/apparel/womens/purses/producturlkeyhttp://www.example.com/producturlkey.
- Notes:
This section discusses fixes made in EE 1.13.0.2.
-SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get
- lock.mage_ because you specified a tables prefix during installation).SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry/catalog/category/view/s/newcategory/id/36//catalog/newcategory//parent-category/category-2//parent-category/category-2/product-1SQLSTATE[23000]: Integrity constraint violation.SQLSTATE[23000]: Integrity constraint violation.See the following sections for information about changes in this release:
-Magento has identified a potential vulnerability that might affect you if both of the following are true:
-If both of the preceding are true, Magento can be subjected to cross-site scripting - (XSS) attacks—a type of injection issue, which means that malicious code is injected into otherwise - trusted websites, generally in the form of a browser-side script.
-Issue: Magento is subject to XSS attacks because the SID cookie value is not sanitized by default.
-Suggested solution: Either disable Use SID on Frontend or output-encode any usage of the SID cookie value before using it or passing it as a - parameter to any page cache helper functions.
-Additional references:
-Magento EE 1.13—unlike earlier versions—does not allow duplicate URL keys for products or - categories. An issue has been identified that causes problems during upgrades if you already have duplicate URL - keys. The issue is being addressed; until a solution is announced, Magento recommends you test your upgrade but - do not try to deploy it to a production environment.
- For more information about upgrading in a development environment, see Upgrading to and Verifying - Magento Community Edition (CE) 1.8 and Enterprise Edition (EE) 1.13. - -For more information, see Magento - Enterprise Edition 1.13 Benchmarking
- -Tax calculation issues can be divided into the following sections:
-The following general fixes were made to Magento tax configuration and calculations:
-Sub item price = Sub item base price * Applicable tiered price adjustment or discount, then rounded
- Bundle price = Sum (round(sub item price * qty))round(unit price * non-integer quantity)For details, see the Magento - User Guide.
- - -The following issues relate to one-cent rounding errors in the web store or shopping cart:
-The following issues relate to errors in calculating taxes that include FPT in the web store or shopping cart:
-The following issues relate to price calculations when coupon codes or other discounts are applied in the web store - or shopping cart:
-The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web - store:
-The following are fixed in the Magento SOAP v2.0 APIs (with exceptions noted):
-8888 in the following example):
- $result = $client->call($sessionId, 'catalog_product.info', '8888', null, null, 'sku');
-
- salesOrderAddComment.
-
- shoppingCartProductMoveToCustomerQuote method works properly.
-
- from-to complex filters to perform "window" filtration on a single
- field. For example, you can use from and to on the created_at return a list
- of sales orders using the salesOrderList.
-
- productGetSpecialPrice method returns special price information for a product, whether or not
- WS-I Compliance is
- enabled.
-
- shoppingCartPaymentList method returns the list of the available payment
- methods for the shopping cart appropriately. The following error is no longer returned:
- SOAP-ERROR: Encoding: object has no 'code' property in name
-
- productAttributeAddOption and catalogProductAttributeUpdate methods are now supported when WS-I
- Compliance is enabled.
-
- salesOrderCreditmemoCreate is now correct; that is, it matches the code.
-
- C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin> wsdl /out:Magento.cs /v
- http://magentohost/api/v2_soap/?wsdl
-
- catalogProductAttributeInfo.
-
- product_custom_option.add operation with multicall no
- longer results in redundant options.
-
- Fixes in this release can be divided into the following categories:
-There has been an error processing your request. Please contact us or try again later).
-
- 10,50 (using a comma character and not a period) for Adjustment
- Fee now results in the correct amount of credit being applied to the transaction.
-
- /sitemap/catalog/string.
-
- SAMPLE printed on them only when you request a sample label.
-
- The following fixes relate to administering and using shopping cart price rules and catalog price rules:
-QTY) of all products imports correctly.
-
- use_cfg_max_sale_qty) is correct.
-
- user@example.com and User@example.com).
-
- .csv) file have been resolved.
-
- state correctly. (Before the fix, city was sent as the value for state.)
-
- Gateway error: Void error: V18A4B18E0F9 has been captured errors when canceling
- partially invoiced orders when the Payflow Pro processor was used to process the payment.
-
- This
- customer email already exists.
-
- GiftRegistry/Model/Item/Option.php has been resolved.
-
- magento-install-dir/app/code/core/Enterprise/PageCache/Model/Config.php was
- modified to enable you to set specific lifetimes for certain blocks.
-
- This release includes the following changes to support the changes in indexing:
-catalog_product_entity_url_key and catalog_category_entity_url_key
- database tables for the corresponding url_key attributes have been added.
-
- - For more information about indexing changes, see the Magento User Guide.
- - - - - - diff --git a/guides/m1x/ce18-ee113/ht_magento-ce-sample.data.html b/guides/m1x/ce18-ee113/ht_magento-ce-sample.data.html deleted file mode 100644 index c6e67a7bb5..0000000000 --- a/guides/m1x/ce18-ee113/ht_magento-ce-sample.data.html +++ /dev/null @@ -1,45 +0,0 @@ ---- -layout: m1x -title: Installing Sample Data for Magento Community Edition (CE) ---- - -This page discusses how to get the sample data for:
-Magento CE sample data must be installed before you install Magento CE.
- -- The sample data is provided in different formats for your convenience. - Archives for each version have exactly the same content (they differ only by compression method). -
-Detailed instructions for installing sample data for Magento CE 1.6–1.9 can be found on the Magento Knowledge Base.
diff --git a/guides/m1x/ce18-ee113/using_redis.html b/guides/m1x/ce18-ee113/using_redis.html deleted file mode 100644 index eaa3cd07b3..0000000000 --- a/guides/m1x/ce18-ee113/using_redis.html +++ /dev/null @@ -1,119 +0,0 @@ ---- ---- - - - - - - - - - -
-{% include m1x/eol_message.html %}
-
-
-
-
-Redis is an open source, Berkeley Software Distribution (BSD) licensed, advanced key-value store that can optionally be used in Magento for backend and session storage. In fact, you can replace memcached with Redis.
-Following are some of the benefits Redis provides for Magento implementations:
-The following Magento editions support Redis session and backend caching:
-The preceding Magento editions support Redis server version 2.6.9 and later available from redis.io.
-In addition, you can optionally use the Redis extension for PHP version 2.2.3 or later if you're using Redis for backend caching; however, Magento works without this extension.
- -To use Redis with Magento, you must configure Magento to use Redis and you must install and configure the Redis server. These tasks are discussed in the following sections:
- - -To use Redis with Magento, you only need to install and configure the Redis server. The integration between Redis and Magento is already included with Magento CE 1.8 and EE 1.13 and later versions. All you need to do is configure it.
-Important: The Cm_RedisSession module in CE 1.8 is disabled by default. Magento disables the module to avoid unnecessary connection tries to Redis when you choose to use file, database, or a different session storage method.
-To enable Magento to use Redis, perform the following tasks:
-Get Redis server version 2.6.9 or later and configure it according to their documentation.
-You can optionally install the Redis extension for PHP version 2.2.3 or later as well, but Magento functions without it.
- -Important: Colin Mollenhour, the original author of Redis, does not provide support for Magento implementations. You can get support for Magento implementations in the following ways:
-| Magento edition | -How to get help | -
|---|---|
| Magento CE and Magento EE | -- | -
| Magento CE | -Submit bug reports | -
| Magento EE only | -Submit bug reports | -
For more information about using Redis with Magento, see:
- - -Magento acknowledges the contributions of Colin Mollenhour in providing the code for the Magento implementation of Redis.
- - - - -
-{% include m1x/eol_message.html %}
-
-
-
-
-The iOS app for Magento MobileConnect was discontinued in 2015.
- -Welcome to the home page for Magento 1.x documentation for installation, configuration, developers, patches, and more. Here you'll find articles that were formerly located on http://magentocommerce.com/knowledge-base.
For information you don't find here—including Release Notes—see the User Guide page.
- -
-{% include m1x/eol_message.html %}
-
-In a continuing effort to improve security and ease of use, Magento is updating its recommendations for file system permissions and ownership for the following Magento editions:
-This article discusses recommended permission and ownership schemes to apply after you install Magento.
-The guidelines discussed in this article apply to:
-This article discusses the following permission and ownership schemes:
-root access on the server).This article uses the following terminology:
-root. The web server typically runs as an ordinary user. Magento assumes you log in as this user to start and stop the web server and that you already own all the files and directories in the Magento installation directory. You can use chmod to change permissions on files and directories.root and, as root, you can use the chown and chmod commands to set ownership and privileges in the Magento installation directory.If you have installed Magento, you can set file system privileges and ownership as follows:
-media/ and var/ directories at 700/600 because they must be writable.Following is an explanation of the privileges:
-dr-x------) gives the web server user read and execute privileges to prevent the accidental deletion or modification of files in the directory. Other users have no access to Magento directories.-r--------) prevent any user (even the web server user) from overwriting files.drwx------) for the media/ and var/ directories give full control (that is, read/write/execute) to the owner and no permissions to anyone else.-rw-------) for files in the media/ and var/ directories enable the web server user to write to them and to overwrite them.root privileges. On a hosted system, commands must be entered as the web server user.To set up ownership and permissions on a dedicated Magento server:
-root privileges, find the web server user:
- grep User /etc/apache2/apache2.confgrep User /etc/httpd/conf/httpd.conf.conf files on your system might be different. You can use the command whereis nginx to find the location of the configuration files.apache and the Apache web server user on Ubuntu is www-data./etc/nginx/nginx.conf. The user directive specifies the username. It might run as the Apache user if Apache is installed on the same system./var/www/html/magento. On Ubuntu, it is typically /var/www/magento.root privileges, enter the following command to set ownership of the Magento installation directory and all its subdirectories:
- chown -R web-server-user-name .- For example, on Ubuntu where Apache usually runs as
www-data, enter
- chown -R www-data .
find . -type f -exec chmod 400 {} +
-find . -type d -exec chmod 500 {} +
-find var/ -type f -exec chmod 600 {} +
-find media/ -type f -exec chmod 600 {} +
-find var/ -type d -exec chmod 700 {} +
-find media/ -type d -exec chmod 700 {} +
-chmod 700 includes
-chmod 600 includes/config.phpIf you set permissions and ownership as discussed in this article, you must change permissions temporarily to be able to use the Magento Connect Manager in the Admin Panel. (System > Magento Connect > Magento Connect Manager). You can still install extensions manually, however; that is beyond the scope of this article.
-You can confirm the issue when you access Magento Connect Manager in the Admin Panel. The following error displays on the Extensions tab page:
-Warning: Your Magento folder does not have sufficient write permissions.-
To use Magento Connect Manager, you must:
-In addition, if you have a dedicated Magento server, you should check ownership of files and directories and reset them if necessary. Often, Magento Connect Manager installs extensions with user and group ownership both set to the web server user.
- -To temporarily set file and directory permissions so you can use Magento Connect Manager:
-/var/www/html/magento. On Ubuntu, it is typically /var/www/magento.find . -type d -exec chmod 700 {} +
-find . -type f -exec chmod 600 {} +Enter the commands discussed in this section to return permissions and ownership to their recommended values after you have installed extensions.
-To restore Magento installation directory permissions:
-/var/www/html/magento. On Ubuntu, it is typically /var/www/magento.root privileges, enter the following command to set ownership of the Magento installation directory and all its subdirectories:
- chown -R web-server-user-name .- For example, on Ubuntu where Apache usually runs as
www-data, enter
- chown -R www-data .
find . -type f -exec chmod 400 {} +
-find . -type d -exec chmod 500 {} +
-find var/ -type f -exec chmod 600 {} +
-find media/ -type f -exec chmod 600 {} +
-find var/ -type d -exec chmod 700 {} +
-find media/ -type d -exec chmod 700 {} +Magento Support typically provides a shell script to patch various Magento issues. When you run the shell script, file and directory permissions are typically not changed; however, the files provided with the patch are owned by the user who applied the patch. If you have a dedicated Magento server, this is typically root; therefore, after applying the patch, you must change file ownership.
If you are required to apply a patch provided by Magento Support, use the following process:
-root privileges or as the owner of the Magento installation directory.root privileges, use the following steps to reset file ownership:
- grep User /etc/apache2/apache2.confgrep User /etc/httpd/conf/httpd.confapache and the Apache web server user on Ubuntu is www-data./etc/nginx/nginx.conf. The user directive specifies the username. It might run as the Apache user if Apache is installed on the same system.root privileges, enter the following command from the Magento installation directory:chown -R web-server-user-name .
- For example, on Ubuntu where Apache usually runs as www-data, enter
- chown -R www-data .For more information about UNIX permissions, see the following resources:
- -
-{% include m1x/eol_message.html %}
-
-In a continuing effort to improve security and ease of use, Magento is updating its recommendations for file - system permissions and ownership for the following Magento editions:
-The guidelines discussed in this article apply to:
-This article uses the following terminology:
-This section discusses Magento's pre-installation recommended privilege and ownership settings, which are as - follows:
-Note: On a dedicated system, all commands discussed in this article must be - entered as a user with root privileges.
-After you extract the Magento installation package, set ownership and permissions as follows:
-Note: The preceding paths are samples only. The paths - to these .conf files on your system might be different. You can use the command - whereis nginx to find the location of the configuration files.
-chown -R web-server-user-name .- For example, on Ubuntu where Apache usually runs as www-data, enter -
chown -R www-data .-
find . -type d -exec chmod 700 {} +
-find . -type f -exec chmod 600 {} +
- For more information about UNIX permissions, see the following resources:
- - -
-{% include m1x/eol_message.html %}
-
-We're happy you chose to install or upgrade your Magento software. We're going to help you to install or to upgrade to the following versions:
-These releases include a number of improvements:
-The sections that follow get you started on your installation or upgrade. Detailed, step-by-step procedures are discussed in the following articles:
- - -In the event you have a large, distributed system or you need additional help, consult the following resources.
-| Magento edition | -How to get help | -
|---|---|
| Magento CE and Magento EE | -- | -
| Magento CE | -Submit bug reports | -
| Magento EE only | -Submit bug reports | -
The following table discusses where to get the upgrade image and optional sample data.
-| Magento edition | -Upgrade image location | -
|---|---|
| Magento CE | -www.magentocommerce.com/download | -
| Magento EE | -Use the following steps:
-
|
-
See Installing Magento CE or EE.
- -
-{% include m1x/eol_message.html %}
-
-This article discusses how to install:
-To install Magento CE or Magento EE, use the following high-level guidelines:
-Before starting your installation:
-Magento strongly recommends you observe the following guidelines when you set up your Magento database:
-More information, including software prerequisites, can be found in the next section.
- -The following sections discuss how to download and install prerequisite software and install Magento CE or EE on a system running:
-Complete the tasks discussed in the following sections in the order shown:
-root privileges.Security Enhanced Linux (SELinux) enables CentOS and Ubuntu administrators greater access control over their servers. If you're using SELinux and Apache must initiate a connection to another host, you must run the commands discussed in this section.
-If Apache and the database server are on the same host, you can skip this section and continue with Opening Ports In Your Firewall.
-To enable Apache to initiate a connection to another host with SELinux enabled:
-getenforce-
Enforcing displays to confirm that SELinux is running.setsebool -P httpd_can_network_connect=1
setsebool -P apache2_can_network_connect=1
Depending on your security requirements, you might find it necessary to open port 80 and other ports in your firewall. Because of the sensitive nature of networking security, Magento strongly recommends you consult with your IT department before proceeding. Following are some suggested references:
-This section discusses how to create or install the following:
-phpinfo.php filephpmyadmin database administration utility.These optional utilities might assist you with your installation; however, they are not required to install or use Magento.
-To skip installing these utilities, go directly to Creating a Magento Database Instance.
-See the following sections:
- - -NTP enables servers to synchronize their system clocks using globally available pool servers. Magento recommends you use NTP servers you trust, whether they are dedicated hardware solutions your internal network or external, public servers.
-If you are deploying Magento on multiple hosts, NTP is a simple way to guarantee their clocks are all synchronized, no matter what time zone the servers are in.
-To install and configure NTP:
-yum search ntpntp.x86_64.yum -y install ntp.x86_64apt-get install ntp/etc/ntp.conf in a text editor.server 0.centos.pool.ntp.org -server 1.centos.pool.ntp.org -server 2.centos.pool.ntp.org
server 0.us.pool.ntp.org -server 1.us.pool.ntp.org -server 2.us.pool.ntp.org
/etc/ntp.conf and exit the text editor.chkconfig ntpd on
service ntpd restart
service ntp restart
date command to check the server's date.ntpdate pool-server-host-name command. If it fails, search for the error it returns.phpinfo.php displays a large amount of information about PHP and its extensions. Add the following code anywhere in your web server's docroot:
<?php -// Show all information, defaults to INFO_ALL -phpinfo();-
For more information, see the phpinfo manual page.
-To view the results, enter the following URL in your browser's location or address field:
-http://web-server-ip-or-host/phpinfo.php-
If a 404 (Not Found) error displays, check the following:
-phpmyadmin is an easy-to-use, free database administration utility. You can use it to check and manipulate the contents of your database. You must log in to phpmyadmin as the MySQL database administrative user.
For more information about phpmyadmin, see the phpmyadmin home page.
For more detailed information about installation, see the phpmyadmin installation documentation.
-To install phpmyadmin on CentOS:
-cd /tmp
-wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
-rpm -ivh epel-release-6-8.noarch.rpm
phpmyadmin as follows:
-yum -y install phpmyadmin
vim /etc/httpd/conf.d/phpMyAdmin.conf
#Require ip 127.0.0.1-For example, -
Require ip 192.51.100.101
#Allow from 127.0.0.1-For example, -
Allow from 192.51.100.101
/etc/httpd/conf.d/phpMyAdmin.conf and exit the text editor.service httpd restart
http://host-or-ip-address/phpmyadmin
root or administrative user's username and password.To install phpmyadmin on Ubuntu:
-apt-get install phpmyadminhttp://host-or-ip-address/phpmyadmin
-root or administrative user's username and password.This section discusses how to create a new database instance for Magento. Although a new database instance is recommended, you can optionally install Magento into an existing database instance. If you choose to do that, skip this section and continue with Installing Optional Sample Data.
-To create a new database instance:
-magento:
-mysql -u root -p -#Enter the remaining commands at the mysql> prompt. - -create database magento; -GRANT ALL ON magento.* TO magento@localhost IDENTIFIED BY 'magento';
GRANT SUPER ON *.* TO 'magento'@'localhost';
exitmysql -u magento -p-Messages similar to the following display to confirm you successfully created the database instance. If errors display, repeat the preceding commands. -
Welcome to the MySQL monitor. Commands end with ; or \g. -Your MySQL connection id is 20 -Server version: 5.1.67 Source distribution - -Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. - -Oracle is a registered trademark of Oracle Corporation and/or its -affiliates. Other names may be trademarks of their respective -owners. - -Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Extract the Magento installation archive on your web server's docroot.
-The path on Ubuntu is typically /var/www
The path on CentOS is typically /var/www/html
Examples follow:
-cd /var/www -cp /path/magento-install-archive . -tar -zxf magento-install-archive-name
cd /var/www/html -cp /path/magento-install-archive-name . -tar -zxf magento-install-archive
To optionally install Magento sample data, continue with the next section.
-To install Magento without sample data, continue with Setting File and Directory Ownership and Privileges.
- -Magento provides sample data you can optionally install to give you an idea of what products look like in the Admin Panel and in your web store. You can use this sample data to learn how Magento works and to experiment with custom themes.
-You must install sample data on the file system and in the database before you install Magento.
-To skip sample data installation, continue with Setting File and Directory Ownership and Privileges.
-To install Magento sample data:
-media subdirectory.[your Magento install dir]/media directory.
-#Ubuntu example -cd /var/www/magento/media - -#CentOS example -cd /var/www/html/magento/media
media directory and subdirectories to your Magento installation directory./home/username to /var/www/magento, enter
-cp -R /home/username/media/* .
skin directory to [your Magento install dir]/skin as follows:/home/username/skin to /var/www/magento/skin, enter
-cd [your Magento install dir]/skin -cp -R /home/username/skin/* .
mysql -u root -p magento-db-instance-name < path-to-sample-data-extract-dir/sample-data-filename.sql-EE 1.14 example -
mysql -u root -p magento < /home/username/magento_sample_data_for_1.14.0.0.sql
Magento recommends the following ownership and privilege settings for files and directories in the Magento installation directory:
-root).drwx------).-rw-------).Note: The way you set permissions and ownership depends on whether Magento is running on a dedicated or hosted system:
-root. The web server typically runs as an ordinary user. Magento assumes you log in as this user to start and stop the web server and that you already own all the files and directories in the Magento installation directory. You can use chmod to change permissions on files and directories.root and, as root, you can use the chown and chmod commands to set ownership and privileges in the Magento installation directory.To set privileges and ownership:
-#Ubuntu example -cd /var/www/magento - -#CentOS example -cd /var/www/html/magento
chown -R web-server-user-name .-For example, on Ubuntu where Apache usually runs as
www-data, enter
-chown -R www-data .
find . -type d -exec chmod 700 {} +
-find . -type f -exec chmod 600 {} +This section discusses how to run the Magento installer, using Magento EE as an example. The Magento CE installer has exactly the same options; only the appearance is different.
-To install Magento CE or EE:
-web-server-ip-or-host:port/magento-path/magento-For example, if your web server is
http://www.example.com, listens on port 80, and Magento is installed in the web server docroot's magento subdirectory, enter
-http://www.example.com/magento-The following page displays.

| Option | -Meaning | -
|---|---|
| Locale | -From the list, click the option that best matches the locale in which your Magento server resides. | -
| Time Zone | -From the list, click the option that best matches the time zone in which your Magento server resides. | -
| Default currency | -From the list, click the default currency to use on your Magento web store. | -

| Option | -Meaning | -
|---|---|
| Database Type | -From the list, click MySQL. | -
| Host | -Enter the database server's fully qualified hostname or IP address. Use the default setting of localhost if your database server is on the same host as your web server. | -
| Database Name | -Enter the name of the Magento database instance in which you want to install the Magento database tables. | -
| User Name | -Enter the username of the Magento database instance owner. | -
| User Password | -Enter the Magento database owner's password. | -
| Tables Prefix | -(Optional.) Use only if you're installing the Magento database tables in a database instance that has Magento tables in it already. In that case, enter a prefix to identify the Magento tables for this installation. -Some customers have more than one Magento instance running on a server with all tables in the same database. This option enables those customers to share the database server with more than one Magento installation. - |
-

| Option | -Meaning | -
|---|---|
| Base URL | -Enter the base URL to use to access the Magento Admin Panel and your Magento web store. | -
| Admin Path | -Enter the path to access the Admin Panel. This path is appended to Base URL. - For example, if Base URL is http://www.example.com and Admin Path is admin, the Admin Panel's URL is http://www.example.com/admin—provided you configured your web server for server rewrites. |
-
| Enable Charts | -Select the checkbox to display charts on the Admin Panel. | -
| Skip Base URL Validation Before the Next Step | -Clearing this checkbox validates your server's base URL by performing an HTTP GET. Clear this checkbox unless your web server's base URL is not verifiable; for example, in a development or test environment. | -
| Use Web Server (Apache) Rewrites | -Select this checkbox to enable the use of the Apache mod_rewrite module. You can select this checkbox only if you configured Apache to use server rewrites. |
-
| Use Secure URLs (SSL) | -Select this checkbox only if your web server supports SSL. | -

[your Magento install dir]/var/session directory.| Option | -Meaning | -
|---|---|
| First Name | -Enter the first name of the user you want to identify as the Magento web store owner. | -
| Last Name | -Enter the user's last name. | -
| Enter the user's email address. | -|
| Username | -Enter the Magento Admin Panel administrator's username. (You can create additional Magento administrators later.) | -
| Password | -Enter the user's password. | -
| Confirm Password | -Enter the user's password again for verification. | -
| Encryption Key | -If you have one, enter a key to encrypt sensitive data in the Magento database. If you don't have one, Magento generates one for you. - The encryption key is stored in [your Magento install dir]/app/etc/local.xml. |
-


To make sure Magento installed properly, you should log in to the Admin Panel to verify the Magento version.
-You can also import products into Magento or perform other tasks that verify you can write to the database.
-http://www.example.com/magento/admin-(The Admin Panel URL is a combination of the Base URL and Admin Path fields you entered when you installed Magento.

Congratulations! You successfully installed Magento!
- -Several Magento features require at least one cronjob, which schedules activities to occur in the future. A partial list of these activities follows:
-Crontab files define tasks (cronjobs) that are performed at scheduled dates and times. Each user on a system has its own crontab file, and the cron daemon runs each cronjob as the user who owns the crontab. For Magento, this user is the web server.
- -Magento recommends splitting your cronjob on two tasks in your crontab for best performance and completing your cronjobs without issues:
-malways mode) can take longer to execute and complete, skipping other cronjobs (mdefault mode) scheduled during the time that the indexer runs.mdefault scope may take longer to execute and complete, blocking others scheduled during the time it is still running.To split your malways and mdefault cronjob modes, use the following:
* * * * * /path/to/magento/cron.sh cron.php -mdefault -* * * * * /path/to/magento/cron.sh cron.php -malways- -
Determine which of your cronjobs may be long-running and move them into separate crontabs. For example, imports, exports, and indexes can run long, blocking other cronjobs scheduled in that crontab.
- -Magento recommends running cron every minute for EE and every five minutes for CE.
- -First, determine your web server's user. SSH into the server and enter the following command:
-ps -o "user group command" -C httpd,apache2-
In CentOS, the Apache user is typically apache. In Ubuntu, it's typically www-data. Enter this user in the commands for creating the crontabs and cronjobs.
We recommend splitting the cronjob between two tasks to prevent the indexer blocking other mdefault jobs or an mdefault job blocking the indexer. These instructions include these commands.
To create a cronjob as the user that runs Apache:
-crontab -u apache-user-name -e
* * * * * /bin/sh /path/to/magento/cron.sh cron.php -mdefault -* * * * * /bin/sh /path/to/magento/cron.sh cron.php -malways
* * * * * /bin/sh /var/www/html/magento/cron.sh cron.php -mdefault -* * * * * /bin/sh /var/www/html/magento/cron.sh cron.php -malways
* * * * * /bin/sh /path/to/magento/cron.sh
* * * * * /bin/sh /var/www/html/magento/cron.sh
:wp.To check if crons are running, you should see the following log files in the Magento directory about 10 minutes after the scheduled cron runs:
-./cron.php.log -./cron.sh.log -- -
To secure your Magento installation after the installation, see After You Install Magento: Recommended File System Ownership and Privileges.
- -This section discusses some suggestions for issues you might encounter when installing Magento.
-| Issue | -Suggested solution | -
|---|---|
| During the installation, errors like the following display: - Path "/var/www/html/magento/app/etc" must be writable. |
- Set privileges and ownership on the Magento installation directory and subdirectories as discussed in Setting File and Directory Ownership and Privileges. | -
| You never advance past the installer's Configuration page. | -Try selecting the Skip Base URL Validation Before the Next Step checkbox. If problems persist, get help. | -
-{% include m1x/eol_message.html %}
-
-
-This article discusses how to install required prerequisite software for CentOS. You must complete these tasks before you install Magento CE 1.8 or later or Magento EE 1.13 or later.
-Before you continue, make sure you familiarize yourself with the installation process discussed in Prerequisites.
-root privileges.It's a good practice to update your repositories and optionally update system software.
-Update repositories:
-yum -y update-
Optionally upgrade software. This might cause a system reboot.
-yum -y upgrade- -
Magento requires Apache use server rewrites. You must also specify the type of directives that can be used in .htaccess, which Magento uses to specify rewrite rules.
Installing and configuring Apache is basically a three-step process: install the software, enable rewrites, and specify .htaccess directives.
Install Apache 2 if you haven't already done so.
-yum -y install httpd- -
httpd.conf for editing.
- vim /etc/httpd/conf/httpd.conf
<Directory /var/www/html>
AllowOverride to All.httpd.conf and exit the text editor.service httpd restart
Magento CE and EE support the following PHP versions:
-We recommend you use the most recent PHP version supported by your version of Magento. For example, you should use PHP 5.5 with CE 1.9.1 or EE 1.14.1.
-For more information about PHP, see:
- -Check with a system administrator or reference for your version of CentOS to see what PHP versions are available.
-If you're installing Magento CE 1.9.1 or Magento EE 1.14.1, you can use PHP 5.5; otherwise, we recommend PHP 5.4. For certain versions of CE and EE, a patch is required to use PHP 5.4.
-Enter the following command to see what version of PHP is currently running:
-php -v-
See one of the following sections for more information:
- - -CentOS 6.x repositories have PHP 5.3. This section assumes you use either PHP 5.4 or 5.5. Make sure you understand which version of Magento CE or EE supports the PHP version to which you upgrade.
-Before you start, verify you have PHP 5.3 installed:
-php -v-
If you already have the desired PHP version installed, you don't have to do anything.
-If PHP is not installed, install PHP 5.3 using the following command:
-yum -y install php php-xml-
Continue with one of the following sections.
-There is more than one way to upgrade CentOS 6.5 to PHP 5.5; the following is a suggestion only. Consult a reference for additional options.
-Enter the following commands in the order shown.
-cd /tmp -rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm -yum -y remove php-common-5.3.3-40.el6_6.x86_64 -yum -y install php55w php55w-opcache-
Skip the next section and continue with Installing Required PHP Extensions.
- -Enter the following commands to upgrade to PHP 5.4:
-cd /tmp -rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm -rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm -yum --enablerepo=remi install httpd php php-common-
The following resources are also available:
- - -The names of the PHP extensions you must install depend on the repository from which you installed PHP. Use one of the following commands:
-PHP 5.5:
-yum -y install php55w-xml php55w-mcrypt php55w-gd php55w-devel php55w-mysql php55w-mbstring-
PHP 5.4:
-yum -y install --enablerepo=remi php-mcrypt gd gd-devel php-gd php-mysql php54w-mbstring- -
Increase memory_limit in php.ini to at least 512MB.
/etc/php.ini in a text editor.memory_limit to:
- memory_limit = 512M
This section discusses how to install and configure MySQL 5.6. CentOS 6.x repositories have MySQL 5.1; to install a different version of MySQL, see the MySQL documentation.
-The following procedure is based on Install MySQL Server 5.6 in CentOS 6.x and Red Hat 6.x Linux.
-cd /tmp -wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm -rpm -ivh mysql-community-release-el6-5.noarch.rpm -yum -y install mysql-server
service mysqld start-
root user and set other security-related options. Enter the following command and follow the prompts on your screen to complete the configuration.
- mysql_secure_installation
After installing the required prerequisite software, continue your installation with Preparing Your Server for Magento CE or EE.
-
-{% include m1x/eol_message.html %}
-
-
-This article discusses how to install required prerequisite software for Ubuntu. You must complete these tasks before you install Magento CE 1.8 or later or Magento EE 1.13 or later.
-Before you continue, make sure you familiarize yourself with the installation process discussed in Prerequisites.
-root privileges.It's a good practice to update your repositories and system software, if necessary.
-Log in to your Magento server as a user with root privileges and enter the commands shown in this section.
Update repositories:
-apt-get update-
Optionally upgrade software. This might require a system reboot.
-apt-get upgrade- -
This section discusses how to install Apache. For more details, you can consult a reference like the Ubuntu site.
-Magento requires Apache use server rewrites. You must also specify the type of directives that can be used in .htaccess, which Magento uses to specify rewrite rules.
Installing and configuring Apache is basically a three-step process: install the software, enable rewrites, and specify .htaccess directives.
Install Apache 2 if you haven't already done so:
-apt-get -y install apache2- -
Ubuntu 12 (which natively supports Apache 2.2) is different from Ubuntu 14 (which natively supports Apache 2.4).
-It's very important you choose a value for AllowOverride that is suited to your deployment. You can use AllowOverride All in development but it might not be desirable in production.
For more information, see one of the following references:
- - -Use this section to enable Apache rewrites and specify .htaccess if you use Apache 2.2, which is supported by the default Ubuntu 12 repository.
vim /etc/apache2/sites-available/default
<Directory /var/www/> - Options Indexes FollowSymLinks MultiViews - AllowOverride None - Order allow,deny - allow from all -</Directory>
AllowOverride to [value from Apache site].
-<Directory /var/www/> - Options Indexes FollowSymLinks MultiViews - AllowOverride All - Order allow,deny - allow from all -</Directory>
mod_rewrite module.cd /etc/apache2/mods-enabled -ln -s ../mods-available/rewrite.load
service apache2 restart
Use this section to enable Apache rewrites and specify .htaccess if you use Apache 2.4, which is supported by the default Ubuntu 14 repository.
a2enmod rewrite
.htaccess./etc/apache2/sites-available/000-default.conf000-default.conf:<Directory "/var/www"> -AllowOverride [value from Apache site] -</Directory>-Note: You must change the value of
AllowOverride in the directive for the directory to which you expect to install the Magento software. For example, to install in the web server docroot, edit the directive in <Directory /var/www>.service apache2 restartMagento CE and EE support the following PHP versions:
-We recommend you use the most recent PHP version supported by your version of Magento. For example, you should use PHP 5.5 with CE 1.9.1 or EE 1.14.1.
-For more information about PHP, see:
- -Check with a system administrator or reference for your version of Ubuntu to see what PHP versions are available.
-If you're installing Magento CE 1.9.1 or Magento EE 1.14.1, you can use PHP 5.5; otherwise, we recommend PHP 5.4. For certain versions of CE and EE, a patch is required to use PHP 5.4.
-Enter the following command to see what version of PHP is currently running:
-php -v-
See one of the following sections for more information:
-To upgrade your version of PHP, see one of the following:
- - -See one of the following sections:
- - -Use the following commands from dev-metal:
-add-apt-repository ppa:ondrej/php5 -apt-get update -sudo apt-get install php5- -
Use the following commands from askubuntu:
-add-apt-repository ppa:ondrej/php5-oldstable -apt-get update -apt-get upgrade -apt-get install php5- -
Enter the following command:
-apt-get -y install php5- -
Enter the following command to install PHP extensions required by Magento:
-apt-get -y install php5 php5-mhash php5-mcrypt php5-curl php5-cli php5-mysql php5-gd libapache2-mod-php5- -
Increase memory_limit in php.ini to at least 512MB:
/etc/php5/apache2/php.ini in a text editor.memory_limit to:
-memory_limit = 512M
Magento CE and EE support the following MySQL versions:
-Install the MySQL database:
-apt-get -y install mysql-client mysql-server- -
Only Magento CE 1.9.1 and EE 1.14.1 support MySQL 5.6. To install MySQL 5.6 on Ubuntu 14, see Installing MySQL 5.6 on Ubuntu 14. To install MySQL 5.6 on Ubuntu 12, see the next section.
- -To install MySQL 5.6 on Ubuntu 12, enter the following commands in the order shown:
-apt-add-repository ppa:ondrej/mysql-5.6 -apt-get -y update -apt-get -y install mysql-server-
Test the installation by entering the following command:
-mysql -u root -p-
Messages similar to the following display:
-Welcome to the MySQL monitor. Commands end with ; or \g. -Your MySQL connection id is 43 -Server version: 5.6.21-1+deb.sury.org~precise+1 (Ubuntu) - -Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. - -Oracle is a registered trademark of Oracle Corporation and/or its -affiliates. Other names may be trademarks of their respective -owners. - -Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. - -mysql>- -
To install MySQL 5.6 on Ubuntu 14, enter the following command:
-apt-get -y install mysql-server-5.6 mysql-client-5.6-
Test the installation by entering the following command:
-Welcome to the MySQL monitor. Commands end with ; or \g. -Your MySQL connection id is 45 -Server version: 5.6.19-0ubuntu0.14.04.1 (Ubuntu) - -Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. - -Oracle is a registered trademark of Oracle Corporation and/or its -affiliates. Other names may be trademarks of their respective -owners. - -Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. - -mysql>- - -
After installing the required prerequisite software, continue your installation with Preparing Your Server for Magento CE or EE.
- -
-{% include m1x/eol_message.html %}
-
-Magento recommends you upgrade your installation using the following guidelines in a development or test environment, separate from your existing production environment:
-When you're ready to start your upgrade, see Upgrading to and Verifying Magento Community Edition 1.8 and Enterprise Edition 1.13 - Part 2.
-
-{% include m1x/eol_message.html %}
-
-This article discusses how you upgrade to:
-Because of changes to URL rewrites, the following upgrades are more complex than other upgrades.
-This section discusses how to get ready for your upgrade by backing up the database and customizations on the file system. The steps that follow do not affect your current production system. You can continue serving customers with no downtime.
-To get ready for your upgrade:
-Complete the tasks discussed in the following sections in the order shown:
-Before you start your upgrade, you should enable exception logging so it will be enabled on the development system. Without exception logging, it will be more difficult to diagnose errors during your upgrade. You can disable exception logging after you've exported the Magento database.
-To enable exception logging:
-
Before upgrading to EE 1.13.0.2 or later, disable all running cron jobs. A simple way to stop cron jobs follows; consult an appropriate reference for other options.
-As a user with root privileges, enter one of the following commands:
service crond stopservice cron stopThis section applies to upgrading Magento EE only. Skip this section if you're using Magento CE.
-Because of the changes to indexing in Magento EE 1.13, you must set all indexers to update on save before you upgrade; otherwise, unpredictable performance will result. You can revert indexer settings after you've exported the Magento database.
-To set indexers to update on save:
-

Clear the Magento cache as follows:
-Back up your database using mysqldump or another tool. mysqldump syntax follows:
mysqldump -u root magento-database-name > export-file-name.sql- -
To archive your custom themes and extensions:
-media directory and all subdirectories. For example,cd [your Magento install dir] -tar -czf media.tgz media
[your Magento install dir]/app/design/frontend -[your Magento install dir]/skin/frontend
[your Magento install dir]/app/code/local -[your Magento install dir]/app/code/community
[your Magento install dir]/app/etc/local.xml to your development environment.After you've exported the Magento database and extensions, you can revert the configuration changes you made as discussed in these sections:
- - -In your development environment:
-magento subdirectory of that directory.magento subdirectory so if you want your Magento installation directory to be /var/www/magento, you don't need to do anything.magento using the following commands:mysql -u root -p-Enter the remaining commands at the
mysql> prompt
-create database magento; -GRANT USAGE ON *.* TO magento@localhost IDENTIFIED BY 'magento'; -GRANT ALL ON magento.* TO magento@localhost;-For MySQL versions later than 5.0.2 but earlier than 5.1.6, the following command is required: -
GRANT SUPER ON *.* TO 'magento'@'localhost';-Exit the MySQL command shell: -
exit-Verify the database exists using the following command: -
mysql -u magento -p magento-If an error displays, repeat the commands. If the command succeeded, enter
exit to return to the command prompt.getenforceEnforcing displays to confirm that SELinux is running.setsebool -P httpd_can_network_connect=1-Ubuntu -
setsebool -P apache2_can_network_connect=1
PHP 5.3 is currently the latest PHP version available in the default repositories for Ubuntu and CentOS. PHP 5.3 works with CE 1.8, CE 1.9, EE 1.13, and EE 1.14.
-We recommend PHP 5.4 for all of the preceding CE and EE versions because of the new features and changes in that release.
-CE 1.8 and EE 1.13 both require a PHP 5.4 patch. The patch is listed as PHP 5.4 Compatibility in the EE support portal.
- -Use the instructions on phpave.
- -Enter the following commands in the order shown as a user with root privileges:
cd /tmp -rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm -rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm -yum --enablerepo=remi install httpd php php-common-
The following resources are also available:
- - -Upgrade your Magento installation by completing all of the following tasks in the order shown:
-Before attempting your Magento upgrade, complete all the tasks discussed in:
- - -This section discusses how to extract the Magento archive in your development system and manually copy over your customizations, themes, and extensions.
-/var/www/magento, copy the archive to /var/www.tar -zxf archive-namemedia archive, overwriting the installation archive. You created the media archive as discussed in Getting Ready For Your Upgrade.media directory and all subdirectories. If you copy the media archive to the Magento installation directory on your development system, extracting it automatically replaces existing media subdirectory contents.media directory and subdirectories to media directory in your new Magento installation, overwriting the existing contents.[your Magento install dir]/app/design/frontend and [your Magento install dir]/skin/frontend directories, as appropriate, overwriting the existing contents.[your Magento install dir]/app/code/local and [your Magento install dir]/app/code/community directories, as appropriate, overwriting the existing contents.This section discusses how to:
-web/unsecure/base_url and web/secure/base_url in the core_config_data table to the development server's IP address or hostname.Import the production database data using your database manager tool.
-mysql syntax follows:
mysql -u root -p database-name < database-export-filename.sql-For example, if the database name is
magento and the database export file name is mangento-db-export.sql, enter
-mysql -u root -p magento < mangento-db-export.sql-
The following sections discuss how to change the base URL paths from http://prod.example.com to http://dev.example.com using SQL commands and phpmyadmin:
This section discusses how to update the secure and unsecure URLs of your webstores and store views in the Magento database. The following example assumes you have two URLs, which every Magento installation has by default. Depending on your setup, you could have more (for additional store views, Content Delivery Networks (CDNs) and so on.
-Use the following procedure to update all matching URLs in the database.
-To update the database with the development system's base URLs using SQL commands:
-mysql -u root -p-Enter the remaining commands at the mysql> prompt. -
use magento-db-name; -SELECT * FROM core_config_data WHERE path LIKE '%base_url%';
web/unsecure/base_url and web/secure/base_url.config_id for these rows.web/unsecure/base_url and web/secure/base_url:
-UPDATE core_config_data SET value='base-url' WHERE config_id=id1 or config_id=id2;-Example 1—
config_ids are the same: if your base URL is http://dev.example.com/, the config_id of the row containing web/unsecure/base_url is 354 and the config_id of the row containing web/secure/base_url is 355, enter:
-UPDATE core_config_data SET value='http://dev.example.com/' WHERE config_id=354 or config_id=355;-Example 2—
config_ids are different: Same as preceding example except that web/secure/base_url uses https://
-UPDATE core_config_data SET value='http://dev.example.com/' WHERE config_id=354; -UPDATE core_config_data SET value='https://dev.example.com/' WHERE config_id=355;
SELECT * FROM core_config_data WHERE path LIKE '%base_url%';
http://prod.example.com/view1/-Make sure to update the URL like the following: -
UPDATE core_config_data SET value='http://dev.example.com/view1/' WHERE config_id=377;
SELECT * FROM core_config_data WHERE path LIKE '%base_url%';
exit at the mysql> prompt and continue with Finishing the File System.This section discusses how to use phpmyadmin to change the values of the paths web/unsecure/base_url and web/secure/base_url in the core_config_data table to the development server's IP address or hostname.
dev-web-server-host-or-ip/phpmyadmin
-For example, if your web server address is http://dev.example.com, enter
-http://dev.example.com/phpmyadminroot user.%base_url% in the Value field.

web/unsecure/base_url.
-web/secure/base_url.This section applies to upgrading to EE 1.14.0.0 using the Solr search engine only. If you're upgrading to a different version—or if you're not using Solr—skip this section and continue with Finishing the File System.
-Because of changes to the Solr schema, you must copy two files from Magento to your Solr installation. Failure to do so might prevent products from displaying on your web store. After copying the files, you must also reindex the catalog search index.
-To update Solr:
-[your Magento install dir]/lib/Apache/Solr/conf/schema.xml -[your Magento install dir]/lib/Apache/Solr/conf/solrconfig.xml-
For example, if Magento is installed in /var/www/html/magento and the example Solr configuration is installed in the /etc/solr/apache-solr-3.6.2/example/solr/conf directory on the same host, enter:
cp /var/www/html/magento/lib/Apache/Solr/conf/solrconfig.xml /etc/solr/apache-solr-3.6.2/example/solr/conf -cp /var/www/html/magento/lib/Apache/Solr/conf/schema.xml /etc/solr/apache-solr-3.6.2/example/solr/conf
shell subdirectory of your Magento installation directory.cd /var/www/html/magento/shell
php indexer.php --reindex catalogsearch_fulltext
This section discusses how to edit copy local.xml and set file system permissions and ownership on the production system.
local.xml to [your Magento install dir]/app/etc.local.xml in a text editor.default_setup element, as follows:
-<default_setup> - <connection> - <host><![CDATA[change-if-necessary]]></host> - <username><![CDATA[change-if-necessary]]></username> - <password><![CDATA[change-if-necessary]]></password> - <dbname><![CDATA[change-if-necessary]]></dbname> - <initStatements><![CDATA[SET NAMES utf8]]></initStatements> - <model><![CDATA[mysql4]]></model> - <type><![CDATA[pdo_mysql]]></type> - <pdoType><![CDATA[]]></pdoType> - <active>1</active> - </connection> -</default_setup>
local.xml and exit the text editor.Magento recommends the following ownership and privilege settings for files and directories in the Magento installation directory:
-root).drwx------).-rw-------).Note: The way you set permissions and ownership depends on whether Magento is running on a dedicated or hosted system:
-root. The web server typically runs as an ordinary user. Magento assumes you log in as this user to start and stop the web server and that you already own all the files and directories in the Magento installation directory. You can use chmod to change permissions on files and directories.root and, as root, you can use the chown and chmod commands to set ownership and privileges in the Magento installation directory.To set privileges and ownership:
-#Ubuntu example -cd /var/www/magento - -#CentOS example -cd /var/www/html/magento
chown -R web-server-user-name .-For example, on Ubuntu where Apache usually runs as
www-data, enter
-chown -R www-data .
find . -type d -exec chmod 700 {} +
-find . -type f -exec chmod 600 {} +If you're upgrading to EE 1.14 from EE 1.13.0.0 or 1.13.0.1, see EE 1.13.1.0 Upgrade: Running the EE 1.13.0.0 or EE 1.13.0.1 URL Redirect Script now. When you're done, return here to continue your upgrade.
- -To complete the upgrade, go to your Magento base URL in a web browser. The first time you go to your Magento base URL, server-side scripts run to update the database. Depending on the amount of data in your database, this process can take a long time.
-If you're upgrading from a version earlier than CE 1.4 or EE 1.7, Magento strongly recommends the two-step upgrade approach discussed in Upgrade Path. In addition, you should expect the upgrade and testing process to take a long time and to expect more downtime for your production system.
-Complete the following tasks in the order shown:
-The first step in your upgrade is to run server-side upgrade scripts. Depending on the nature of your customizations and extensions, and how many customers and products are in your database, these scripts can take a long time to run and can result in exceptions. You must resolve all exceptions before continuing to the next step in the process.
-This step in the upgrade process is iterative; that is, you'll probably run through it more than once.
-To run the upgrade scripts:
-[your Magento install dir]/var/log.var/ subdirectories:
-rm -rf [your Magento install dir]/var/cache [your Magento install dir]/var/full_page_cache \ - [your Magento install dir]/var/locks [your Magento install dir]/var/session-
This section applies to upgrading from 1.13.0.1 only. If you're upgrading CE or if you're upgrading from a different EE version, continue with Setting Up the Magento Cron Job.
-After successfully running the Magento upgrade and fixing errors, enter the following command from the Magento root directory:
-php -f shell/indexer.php -- --reindexall-
This command runs a full reindex and it might take a long time, depending on the size of your database.
-After the reindex completes, enter the following command from your Magento installation directory:
-rm -rf var/cache var/full_page_cache var/locks-
Continue with Setting Up Magento Cron Jobs.
- -If you're upgrading to EE 1.14 from EE 1.12 or earlier, see EE 1.14 Upgrade: Running the EE 1.12 and Earlier URL Redirect Script now. When you're done, return here to continue your upgrade.
- - -You should now set up your Magento cron job as discussed here.
- -Run the following command to clean the Magento var/ subdirectories:
rm -rf [your Magento install dir]/var/cache [your Magento install dir]/var/full_page_cache [your Magento install dir]/var/locks-
After the cron job runs, all indexers should be in a Ready status. Before testing your upgrade, verify all indexers are Ready; otherwise, your testing will be inconclusive.
-To verify the status of indexers:
-
| Indexer status | -Suggested action | -
|---|---|
| Scheduled | -Wait for cron to finish or run http://magento-host-name/cron.php from a web browser. |
-
| Processing | -Wait for cron to finish or run If indexers are Processing for an extended period of time, run the command discussed in Clearing Magento var/ Subdirectories and refresh the Index Management page. |
-
After you have upgraded with no fatal errors or exceptions, Magento strongly recommends you thoroughly test the upgrade in your development environment as follows:
-The last step in upgrading is to take your production system offline and switching to your development system—which then becomes the production system from that point on.
-To switch from your production to development system:
-[your Magento install dir]/maintenance.flag.The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.Congratulations! You successfully upgraded! Review our welcome page to see the improvements you're getting.
- -To secure your Magento installation after the upgrade, see After You Install Magento: Recommended File System Ownership and Privileges.
- -There is a known issue after upgrading to EE 1.13.1 that affects you only if you do not follow the recommended procedure to upgrade to a new environment as discussed in Getting Ready For Your Upgrade.
-Symptom: After completing the upgrade, when you log in to the Admin Panel and click System > Configuration, a fatal error similar to the following displays in your browser:
-Class 'Mage_Googlecheckout_Helper_Data' not found in /var/www/html/magento/app/Mage.php on line 547- -
Solution:
-root privileges, delete all files except config.xml from the following directory:[your Magento install dir]/app/code/core/Mage/GoogleCheckout/etc
In the event of any other issue during the upgrade, see Getting Help With Your Installation or Upgrade.
- - - \ No newline at end of file diff --git a/guides/m1x/install/installing_upgrade_from-ee112.html b/guides/m1x/install/installing_upgrade_from-ee112.html deleted file mode 100644 index a61036a278..0000000000 --- a/guides/m1x/install/installing_upgrade_from-ee112.html +++ /dev/null @@ -1,173 +0,0 @@ ---- ---- - - - - - - - - - - - - - -
-{% include m1x/eol_message.html %}
-
-This article is part of the Magento Enterprise Edition (EE) upgrade documentation. If you're looking for something else, click here to go back to the Magento Knowledge Base.
-This article applies to the following Magento EE upgrades:
-If your upgrade is not in the preceding list, go back to Upgrading to and Verifying Magento Community Edition (CE) 1.8 and Enterprise Edition (EE) 1.13.
-This article discusses how to run the URL redirect script that creates HTTP 301 (Moved Permanently) redirects for any duplicate product URL keys. This enables Previous links in your web store to work, for example.
- -To create redirects for your URLs, perform the following tasks in the order shown:
-It's very important to stop cron jobs from running until after the upgrade script completes. To do so, enter one of the following commands as a user with root privileges:
service crond stopservice cron stopTo change indexer settings:
-
This section discusses how to run the URL redirect script to create permanent redirects for any URLs that changed in EE 1.13.1.0.
-To run the script:
-root or the web server user), enter the following command:php -f shell/url_migration_to_1_13.php - thread-count-where
php -f shell/url_migration_to_1_13.php 7-
[INFO]: Initialization... -[INFO]: Renaming conflicting entities... -100% [#################################################################################] -[INFO]: Creating redirects from previous version... -100% [#################################################################################] -ETA HH:MM:SS
watch -n1 "ps ax | grep umt | grep -v grep"-This command helps you to determine if each thread behaves correctly. After each process finishes, a new process should start immediately. There should be no delays or "hangs" between processes.
If errors display, check [your Magento install dir]/shell/migration.log for exceptions and see the following table.
Troubleshooting
-| Symptom | -Suggested action | -
|---|---|
ERROR: Scope of attribute "url_key" is set to Global. This may cause DB inconsistency. Aborting. |
- This error can be caused by either a product or category
|
-
| Other errors | -Try running the script again. If errors persist, contact Magento Support. | -
After successfully running the URL redirect script, enter the following command from the Magento root directory:
-php -f shell/indexer.php --reindexall-
This command runs a full reindex and it might take a long time, depending on the size of your database.
-After the reindex completes, enter the following command from your Magento installation directory:
-rm -rf var/cache var/full_page_cache var/locks- -
As a result of running the URL redirect script, a list of redirects created for duplicate URL keys displays in the Admin Panel. To view these redirects:
-1.12.0.2-1.13.x migration redirect-The following figure shows an example.

Assuming all your post-upgrade issues are fixed, go to your web store and navigate the category tree. Click some products and make sure they display properly. Verify that all Previous and Back links work properly.
- -Complete your upgrade:
-
-{% include m1x/eol_message.html %}
-
-This article is part of the Magento Enterprise Edition (EE) upgrade documentation. If you're looking for something else, click here to go back to the Magento Knowledge Base.
-This article applies to the following Magento EE upgrades:
-If your upgrade is not in the preceding list, skip this article and continue with Completing the Magento Upgrade.
-This article discusses how to run the URL redirect script that creates HTTP 301 (Moved Permanently) redirects for any duplicate product URL keys. This enables Previous links in your web store to work, for example.
-For more information about URL changes, see the EE 1.13.0.2 Release Notes. (Release Notes for the latest release are here.)
-To create redirects for your URLs, perform the following tasks in the order shown:
- - -It's very important to stop cron jobs from running until after the upgrade script completes. To do so, enter one of the following commands as a user with root privileges:
-This section discusses how to run the URL redirect script to create permanent redirects for any URLs that changed in EE 1.13.1.0.
-Note: The time the script takes to run and the amount of memory it uses is directly proportional to the size of your database.
-To run the script:
-php -f shell/url_migration_from_1_13_0_0_to_1_13_0_2.php[INFO]: Initialization... -[INFO]: Start url rewrites processing from 1.13.0.0 to 1.13.0.2 ... -[INFO]: Start root category "Default Category" processing ... -[INFO]: Start root category "test" processing ... -[INFO]: Executed in time
Troubleshooting
-If errors display, check [your Magento install dir]/shell/migration.log for exceptions. Following are errors that might display when you run the migration script:
-If one of these displays, make sure you copied [your Magento install dir]/app/etc/local.xml from your development system to the production system. Edit it if necessary to reference the production database instance. After you copy and edit local.xml, run the URL redirect script again.
-Continue your upgrade with Completing the Magento Upgrade.
-
-{% include m1x/eol_message.html %}
-
-This article discusses how to upgrade to:
-The following table provides basic information about how you perform your upgrade. More detailed information is discussed later in this article.
-| Edition and version | -Upgrade path | -
|---|---|
| CE 1.4 or earlier | -Your current CE version > CE 1.7 > CE 1.9.0.0 | -
| CE 1.5 or later | -Your current CE version > CE 1.9.0.0 | -
| EE 1.7 or earlier | -Your current EE version > EE 1.12 > EE 1.14.0.0 | -
| EE 1.8 or later | -Your current EE version > EE 1.14.0.0 | -
Because of changes to URL rewrites, the upgrade to Magento EE 1.13.0.2 or later is more complex than other upgrades. (This includes upgrading to Magento EE 1.14.)
-Follow are the specific versions affected:
-For more information about these upgrades, see Understanding the Upgrade to EE 1.13.0.2 or EE 1.14.
-Unless you're upgrading from an older CE version, skip the remainder of this article and continue with Upgrade Roadmap for Community Edition (CE).
- - -Provided you complete all tasks discussed in this article exactly as discussed, you can upgrade to Magento CE 1.9 or EE 1.14 from CE 1.5 or later or EE 1.8 or later.
-Important: Do not upgrade directly to this release if you're currently running CE 1.4 or earlier or EE 1.7 or earlier. A safer approach would be:
-To upgrade to CE 1.8, skip the remainder of this article and continue with Upgrading to and Verifying Magento Community Edition 1.8 and Enterprise Edition 1.13—Part 2.
-To upgrade from EE 1.13.0.2 to EE 1.13.1.0, skip the remainder of this article and continue with Upgrading to and Verifying Magento Community Edition 1.8 and Enterprise Edition 1.13—Part 2.
- -The following sections apply only to the following Magento EE upgrades:
-This section discusses why the upgrade to EE 1.13.0.2 or later requires you to perform different tasks than previous upgrades.
-One of the results of the change to the way URL keys are handled is that URLs for the same products or categories might need to change from the URLs in the version you're upgrading from. Following are scenarios that might cause URL keys to change:
-nike-shoes, one of them is changed to a URL key like nike-shoes-1 by the URL redirect scripts. This also resolves any conflicts (for example, if you already had another product with key nike-shoes-1).shoes category with URL key shoes in English store view, schuhe in the German store view and schuhe in the Swiss store view, the upgrade scripts change one of the category's URL keys to something like schuhe-1.To ensure customers and search engines will be directed to the correct page, Magento provides a script that creates HTTP 301 (Moved Permanently) redirects for URLs that are changed.
-In other words, after the upgrade, all pre-upgrade URLs work but they might be different than they were before you upgraded.
-The way you upgrade depends on what EE version you're starting from. The following roadmaps provide a high-level overview of the upgrade process:
- - -Following is a high-level roadmap to upgrade to EE 1.13.0.2 or later from EE 1.12 or earlier. This upgrade involves tasks not required for other Magento upgrades; these new tasks are indicated in the roadmap.
-media directory and subdirectories; all extensions and customizations; and all custom themes.media directory, extensions, themes, and other customizations to the development system.local.xml to [your Magento install dir]/app/etc and edit it if necessary to reference the production database instance.


cd [your Magento install dir] -php -f shell/url_migration_to_1_13.php - thread-count-thread-count is the number of CPU cores in your Magento server, minus 1, to a maximum of 15.

[your Magento install dir]/php -f shell/indexer.php -- --reindexall

[your Magento install dir]/var/cache /var/full_page_cache /var/locks
Step-by-step instructions for your upgrade start here.
- -Following is a high-level roadmap to upgrade to EE 1.13.0.2 or later from EE 1.13.0.1. This upgrade involves tasks not required for other Magento upgrades; these new tasks are indicated in the roadmap.
-media directory and subdirectories; all extensions and customizations; and all custom themes.media directory, extensions, themes, and other customizations to the development system.local.xml to [your Magento install dir]/app/etc and edit it if necessary to reference the production database instance.

[your Magento install dir]/php -f shell/url_migration_from_1_13_0_0_to_1_13_0_2.php

[your Magento install dir]/php -f shell/indexer.php -- --reindexall

[your Magento install dir]/var/cache /var/full_page_cache /var/locks
Important:
-Step-by-step instructions for your upgrade start here.
-
-{% include m1x/eol_message.html %}
-
-
-
-by Alan Storm, updated for Magento 1.12
- - - -What is Magento? It's the most powerful online eCommerce platform in the universe and is changing the face of eCommerce forever. :-)
- -Of course, you already know that. What you may not realize is Magento's also an object-oriented PHP Framework that can be used to develop modern, dynamic web applications that tap into Magento's powerful eCommerce features.
- -This is the first in a series of articles in which we're going to go on a whirlwind tour of Magento's programming framework features. Don't worry if you don't follow everything immediately. As you study the system more everything in this article will start to make sense, and you'll soon be the envy of your colleagues stuck working with more primitive PHP systems.
- -Or for the more visually oriented Magento_MVC.pdf.
- -Magento organizes its code into individual Modules. In a typical PHP Model-View-Controller (MVC) application, all the Controllers will be in one folder, all the Models in another, etc. In Magento, files are grouped together based on functionality, which are called modules in Magento.
- -For example, you'll find Controllers, Models, Helpers, Blocks, etc. related to Magento's checkout functionality in
-app/code/core/Mage/Checkout- -
You'll find Controllers, Models, Helpers, Blocks, etc. related to Magento's Google Checkout functionality in
-app/code/core/Mage/GoogleCheckout- -
When you want to customize or extend Magento, rather than editing core files directly, or even placing your new Controllers, Models, Helpers, Blocks, etc. next to Magento code, you'll create your own Modules in
-app/code/local/Package/Modulename- -
Package (also often referred to as a Namespace) is a unique name that identifies your company or organization. The intent is that each member of the world-wide Magento community will use their own Package name when creating modules in order to avoid colliding with another user's code.
- -When you create a new Module, you need to tell Magento about it. This is done by adding an XML file to the folder:
-app/etc/modules- -
There are two kinds of files in this folder, the first enables an individual Module, and is named in the form:
-Packagename_Modulename.xml - -The second is a file that will enable multiple Modules from a Package/Namespace, and is named in the form:
-Packagename_All.xml. Note it is only used by the core team with the file Mage_All.xml. It is not recommended to activate several modules in a single file, as this breaks the modularity of your modules. - - -Magento is a configuration-based MVC system. The alternative to this would a convention-based MVC system.
- -In a convention-based MVC system, if you wanted to add, say, a new Controller or maybe a new Model, you'd just create the file/class, and the system would pick it up automatically.
- -In a configuration-based system, like Magento, in addition to adding the new file/class to the codebase, you often need to explicitly tell the system about the new class, or new group of classes. In Magento, each Module has a file named config.xml. This file contains all the relevant configuration for a Magento Module. At runtime, all these files are loaded into one large configuration tree.
- -For example, want to use Models in your custom Module? You'll need to add some code to config.xml that tells Magento you want to use Models, as well as what the base class name for all your Models should be.
- -- <models> - <packagename> - <class>Packagename_Modulename_Model</class> - </packagename> - </models> --
The same goes for Helpers, Blocks, Routes for your Controllers, Event Handlers, and more. Almost anytime you want to tap into the power of the Magento system, you'll need to make some change or addition to your config file.
- - -In any PHP system, the main PHP entry point remains a PHP file. Magento is no different, and that file is index.php.
- -However, you never CODE in index.php. In an MVC system, index.php will contain code/calls to code that does the following:
-Examines the URL
Based on some set of rules, turns this URL into a Controller class and an Action method (called Routing)
Instantiates the Controller class and calls the Action method (called dispatching)
This means the practical entry point in Magento (or any MVC-based system) is a method in a Controller file. Consider the following URL:
- -http://example.com/catalog/category/view/id/25- -
Each portion of the path after the server name is parsed as follows.
- -The first portion of the URL is called the front name. This, more or less, tells magento which Module it can find a Controller in. In the above example, the front name is catalog, which corresponds to the Module located at:
-app/code/core/Mage/Catalog- -
The second portion of the URL tells Magento which Controller it should use. Each Module with Controllers has a special folder named 'controllers' which contains all the Controllers for a module. In the above example, the URL portion category is translated into the Controller file
-app/code/core/Mage/Catalog/controllers/CategoryController.php- -
Which looks like
-
-class Mage_Catalog_CategoryController extends Mage_Core_Controller_Front_Action
-{
-}
-
-
-All Controllers in the Magento cart application extend from Mage_Core_Controller_Front_Action.
- -Third in our URL is the action name. In our example, this is "view". The word "view" is used to create the Action Method. So, in our example, "view" would be turned into "viewAction"
- -
-class Mage_Catalog_CategoryController extends Mage_Core_Controller_Front_Action
-{
- public function viewAction()
- {
- //main entry point
- }
-}
-
-
-People familiar with the Zend Framework will recognize the naming convention here.
- -Any path portions after the action name will be considered key/value GET request variables. So, in our example, the "id/25" means there will get a GET variable named "id", with a value of "25".
- -As previously mentioned, if you want your Module to use Controllers, you'll need to configure them. Below is the configuration chunk that enables Controllers for the Catalog Module
- --<frontend> - <routers> - <catalog> - <use>standard</use> - <args> - <module>Mage_Catalog</module> - <frontName>catalog</frontName> - </args> - </catalog> - </routers> -</frontend> -- -
Don't worry too much about the specifics right now, but notice the
- -<frontName>catalog</frontName> - - -This is what links a Module with a URL frontname. Most Magento core Modules choose a frontname that is the same as their Module name, but this is not required.
- - -The routing described above is for the Magento cart application (often called the frontend). If Magento doesn't find a valid Controller/Action for a URL, it tries again, this time using a second set of Routing rules for the Admin application. If Magento doesn't find a valid Admin Controller/Action, it uses a special Controller named Mage_Cms_IndexController.
- -The CMS Controller checks Magento's content Management system to see if there's any content that should be loaded. If it finds some, it loads it, otherwise the user will be presented with a 404 page.
- -For example, the main magento "index" page is one that uses the CMS Controller, which can often throw newcomers for a loop.
- - -Now that we're in our Action method entry point, we'll want to start instantiating classes that do things. Magento offers a special way to instantiate Models, Helpers and Blocks using static factory methods on the global Mage class. For example:
- -
-Mage::getModel('catalog/product');
-Mage::helper('catalog/product');
-
-
-The string 'catalog/product' is called a Grouped Class Name. It's also often called a URI. The first portion of any Grouped Class Name (in this case, catalog), is used to lookup which Module the class resides in. The second portion ('product' above) is used to determine which class should be loaded.
- -So, in both of the examples above, 'catalog' resolves to the Module app/code/core/Mage/Catalog.
- -Meaning our class name will start with Mage_Catalog.
- -Then, product is added to get the final class name
- -
-Mage::getModel('catalog/product');
-Mage_Catalog_Model_Product
-
-Mage::helper('catalog/product');
-Mage_Catalog_Helper_Product
-
-
-These rules are bound by what's been setup in each Module's config file. When you create your own custom Module, you'll have your own grouped classnames (also calles classgroups) to work with Mage::getModel('myspecialprefix/modelname');.
- -You don't have to use Grouped Class Names to instantiate your classes. However, as we'll learn later, there are certain advantages to doing so.
- - - -Magento, like most frameworks these days, offers an Object Relational Mapping (ORM) system. ORMs get you out of the business of writing SQL and allow you to manipulate a datastore purely through PHP code. For example:
- -
-$model = Mage::getModel('catalog/product')->load(27);
-$price = $model->getPrice();
-$price += 5;
-$model->setPrice($price)->setSku('SK83293432');
-$model->save();
-
-
-In the above example we're calling the methods "getPrice" and "setPrice" on our Product. However, the Mage_Catalog_Model_Product class has no methods with these names. That's because Magento's ORM uses PHP's magic __call method to implement getters and setters.
- -Calling the method $product->getPrice(); will "get" the Model attribute "price".
- -Calling $product->setPrice(); will "set" the Model attribute "price". All of this assumes the Model class doesn't already have methods named getPrice or setPrice. If it does, the magic methods will be bypassed. If you're interested in the implementation of this, checkout the Varien_Object class, which all Models inherit from.
- -If you wanted to get all the available data on a Model, call $product->getData(); to get an array of all the attributes.
- -You'll also notice it's possible to chain together several calls to the set method:
-$model->setPrice($price)->setSku('SK83293432'); - -That's because each set method returns an instance of the Model. This is a pattern you'll see used in much of the Magento codebase.
- -Magento's ORM also contains a way to query for multiple Objects via a Collections interface. The following would get us a collection of all products that cost $5.00
- -
-$products_collection = Mage::getModel('catalog/product')
-->getCollection()
-->addAttributeToSelect('*')
-->addFieldToFilter('price','5.00');
-
-
-Again, you'll notice Magento's implemented a chaining interface here. Collections use the PHP Standard Library to implement Objects that have array like properties.
- -
-foreach($products_collection as $product)
-{
- echo $product->getName();
-}
-
-
-You may be wondering what the "addAttributeToSelect" method is for. Magento has two broad types of Model objects. One is a traditional "One Object, One Table" Active Record style Model. When you instantiate these Models, all attributes are automatically selected.
- -The second type of Model is an Entity Attribute Value (EAV) Model. EAV Models spread data across several different tables in the database. This gives the Magento system the flexibility to offer its flexible product attribute system without having to do a schema change each time you add an attribute. When creating a collection of EAV objects, Magento is conservative in the number of columns it will query for, so you can use addAttributeToSelect to get the columns you want, or addAttributeToSelect('*') to get all columns.
- - -Magento's Helper classes contain utility methods that will allow you to perform common tasks on objects and variables. For example:
> -$helper = Mage::helper('catalog'); - -You'll notice we've left off the second part of the grouped class name. Each Module has a default Data Helper class. The following is equivalent to the above:
-$helper = Mage::helper('catalog/data'); - -Most Helpers inherit form Mage_Core_Helper_Abstract, which gives you several useful methods by default.
-
-$translated_output = $helper->__('Magento is Great'); //gettext style translations
-if($helper->isModuleOutputEnabled()): //is output for this module on or off?
-
-
-
-
-So, we've seen Controllers, Models, and Helpers. In a typical PHP MVC system, after we've manipulated our Models we would
- -However, if you look at a typical Magento Controller action, you don't see any of this:
- -
-/**
- * View product gallery action
- */
-public function galleryAction()
-{
- if (!$this->_initProduct()) {
- if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
- $this->_redirect('');
- } elseif (!$this->getResponse()->isRedirect()) {
- $this->_forward('noRoute');
- }
- return;
- }
- $this->loadLayout();
- $this->renderLayout();
-}
-
-
-Instead, the Controller action ends with two calls
- --$this->loadLayout(); -$this->renderLayout(); -- -
So, the "V" in Magento's MVC already differs from what you're probably used to, in that you need to explicitly kick off rendering the layout.
- -The layout itself also differs. A Magento Layout is an object that contains a nested/tree collection of "Block" objects. Each Block object will render a specific bit of HTML. Block objects do this through a combination of PHP code, and including PHP .phtml template files.
- -Blocks objects are meant to interact with the Magento system to retrieve data from Models, while the phtml template files will produce the HTML needed for a page.
- -For example, the page header Block app/code/core/Mage/Page/Block/Html/Head.php uses the head.phtml file page/html/head.phtml.
- -Another way of thinking about it is the Block classes are almost like little mini-controllers, and the .phtml files are the view.
- -By default, when you call
- --$this->loadLayout(); -$this->renderLayout(); -- -
Magento will load up a Layout with a skeleton site structure. There will be Structure Blocks to give you your html, head, and body, as well as HTML to setup single or multiple columns of Layout. Additionally, there will be a few Content Blocks for the navigation, default welcome message, etc.
- -"Structure" and "Content" are arbitrary designations in the Layout system. A Block doesn't programmatically know if it's Structure or Content, but it's useful to think of a Block as one or the other.
- -To add Content to this Layout you need to tell the Magento system something like
- -"Hey, Magento, add these additional Blocks under the "content" Block of the skeleton"- -or - -
"Hey, Magento, add these additional Blocks under the "left column" Block of the skeleton"- -
This can be done programmatically in a Controller action
- -
-public function indexAction()
-{
- $this->loadLayout();
- $block = $this->getLayout()->createBlock('adminhtml/system_account_edit')
- $this->getLayout()->getBlock('content')->append($block);
- $this->renderLayout();
-}
-
-
-but more commonly (at least in the frontend cart application), is use of the XML Layout system.
- -The Layout XML files in a theme allow you, on a per Controller basis, to remove Blocks that would normally be rendered, or add Blocks to that default skeleton areas. For example, consider this Layout XML file:
- --<catalog_category_default> - <reference name="left"> - <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/> - </reference> -</catalog_category_default> -- -
It's saying in the catalog Module, in the category Controller, and the default Action, insert the catalog/navigation Block into the "left" structure Block, using the catalog/navigation/left.phtml template.
- -One last important thing about Blocks. You'll often see code in templates that looks like this:
-$this->getChildHtml('order_items') - -This is how a Block renders a nested Block. However, a Block can only render a child Block if the child Block is included as a nested Block in the Layout XML file. In the example above our catalog/navigation Block has no nested Blocks. This means any call to $this->getChildHtml() in left.phtml will render as blank.
- -If, however, we had something like:
--<catalog_category_default> - <reference name="left"> - <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"> - <block type="core/template" name="foobar" template="foo/baz/bar.phtml"/> - </block> - </reference> -</catalog_category_default> -- -
From the catalog/navigation Block, we'd be able to call
-$this->getChildHtml('foobar');Like any good object-oriented system, Magento implements an Event/Observer pattern for end users to hook into. As certain actions happen during a Page request (a Model is saved, a user logs in, etc.), Magento will issue an event signal.
- -When creating your own Modules, you can "listen" for these events. Say you wanted to get an email every time a certain customer logged into the store. You could listen for the "customer_login" event (setup in config.xml)
- --<events> - <customer_login> - <observers> - <unique_name> - <type>singleton</type> - <class>mymodule/observer</class> - <method>iSpyWithMyLittleEye</method> - </unique_name> - </observers> - </customer_login> -</events> -- -
and then write some code that would run whenever a user logged in:
- -
-class Packagename_Mymodule_Model_Observer
-{
- public function iSpyWithMyLittleEye($observer)
- {
- $data = $observer->getData();
- //code to check observer data for our user,
- //and take some action goes here
- }
-}
-
-
-
-Finally, the Magento System offers you the ability to replace Model, Helper and Block classes from the core modules with your own. This is a feature that's similar to "Duck Typing" or "Monkey Patching" in a language like Ruby or Python.
- -Here's an example to help you understand. The Model class for a product is Mage_Catalog_Model_Product.
- -Whenever the following code is called, a Mage_Catalog_Model_Product object is created
- -$product = Mage::getModel('catalog/product');
-
-This is a factory pattern.
- -What Magento's class override system does is allow you to tell the system
- -"Hey, whenever anyone asks for a catalog/product, instead of giving them a Mage_Catalog_Model_Product, -give them a Packagename_Modulename_Model_Foobazproduct instead".- -
Then, if you want, your Packagename_Modulename_Model_Foobazproduct class can extend the original product class
- -
-class Packagename_Modulename_Model_Foobazproduct extends Mage_Catalog_Model_Product
-{
-}
-
-
-Which will allow you to change the behavior of any method on the class, but keep the functionality of the existing methods.
- -class Packagename_Modulename_Model_Foobazproduct extends Mage_Catalog_Model_Product
-{
- public function validate()
- {
- //add custom validation functionality here
- return $this;
- }
-
-}
-
-
-As you might expect, this overriding (or rewriting) is done in the config.xml file.
- --<models> - <!-- does the override for catalog/product--> - <catalog> - <rewrite> - <product>Packagename_Modulename_Model_Foobazproduct</product> - </rewrite> - </catalog> -</models> -- -
One thing that's important to note here. Individual classes in your Module are overriding individual classes in other Modules. You are not, however, overriding the entire Module. This allows you to change specific method behavior without having to worry what the rest of the Module is doing.
- - - -We hope you've enjoyed this whirlwind tour of some of the features the Magento eCommerce system offers to developers. It can be a little overwhelming at first, especially if this is your first experience with a modern, object-oriented PHP system. If you start to get frustrated, take a deep breath, remind yourself that this is new, and new things are hard, but at the end of the day it's just a different way of coding. Once you get over the learning curve you'll find yourself loath to return to other, less powerful systems.
- -
-{% include m1x/eol_message.html %}
-
-by Alan Storm, updated for Magento 1.12
- - - - - -The config is the beating heart of the Magento System. It describes, in whole, almost any module, model, class, template, etc. than you'll need to access. It's a level of abstraction that most PHP developers aren't used to working with, and while it adds development time in the form of confusion and head scratching, it also allows you an unprecedented amount of flexibility as far as overriding default system behaviors go.
- -To start with, we're going to create a Magento module that will let us view the system config in our web browser. Follow along by copying and pasting the code below, it's worth going through on your own as a way to start getting comfortable with things you'll be doing while working with Magento, as well as learning key terminology.
- -We're going to be creating a Magento module. A module is a group of php and xml files meant to extend the system with new functionality, or override core system behavior. This may meaning adding additional data models to track sales information, changing the behavior of existing classes, or adding entirely new features.
- -It's worth noting that most of the base Magento system is built using the same module system you'll be using. If you look in
- -app/code/core/Mage- -
each folder is a separate module built by the Magento team. Together, these modules form the community shopping cart system you're using. Your modules should be placed in the following folder
- -app/code/local/Packagename- -
"Packagename" should be a unique string to Namespace/Package your code. It's an unofficial convention that this should be the name of your company. The idea is to pick a string that no one else in the world could possibly be using.
- -app/code/local/Microsoft- -
We'll use "Magentotutorial".
- -So, to add a module to your Magento system, create the following directory structure
- -app/code/local/Magentotutorial/Configviewer/Block -app/code/local/Magentotutorial/Configviewer/controllers -app/code/local/Magentotutorial/Configviewer/etc -app/code/local/Magentotutorial/Configviewer/Helper -app/code/local/Magentotutorial/Configviewer/Model -app/code/local/Magentotutorial/Configviewer/sql- -
You won't need all these folder for every module, but setting them all up now is a smart idea.
- -Next, there's two files you'll need to create. The first, config.xml, goes in the etc folder you just created.
- -app/code/local/Magentotutorial/Configviewer/etc/config.xml- -
The second file should be created at the following location
- -app/etc/modules/Magentotutorial_Configviewer.xml- -
The naming convention for this files is Packagename_Modulename.xml.
- -The config.xml file should contain the following XML. Don't worry too much about what all this does for now, we'll get there eventually
- --<config> - <modules> - <Magentotutorial_Configviewer> - <version>0.1.0</version> - </Magentotutorial_Configviewer> - </modules> -</config> -- -
Finally, Magentotutorial_Configviewer.xml should contain the following xml.
- --<config> - <modules> - <Magentotutorial_Configviewer> - <active>true</active> - <codePool>local</codePool> - </Magentotutorial_Configviewer> - </modules> -</config> -- -
That's it. You now have a bare bones module that won't do anything, but that Magento will be aware of. To make sure you've done everything right, do the following: -
Congratulations, you've built your first Magento module!
- - -Of course, this module doesn't do anything yet. When we're done, our module will -
First, we're going to add the following <global> section to our config.xml file.
- --<config> - <modules>...</modules> - <global> - <events> - <controller_front_init_routers> - <observers> - <Magentotutorial_configviewer_model_observer> - <type>singleton</type> - <class>Magentotutorial_Configviewer_Model_Observer</class> - <method>checkForConfigRequest</method> - </Magentotutorial_configviewer_model_observer> - </observers> - </controller_front_init_routers> - </events> - </global> -</config> -- -
Then, create a file at
- -Magentotutorial/Configviewer/Model/Observer.php- -
and place the following code inside
- -
-<?php
- class Magentotutorial_Configviewer_Model_Observer {
- const FLAG_SHOW_CONFIG = 'showConfig';
- const FLAG_SHOW_CONFIG_FORMAT = 'showConfigFormat';
-
- private $request;
-
- public function checkForConfigRequest($observer) {
- $this->request = $observer->getEvent()->getData('front')->getRequest();
- if($this->request->{self::FLAG_SHOW_CONFIG} === 'true'){
- $this->setHeader();
- $this->outputConfig();
- }
- }
-
- private function setHeader() {
- $format = isset($this->request->{self::FLAG_SHOW_CONFIG_FORMAT}) ?
- $this->request->{self::FLAG_SHOW_CONFIG_FORMAT} : 'xml';
- switch($format){
- case 'text':
- header("Content-Type: text/plain");
- break;
- default:
- header("Content-Type: text/xml");
- }
- }
-
- private function outputConfig() {
- die(Mage::app()->getConfig()->getNode()->asXML());
- }
- }
-
-
-That's it. Clear your Magento cache again and then load any Magento URL with a showConfig=true query string
- -http://magento.example.com/?showConfig=true- - -
You should be looking at a giant XML file. This describes the state of your Magento system. It lists all modules, models, classes, event listeners or almost anything else you could think of.
- -For example, consider the config.xml file you created above. If you search the XML file in your browser for the text Configviewer_Model_Observer you'll find your class listed. Every module's config.xml file is parsed by Magento and included in the global config.
- - -Right now this may seem esoteric, but this config is key to understanding Magento. Every module you'll be creating will add to this config, and anytime you need to access a piece of core system functionality, Magento will be referring back to the config to look something up.
- -A quick example: As an MVC developer, you've likely worked with some kind of helper class, instantiated something like
- --$helper_sales = new HelperSales(); -- -
One of the things Magento has done is abstract away PHP's class declaration. In Magento, the above code looks something like
- -
-$helper_sales = Mage::helper('sales');
-
-
-In plain english, the static helper method will: -
While this seems like a lot of work (and it is), the key advantage is by always looking to the config file for class names, we can override core Magento functionality without changing or adding to the core code. This level of meta programming, not usually found in PHP, allows you to cleanly extend only the parts of the system you need to.
diff --git a/guides/m1x/magefordev/mage-for-dev-3.html b/guides/m1x/magefordev/mage-for-dev-3.html deleted file mode 100644 index 5e09a7e138..0000000000 --- a/guides/m1x/magefordev/mage-for-dev-3.html +++ /dev/null @@ -1,318 +0,0 @@ ---- ---- - - - - - - - - - -
-{% include m1x/eol_message.html %}
-
-
-
-by Alan Storm, updated for Magento 1.12
- - -The Model-View-Controller (MVC) architecture traces its origins back to the Smalltalk Programming language and Xerox Parc. Since then, there have been many systems that describe their architecture as MVC. Each system is slightly different, but all have the goal of separating data access, business logic, and user-interface code from one another.
- -The architecture of most PHP MVC frameworks will looks something like this.
- -While this pattern was a great leap forward from the "each php file is a page" pattern established early on, for some software engineers, it's still an ugly hack. Common complaints are:
- -As you've probably guessed, the Magento team shares this world view and has created a more abstract MVC pattern that looks something like this:. - -
We'll eventually touch on each part of this request, but for now we're concerned with the Front Controller -> Routers -> Action Controller section. - -
Enough theory, it's time for Hello World. We're going to
-First, we'll create a directory structure for this module. Our directory structure should look as follows: - -
app/code/local/Magentotutorial/Helloworld/Block -app/code/local/Magentotutorial/Helloworld/controllers -app/code/local/Magentotutorial/Helloworld/etc -app/code/local/Magentotutorial/Helloworld/Helper -app/code/local/Magentotutorial/Helloworld/Model -app/code/local/Magentotutorial/Helloworld/sql -- -
Then create a configuration file for the module (at path app/code/local/Magentotutorial/Helloworld/etc/config.xml): -
-<config> - <modules> - <Magentotutorial_Helloworld> - <version>0.1.0</version> - </Magentotutorial_Helloworld> - </modules> -</config> -- -
Then create a file to activate the module (at path app/etc/modules/Magentotutorial_Helloworld.xml): -
-<config> - <modules> - <Magentotutorial_Helloworld> - <active>true</active> - <codePool>local</codePool> - </Magentotutorial_Helloworld> - </modules> -</config> -- -
Finally, we ensure the module is active: -
Next, we're going to configure a route. A route will turn a URL into an Action Controller and a method. Unlike other convention based PHP MVC systems, with Magento you need to explicitly define a route in the global Magento config. - -
In your config.xml file(at path app/code/local/Magentotutorial/Helloworld/etc/config.xml), add the following section: - -
-<config> - ... - <frontend> - <routers> - <helloworld> - <use>standard</use> - <args> - <module>Magentotutorial_Helloworld</module> - <frontName>helloworld</frontName> - </args> - </helloworld> - </routers> - </frontend> - ... -</config> -- -
We have a lot of new terminology here, let's break it down.
- -The <frontend> tag refers to a Magento Area. For now, think of Areas as individual Magento applications. The "frontend" Area is the public facing Magento shopping cart application. The "admin" Area is the private administrative console application. The "install" Area is the application you use to run though installing Magento the first time.
- -There's a famous quote about computer science, often attributed to Phil Karlton:
--- -"There are only two hard things in Computer Science: cache invalidation and naming things"
-
Magento, like all large systems, suffers from the naming problem in spades. You'll find there are many places in the global config, and the system in general, where the naming conventions seem unintuitive or even ambiguous. This is one of those places. Sometimes the <routers> tag will enclose configuration information about routers, other times it will enclose configuration information about the actual router objects that do the routing. This is going to seem counter intuitive at first, but as you start to work with Magento more and more, you'll start to understand its world view a little better. (Or, in the words of Han Solo, "Hey, trust me!").
- -When a router parses a URL, it gets separated as follows
- -http://example.com/frontName/actionControllerName/actionMethod/- -
So, by defining a value of "helloworld" in the <frontName> tags, we're telling Magento that we want the system to respond to URLs in the form of
- -http://example.com/helloworld/*- -
Many developers new to Magento confuse this frontName with the Front Controller object. They are not the same thing. The frontName belongs solely to routing.
- -This tag should be the lowercase version of you module name. Our module name is Helloworld, this tag is helloworld. Technically this tag defines our route name
- -You'll also notice our frontName matches our module name. It's a loose convention to have frontNames match the module names, but it's not a requirement. In your own modules, it's probably better to use a route name that's a combination of your module name and package name to avoid possible namespace collisions.
- -This module tag should be the full name of your module, including its package/namespace name. This will be used by the system to locate your Controller files.
- -One last step to go, and we'll have our Action Controller. Create a file at - -
app/code/local/Magentotutorial/Helloworld/controllers/IndexController.php- -
That contains the following - -
-<?php
-class Magentotutorial_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {
- public function indexAction() {
- echo 'Hello World';
- }
-}
-
-
-Clear your config cache, and load the following URL
- -http://example.com/helloworld/index/index- -
You should also be able to load
- -http://example.com/helloworld/index/ -http://example.com/helloworld/- -
You should see a blank page with the text "Hello World". Congratulations, you've setup your first Magento Controller!
- - -Action Controllers should be placed in a module's controllers (lowercase c) folder. This is where the system will look for them.
- -Remember the <module> tag back in config.xml? -
-<module>Magentotutorial_Helloworld</module> -- -
An Action Controller's name will -
All Action Controllers need Mage_Core_Controller_Front_Action as an ancestor.
- -As we previously mentioned, Magento URLs are routed (by default) as follows -
http://example.com/frontName/actionControllerName/actionMethod/- -
So in the URL -
http://example.com/helloworld/index/index- -
the URI portion "helloworld" is the frontName, which is followed by index (The Action Controller name), which is followed by another index, which is the name of the Action Method that will be called. (an Action of index will call the method public function indexAction(){...}.
- -If a URL is incomplete, Magento uses "index" as the default, which is why the following URLs are equivalent. -
-http://example.com/helloworld/index -http://example.com/helloworld -- -
If we had a URL that looked like this
-http://example.com/checkout/cart/add- -
Magento would
-Let's try adding a non-default method to our Action Controller. Add the following code to IndexController.php
- -
-public function goodbyeAction() {
- echo 'Goodbye World!';
-}
-
-
-And then visit the URL to test it out: -
http://example.com/helloworld/index/goodbye- -
Because we're extending the Mage_Core_Controller_Front_Action class, we get some methods for free. For example, additional URL elements are automatically parsed into key/value pairs for us. Add the following method to your Action Controller. - -
-public function paramsAction() {
- echo '<dl>';
- foreach($this->getRequest()->getParams() as $key=>$value) {
- echo '<dt><strong>Param:</strong>'.$key.'</dt>';
- echo '<dt><strong>Value: </strong>'.$value.'</dt>';
- }
- echo '</dl>';
-}
-
-
-and visit the following URL
-http://example.com/helloworld/index/params?foo=bar&baz=eof- -
You should see each parameter and value printed out.
- -Finally, what would we do if we wanted a URL that responded at -
http://example.com/helloworld/messages/goodbye- -
Here our Action Controller's name is messages, so we'd create a file at -
app/code/local/Magentotutorial/Helloworld/controllers/MessagesController.php- -
with an Action Controller named Magentotutorial_Helloworld_MessagesController and an Action Method that looked something like -
-public function goodbyeAction()
-{
- echo 'Another Goodbye';
-}
-
-
-And that, in a nutshell, is how Magento implements the Controller portion of MVC. While it's a little more complicated than other PHP MVC framework's, it's a highly flexible system that will allow you build almost any URL structure you want.
diff --git a/guides/m1x/magefordev/mage-for-dev-4.html b/guides/m1x/magefordev/mage-for-dev-4.html deleted file mode 100644 index ec76055920..0000000000 --- a/guides/m1x/magefordev/mage-for-dev-4.html +++ /dev/null @@ -1,487 +0,0 @@ ---- ---- - - - - - - - - - - -
-{% include m1x/eol_message.html %}
-
-
-
-by Alan Storm, updated for Magento 1.12
- - - - - - -Developers new to Magento are often confused by the Layout and View system. This article will take a look at Magento's Layout/Block approach, and show you how it fits into Magento MVC worldview.
- -Unlike many popular MVC systems, Magento's Action Controller does not pass a data object to the view or set properties on the view object (with a few exceptions). Instead, the View component directly references system models to get the information it needs for display.
- -One consequence of this design decision is that the View has been separated into Blocks and Templates. Blocks are PHP objects, Templates are "raw" PHP files (with a .phtml extension) that contain a mix of HTML and PHP (where PHP is used as a templating language). Each Block is tied to a single Template file. Inside a phtml file, PHP's $this keyword will contain a reference to the Template's Block object.
-Take a look at the default product Template at the file at
- -app/design/frontend/base/default/template/catalog/product/list.phtml- -
You'll see the following PHP template code.
- -
-<?php $_productCollection=$this->getLoadedProductCollection() ?>
-<?php if(!$_productCollection->count()): ?> <div class="note-msg">
- <?php echo $this->__("There are no products matching the selection.") ?>
-</div> <?php else: ?>
-...
-
-
-The getLoadedProductCollection method can be found in the Template's Block class, Mage_Catalog_Block_Product_List as shown: - -
File: app/code/core/Mage/Catalog/Block/Product/List.php- -
-...
-public function getLoadedProductCollection()
-{
- return $this->_getProductCollection();
-}
-...
-
-
-The block's _getProductCollection then instantiates models and reads their data, returning a result to the template.
- -The real power of Blocks/Templates come with the getChildHtml method. This allows you to include the contents of a secondary Block/Template inside of a primary Block/Template.
- -Blocks calling Blocks calling Blocks is how the entire HTML layout for your page is created. Take a look at the one column layout Template.
- -File: app/design/frontend/base/default/template/page/1column.phtml- -
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
-<head>
-<?php echo $this->getChildHtml('head') ?>
-</head>
-<body class="page-popup <?php echo $this->getBodyClass()?$this->getBodyClass():'' ?>">
- <?php echo $this->getChildHtml('content') ?>
- <?php echo $this->getChildHtml('before_body_end') ?>
- <?php echo $this->getAbsoluteFooter() ?>
-</body>
-
-
-The template itself is only 28 lines long. However, each call to $this->getChildHtml(...) will include and render another Block. These Blocks will, in turn, use getChildHtml to render other Blocks. It's Blocks all the way down.
- -So, Blocks and Templates are all well and good, but you're probably wondering
- -This is where the Layout Object enters the picture. The Layout Object is an XML object that will define which Blocks are included on a page, and which Block(s) should kick off the rendering process.
- -Last time we were echoing content directly from our Action Methods. This time let's create a simple HTML template for our Hello World module.
- -First, create a file at
- -app/design/frontend/base/default/layout/local.xml- -
with the following contents
- --<layout version="0.1.0"> - <default> - <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" /> - </default> -</layout> -- -
Then, create a file at
- -app/design/frontend/base/default/template/magentotutorial/helloworld/simple_page.phtml- -
with the following contents -
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
- <title>Hello World</title>
- <style type="text/css">
- body {
- background-color:#f00;
- }
- </style>
-</head>
-<body>
-
-</body>
-</html>
-
-
-Finally, each Action Controller is responsible for kicking off the layout process. We'll need to add two method calls to the Action Method.
- -
-public function indexAction() {
- //remove our previous echo
- //echo 'Hello Index!';
- $this->loadLayout();
- $this->renderLayout();
-}
-
-
-Clear your Magento cache and reload your Hello World controller page. You should now see a website with a bright red background and an HTML source that matches what's in simple_page.phtml.
- -So, that's a lot of voodoo and cryptic incantations. Let's take a look at what's going on.
- -First, you'll want to install the Layoutviewer module. This is a module similar to the Configviewer module you built in the Hello World article that will let us peek at some of Magento's internals.
- -Once you've installed the module (similar to how you setup the Configviewer module), go to the following URL
- -http://example.com/helloworld/index/index?showLayout=page- -
This is the layout xml for your page/request. It's made up of <block />, <reference /> and <remove /> tags. When you call the loadLayout method of your Action Controller, Magento will
- -Generate this Layout XML
Instantiate a Block class for each <block /> tag, looking up the class using the tag's type attribute as a global config path and store it in the internal _blocks array of the layout object, using the tag's name attribute as the array key.
If the <block /> tag contains an output attribute, its value is added to the internal _output array of the layout object.
Then, when you call the renderLayout method in your Action Controller, Magento will iterate over all the Blocks in the _output array, using the value of the output attribute as a callback method. This is always toHtml, and means the starting point for output will be that Block's Template.
- -The following sections will cover how Blocks are instantiated, how this layout file is generated, and finishes up with kicking off the output process.
- -So, within a Layout XML file, a <block /> has a "type" that's actually a Grouped Class Name URI
--<block type="page/html" ... -<block type="page/template_links" ... -- -
The URI references a location in the (say it with me) global config. The first portion of the URI (in the above examples page) will be used to query the global config to find the page class name. The second portion of the URI (in the two examples above, html and template_links) will be appended to the base class name to create the class name Magento should instantiate.
- -We'll go through page/html as an example. First, Magento looks for the global config node at file
- -app/code/core/Mage/Page/etc/config.xml- -
and finds -
-<page> - <class>Mage_Page_Block</class> -</page> -- -
This gives us our base class prefix Mage_Page_Block. Then, the second part of the URI (html) is appended to the class name to give us our final Block class name Mage_Page_Block_Html. This is the class that will be instantiated.
- -If we create a block with the same name as an already existing block, the new block instance will replace the original instance. This is what we've done in our local.xml file from above.
- --<layout version="0.1.0"> - <default> - <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" /> - </default> -</layout> -- -
The Block named root has been replaced with our Block, which points at a different phtml Template file.
- -<reference name="" /> will hook all contained XML declarations into an existing block with the specified name. Contained <block /> nodes will be assigned as child blocks to the referenced parent block.
- --<layout version="0.1.0"> - <default> - <block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml"> - <!-- ... sub blocks ... --> - </block> - </default> -</layout> -- -
In a different layout file:
- --<layout version="0.1.0"> - <default> - <reference name="root"> - <!-- ... another sub block ... --> - <block type="page/someothertype" name="some.other.block.name" template="path/to/some/other/template" /> - </reference> - </default> -</layout> -- -
Even though the root block is declared in a separate layout XML file, the new block is added as a child block. Magento initially creates a page/html Block named root. Then, when it later encounters the reference with the same name (root), it will assign the new block some.other.block.name as a child of the root block. -
- -So, we have a slightly better understanding of what's going on with the Layout XML, but where is this XML file coming from? To answer that question, we need to introduce two new concepts; Handles and the Package Layout.
- -Each page request in Magento will generate several unique Handles. The Layoutview module can show you these Handles by using a URL something like
- -http://example.com/helloworld/index/index?showLayout=handles- -
You should see a list similar to the following (depending on your configuration)
- -Each of these is a Handle. Handles are set in a variety of places within the Magento system. The two we want to pay attention to are default and helloworld_index_index. The default Handle is present in every request into the Magento system. The helloworld_index_index Handle is created by combining the route name (helloworld), Action Controller name (index), and Action Controller Action Method (index) into a single string. This means each possible method on an Action Controller has a Handle associated with it.
- -Remember that "index" is the Magento default for both Action Controllers and Action Methods, so the following request
- -http://example.com/helloworld/?showLayout=handles- -
Will also produce a Handle named helloworld_index_index
- -You can think of the Package Layout similar to the global config. It's a large XML file that contains every possible layout configuration for a particular Magento install. Let's take a look at it using the Layoutview module
- -http://example.com/helloworld/index/index?showLayout=package- -
This may take a while to load. If your browser is choking on the XML rendering, try the text format
- -http://example.com/helloworld/index/index?showLayout=package&showLayoutFormat=text- -
You should see a very large XML file. This is the Package Layout. This XML file is created by combining the contents of all the XML layout files for the current theme (or package). For the default install, this is at
- -app/design/frontend/base/default/layout/- -
Behind the scenes there are <frontend><layout><updates /> and <adminhtml><layout><updates /> sections of the global config that contains nodes with all the file names to load for the respective area. Once the files listed in the config have been combined, Magento will merge in one last xml file, local.xml. This is the file where you're able to add your customizations to your Magento install.
- -So, if you look at the Package Layout, you'll see some familiar tags such as <block /> and <reference />, but they're all surrounded by tags that look like
--<default /> -<catalogsearch_advanced_index /> -etc... -- -
These are all Handle tags. The Layout for an individual request is generated by grabbing all the sections of the Package Layout that match any Handles for the request. So, in our example above, our layout is being generated by grabbing tags from the following sections
- --<default /> -<STORE_bare_us /> -<THEME_frontend_default_default /> -<helloworld_index_index /> -<customer_logged_out /> -- -
There's one additional tag you'll need to be aware of in the Package Layout. The <update /> tag allows you to include another Handle's tags. For example
- --<customer_account_index> - <!-- ... --> - <update handle="customer_account"/> - <!-- ... --> -</customer_account_index> -- -
Is saying that requests with a customer_account_index Handle should include <blocks />s from the <customer_account /> Handle.
- - -OK, that's a lot of theory. Lets get back to what we did earlier. Knowing what we know now, adding
--<layout version="0.1.0"> - <default> - <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" /> - </default> -</layout> -- -
to local.xml means we've overridden the "root" tag. with a different Block. By placing this in the <default /> Handle we've ensured that this override will happen for every page request in the system. That's probably not what we want.
- - -If you go to any other page in your Magento site, you'll notice they're either blank white, or have the same red background that your hello world page does. Let's change your local.xml file so it only applies to the hello world page. We'll do this by changing default to use the full action name handle (helloworld_index_index).
- --<layout version="0.1.0"> - <helloworld_index_index> - <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" /> - </helloworld_index_index> -</layout> -- -
Clear your Magento cache, and the rest of your pages should be restored.
- -Right now this only applies to our index Action Method. Let's add it to the goodbye Action Method as well. In your Action Controller, modify the goodbye action so it looks like
-
-public function goodbyeAction() {
- $this->loadLayout();
- $this->renderLayout();
-}
-
-
-If you load up the following URL, you'll notice you're still getting the default Magento layout.
- -http://example.com/helloworld/index/goodbye- -
We need to add a Handle for the full action name (helloworld_index_goodbye) to our local.xml file. Rather than specify a new <block />, lets use the update tag to include the helloworld_index_index Handle.
- --<layout version="0.1.0"> - <!-- ... --> - <helloworld_index_goodbye> - <update handle="helloworld_index_index" /> - </helloworld_index_goodbye> -</layout> -- -
Loading the following pages (after clearing your Magento cache) should now produce identical results.
- -http://example.com/helloworld/index/index -http://example.com/helloworld/index/goodbye- -
In a standard configuration, output starts on the Block named root (because it has an output attribute). We've overridden root's Template with our own
- -template="magentotutorial/helloworld/simple_page.phtml"- -
Templates are referenced from the root folder of the current theme. In this case, that's
- -app/design/frontend/base/default- -
so we need to drill down to our custom page. Most Magento Templates are stored in
- -app/design/frontend/base/default/templates- -
Combining this gives us the full path
- -app/design/frontend/base/default/templates/magentotutorial/helloworld/simple_page.phtml- -
A simple red page is pretty boring. Let's add some content to this page. Change your <helloworld_index_index /> Handle in local.xml so it looks like the following
- --<helloworld_index_index> - <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml"> - <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/> - </block> -</helloworld_index_index> -- -
We're adding a new Block nested within our root. This is a Block that's distributed with Magento, and will display a customer registration form. By nesting this Block within our root Block, we've made it available to be pulled into our simple_page.html Template. Next, we'll use the Block's getChildHtml method in our simple_page.phtml file. Edit simple_page.html so it looks like this
- -
-<body>
- <?php echo $this->getChildHtml('customer_form_register'); ?>
-</body>
-
-
-Clear your Magento cache and reload the page and you should see the customer registration form on your red background. Magento also has a Block named top.links. Let's try including that. Change your simple_page.html file so it reads
- -
-<body>
- <h1>Links</h1>
- <?php echo $this->getChildHtml('top.links'); ?>
-</body>
-
-
-When you reload the page, you'll notice that your <h1>Links</h1> title is rendering, but nothing is rendering for top.links. That's because we didn't add it to local.xml. The getChildHtml method can only include Blocks that are specified as sub-Blocks in the Layout. This allows Magento to only instantiate the Blocks it needs, and also allows you to set difference Templates for Blocks based on context.
- -Let's add the top.links Block to our local.xml
- --<helloworld_index_index> - <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml"> - <block type="page/template_links" name="top.links"/> - <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/> - </block> -</helloworld_index_index> -- -
Clear your cache and reload the page. You should now see the top.links module.
- -There is one more important concept to cover before we wrap up this lesson, and that is the <action /> tag. Using the <action /> tag enables us to call public PHP methods of the block classes. So instead of changing the template of the root block by replacing the block instance with our own, we can use a call to setTemplate instead.
- --<layout version="0.1.0"> - <helloworld_index_index> - <reference name="root"> - <action method="setTemplate"> - <template>magentotutorial/helloworld/simple_page.phtml</template> - </action> - <block type="page/template_links" name="top.links"/> - <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/> - </reference> - </helloworld_index_index> -</layout> -- -
This layout XML will first set the template property of the root block, and then will add the two blocks we use as child blocks. Once we clear the cache, the result should look just as before. The benefit of using the <action /> is the same block instance is used that was created earlier, and all other parent/child associations still exist. For that reason this is a more upgrade proof way of implementing our changes.
- -All arguments to the action's method need to be wrapped in an individual child node of the <action /> tag. The name of that node doesn't matter, only the order of the nodes. We could have written the action node from the previous example as follows with the same effect. -
- --<action method="setTemplate"> - <some_new_template>magentotutorial/helloworld/simple_page.phtml</some_new_template> -</action> -- -
This is just to illustrate that the action's argument node names are arbitrary.
- -That covers Layout fundamentals. We have covered the tags <block />, <reference />, <update /> and <action />, and also layout update handles like <default /> and <cms_index_index />. These make up most of the layout configuration used in Magento. If you found it somewhat daunting, don't worry, you'll rarely need to work with layouts on such a fundamental level. Magento provides a number of pre-built layouts which can be modified and skinned to meet the needs of your store. Understanding how the entire Layout system works can be a great help when you're trouble shooting Layout issues, or adding new functionality to an existing Magento system.
diff --git a/guides/m1x/magefordev/mage-for-dev-5.html b/guides/m1x/magefordev/mage-for-dev-5.html deleted file mode 100644 index d47c4189ec..0000000000 --- a/guides/m1x/magefordev/mage-for-dev-5.html +++ /dev/null @@ -1,458 +0,0 @@ ---- ---- - - - - - - - - - - -
-{% include m1x/eol_message.html %}
-
-by Alan Storm, updated for Magento 1.12
- - - - - - -The implementation of a "Models Tier" is a huge part of any MVC framework. It represents the data of your application, and most applications are useless without data. Magento Models play an even bigger role, as they typically contain the "Business Logic" that's often relegated to the Controller or Helper methods in other PHP MVC frameworks.
- -If the definition of MVC is somewhat fuzzy, the definition of a Model is even fuzzier. Prior to the wide adoption of the MVC pattern by PHP developers, data access was usually raw SQL statements and/or an SQL abstraction layer. Developers would write queries and not think too much about what objects they were modeling.
- -In this day and age, raw SQL is mostly frowned upon, but many PHP frameworks are still SQL centric. Models will be objects that provide some layer of abstraction, but behind the scenes developers are still writing SQL and/or calling SQL like abstraction methods to read and write-down their data.
- -Other frameworks eschew SQL and take the Object Relational Mapping (ORM) approach. Here, a developer is dealing strictly with Objects. Properties are set, and when a save method is called on the Object, the data is automatically written to the database. Some ORMs will attempt to divine object properties from the database, others require the user to specify them in some way, (usually in an abstract data language such as YAML). One of the most famous and popular implementations of this approach is ActiveRecord.
- -This definition of ORM should suffice for now, but like everything Computer Science these days, the strict definition of ORM has blurred over the years. It's beyond the scope of this article to settle that dispute, but suffice it say we're generalizing a bit.
- -It should be no surprise that Magento takes the ORM approach. While the Zend Framework SQL abstractions are available, most of your data access will be via the built in Magento Models, and Models you build yourself. It should also come as no surprise that Magento has a highly flexible, highly abstract, concept of what a Model is.
- -Most Magento Models can be categorized in one of two ways. There's a basic, ActiveRecord-like/one-object-one-table Model, and there's also an Entity Attribute Value (EAV) Model. Each Model also gets a Model Collection. Collections are PHP objects used to hold a number of individual Magento Model instances. The Magento team has implemented the PHP Standard Library interfaces of IteratorAggregate and Countable to allow each Model type to have it's own collection type. If you're not familiar with the PHP Standard Library, think of Model Collections as arrays that also have methods attached.
- -Magento Models don't contain any code for connecting to the database. Instead, each Model uses a modelResource class, that is used to communicate with the database server (via one read and one write adapter object). By decoupling the logical Model and the code that talks to the database, it's theoretically possible to write new resource classes for a different database schemas and platforms while keeping your Models themselves untouched.
- -Something you should do in development—but never in production—is to enable Magento's developer mode which, among other things, displays exceptions in your browser. It's useful for debugging your code.
-Enable developer mode in any of the following ways:
-.htaccess in the Magento root directory file to add SetEnv MAGE_IS_DEVELOPER_MODE "true"To begin, we're going to create a basic Magento Model. PHP MVC tradition insists we model a weblog post. The steps we'll need to take are
- -You should be an old hat at creating empty modules at this point, so we'll skip the details and assume you can create an empty module named Weblog. After you've done that, we'll setup a route for an index Action Controller with an action named "testModel". As always, the following examples assume a Package Name of "Magentotutorial".
- -In `Magentotutorial/Weblog/etc/config.xml`, setup the following route
- --<frontend> - <routers> - <weblog> - <use>standard</use> - <args> - <module>Magentotutorial_Weblog</module> - <frontName>weblog</frontName> - </args> - </weblog> - </routers> -</frontend> -- -
And then add the following Action Controller in
-
-class Magentotutorial_Weblog_IndexController extends Mage_Core_Controller_Front_Action {
- public function testModelAction() {
- echo 'Setup!';
- }
-}
-
-
-at Magentotutorial/Weblog/controllers/IndexController.php. Clear your Magento cache and load the following URL to ensure everything's been setup correctly.
- -http://example.com/weblog/index/testModel- -
You should see the word "Setup" on a white background.
- -Magento has a system for automatically creating and changing your database schemas, but for the time being we'll just manually create a table for our Model.
- -Using the command-line or your favorite MySQL GUI application, create a table with the following schema
--CREATE TABLE `blog_posts` ( - `blogpost_id` int(11) NOT NULL auto_increment, - `title` text, - `post` text, - `date` datetime default NULL, - `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, - PRIMARY KEY (`blogpost_id`) -) -- -
And then populate it with some data
- -INSERT INTO `blog_posts` VALUES (1,'My New Title','This is a blog post','2010-07-01 00:00:00','2010-07-02 23:12:30');- -
There are three individual things we need to setup for a Model in our config.
- -When you instantiate a Model in Magento, you make a call like this
- -$model = Mage::getModel('weblog/blogpost');
-
-The first part of the URI you pass into get Model is the Model Group Name. Because it is a good idea to follow conventions, this should be the (lowercase) name of your module, or to be safeguarded against conflicts use the packagename and modulename (also in lowercase). The second part of the URI is the lowercase version of your Model name.
- -So, let's add the following XML to our module's `config.xml`.
--<global> - <!-- ... --> - <models> - <weblog> - <class>Magentotutorial_Weblog_Model</class> - <!-- - need to create our own resource, can't just - use core_resource - --> - <resourceModel>weblog_resource</resourceModel> - </weblog> - </models> - <!-- ... --> -</global> -- -
The outer <weblog /> tag is your Group Name, which should match your module name. <class /> is the BASE name all Models in the weblog group will have, also called Class Prefix. The <resourceModel /> tag indicates which Resource Model that weblog group Models should use. We talk more about this later on in this page. For now, remember your Group Name and the literal string "resource".
- -So, we're not done yet, but let's see what happens if we clear our Magento cache and attempt to instantiate a blogpost Model. In your `testModelAction` method, use the following code
-
- public function testModelAction() {
- $blogpost = Mage::getModel('weblog/blogpost');
- echo get_class($blogpost);
- }
-
-
-and reload your page. You should see an error like the following:
- --include(Magentotutorial/Weblog/Model/Blogpost.php) [function.include]: failed to open stream: No such file or directory -- -
By attempting to retrieve a weblog/blogpost Model, you told Magento to instantiate a class with the name
- --Magentotutorial_Weblog_Model_Blogpost -- -
Magento is trying to __autoload include this Model, but can't find the file. Let's create it! Create the following class at the following location
- -File: app/code/local/Magentotutorial/Weblog/Model/Blogpost.php-
-class Magentotutorial_Weblog_Model_Blogpost extends Mage_Core_Model_Abstract
-{
- protected function _construct()
- {
- $this->_init('weblog/blogpost');
- }
-}
-
-
-Reload your page, and the exception should be replaced with the name of your class.
- -All basic Models that interact with the database should extend the Mage_Core_Model_Abstract class. This abstract class forces you to implement a single method named _construct (NOTE: this is not PHP's constructor __construct). This method should call the class's _init method with the same identifying URI you'll be using in the Mage::getModel method call.
- -So, we've setup our Model. Next, we need to setup our Model Resource. Model Resources contain the code that actually talks to our database. In the last section, we included the following in our config.
- --<resourceModel>weblog_resource</resourceModel> -- -
The value in <resourceModel /> will be used to instantiate a Model Resource class. Although you'll never need to call it yourself, when any Model in the weblog group needs to talk to the database, Magento will make the following method call to get the Model resource
- -
-Mage::getResourceModel('weblog/blogpost');
-
-
-Again, weblog is the Group Name, and blogpost is the Model. The Mage::getResourceModel method will use the weblog/blogpost URI to inspect the global config and pull out the value in <resourceModel> (in this case, weblog_resource). Then, a model class will be instantiated with the following URI
- --weblog_resource/blogpost -- -
So, if you followed that all the way, what this means is, resource models are configured in the same section of the XML config as normal Models. This can be confusing to newcomers and old-hands alike.
- -So, with that in mind, let's configure our resource. In our <models> section add
- --<global> - <!-- ... --> - <models> - <!-- ... --> - <weblog_resource> - <class>Magentotutorial_Weblog_Model_Resource</class> - </weblog_resource> - </models> -</global> -- -
You're adding the <weblog_resource /> tag, which is the value of the <resourceModel /> tag you just setup. The value of <class /> is the base name that all your resource models will have, and should be named with the following format
- --Packagename_Modulename_Model_Resource -- -
So, we have a configured resource, let's try loading up some Model data. Change your action to look like the following
- -
-public function testModelAction() {
- $params = $this->getRequest()->getParams();
- $blogpost = Mage::getModel('weblog/blogpost');
- echo("Loading the blogpost with an ID of ".$params['id']);
- $blogpost->load($params['id']);
- $data = $blogpost->getData();
- var_dump($data);
-}
-
-
-And then load the following URL in your browser (after clearing your Magento cache)
- -http://example.com/weblog/index/testModel/id/1- -
You should see an exception something like the following
- -Warning: include(Magentotutorial/Weblog/Model/Resource/Blogpost.php) [function.include]: failed to open stream: No such file ....- -
As you've likely intuited, we need to add a resource class for our Model. Every Model has its own resource class. Add the following class at the following location
- -File: app/code/local/Magentotutorial/Weblog/Model/Resource/Blogpost.php-
-class Magentotutorial_Weblog_Model_Resource_Blogpost extends Mage_Core_Model_Resource_Db_Abstract{
- protected function _construct()
- {
- $this->_init('weblog/blogpost', 'blogpost_id');
- }
-}
-
-
-Again, the first parameter of the init method is the URL used to identify the Model. The second parameter is the database field that uniquely identifies any particular column. In most cases, this should be the primary key. Clear your cache, reload, and you should see
- -Can't retrieve entity config: weblog/blogpost- -
Another exception! When we use the Model URI weblog/blogpost, we're telling Magento we want the Model Group weblog, and the blogpost Entity. In the context of simple Models that extend Mage_Core_Model_Resource_Db_Abstract, an entity corresponds to a table. In this case, the table named blog_post that we created above. Let's add that entity to our XML config.
- -- <models> - <!-- ... ---> - <weblog_resource> - <class>Magentotutorial_Weblog_Model_Resource</class> - <entities> - <blogpost> - <table>blog_posts</table> - </blogpost> - </entities> - </weblog_resource> - </models> -- -
We've added a new <entities /> section to the resource Model section of our config. This, in turn, has a section named after our entity (<blogpost />) that specifies the name of the database table we want to use for this Model.
- -Clear your Magento cache, cross your fingers, reload the page and ...
- -Loading the blogpost with an ID of 1 - -array - 'blogpost_id' => string '1' (length=1) - 'title' => string 'My New Title' (length=12) - 'post' => string 'This is a blog post' (length=19) - 'date' => string '2009-07-01 00:00:00' (length=19) - 'timestamp' => string '2009-07-02 16:12:30' (length=19) -- -
Eureka! We've managed to extract our data and, more importantly, completely configure a Magento Model.
- -All Magento Models inherit from the Varien_Object class. This class is part of the Magento system library and not part of any Magento core module. You can find this object at
- -lib/Varien/Object.php- -
Magento Models store their data in a protected _data property. The Varien_Object class gives us several methods we can use to extract this data. You've already seen getData, which will return an array of key/value pairs. This method can also be passed a string key to get a specific field.
- -
-$model->getData();
-$model->getData('title');
-
-
-There's also a getOrigData method, which will return the Model data as it was when the object was initially populated, (working with the protected _origData method).
- -
-$model->getOrigData();
-$model->getOrigData('title');
-
-
-The Varien_Object also implements some special methods via PHP's magic __call method. You can get, set, unset, or check for the existence of any property using a method that begins with the word get, set, unset or has and is followed by the camel cased name of a property.
- -
-$model->getBlogpostId();
-$model->setBlogpostId(25);
-$model->unsBlogpostId();
-if($model->hasBlogpostId()){...}
-
-
-For this reason, you'll want to name all your database columns with lower case characters and use underscores to separate characters.
- -Magento Models support the basic Create, Read, Update, and Delete functionality of CRUD with load, save, and delete methods. You've already seen the load method in action. When passed a single parameter, the load method will return a record whose id field (set in the Model's resource) matches the passed in value.
- -$blogpost->load(1);- -
The save method will allow you to both INSERT a new Model into the database, or UPDATE an existing one. Add the following method to your Controller
- -
-public function createNewPostAction() {
- $blogpost = Mage::getModel('weblog/blogpost');
- $blogpost->setTitle('Code Post!');
- $blogpost->setPost('This post was created from code!');
- $blogpost->save();
- echo 'post with ID ' . $blogpost->getId() . ' created';
-}
-
-
-and then execute your Controller Action by loading the following URL
- -http://example.com/weblog/index/createNewPost- -
You should now see an additional saved post in your database table. Next, try the following to edit your post
- -
-public function editFirstPostAction() {
- $blogpost = Mage::getModel('weblog/blogpost');
- $blogpost->load(1);
- $blogpost->setTitle("The First post!");
- $blogpost->save();
- echo 'post edited';
-}
-
-
-And finally, you can delete your post using very similar syntax.
- -
-public function deleteFirstPostAction() {
- $blogpost = Mage::getModel('weblog/blogpost');
- $blogpost->load(1);
- $blogpost->delete();
- echo 'post removed';
-}
-
-
-So, having a single Model is useful, but sometimes we want to grab list of Models. Rather than returning a simple array of Models, each Magento Model type has a unique collection object associated with it. These objects implement the PHP IteratorAggregate and Countable interfaces, which means they can be passed to the count function, and used in for each constructs.
- -We'll cover Collections in full in a later article, but for now let's look at basic setup and usage. Add the following action method to your Controller, and load it in your browser.
- -
-public function showAllBlogPostsAction() {
- $posts = Mage::getModel('weblog/blogpost')->getCollection();
- foreach($posts as $blogpost){
- echo '<h3>'.$blogpost->getTitle().'</h3>';
- echo nl2br($blogpost->getPost());
- }
-}
-
-
-Load the action URL,
- -http://example.com/weblog/index/showAllBlogPosts- -
and you should see a (by now) familiar exception.
- -Warning: include(Magentotutorial/Weblog/Model/Resource/Blogpost/Collection.php) [function.include]: failed to open stream- -
You're not surprised, are you? We need to add a PHP class file that defines our Blogpost collection. Every Model has a protected property named _resourceCollectionName that contains a URI that's used to identify our collection.
- -- protected '_resourceCollectionName' => string 'weblog/blogpost_collection' -- -
By default, this is the same URI that's used to identify our Resource Model, with the string "_collection" appended to the end. Magento considers Collections part of the Resource, so this URI is converted into the class name.
- -Magentotutorial_Weblog_Model_Resource_Blogpost_Collection- -
Add the following PHP class at the following location
-File: app/code/local/Magentotutorial/Weblog/Model/Resource/Blogpost/Collection.php-
-class Magentotutorial_Weblog_Model_Resource_Blogpost_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
- protected function _construct()
- {
- $this->_init('weblog/blogpost');
- }
-}
-
-
-Just as with our other classes, we need to init our Collection with the Model URI. (weblog/blogpost). Rerun your Controller Action, and you should see your post information.
- -Congratulations, you've created and configured your first Magento Model. In a later article we'll take a look at Magento's Entity Attribute Value Models (EAV), which expand on what we've learned here.
- - \ No newline at end of file diff --git a/guides/m1x/magefordev/mage-for-dev-6.html b/guides/m1x/magefordev/mage-for-dev-6.html deleted file mode 100644 index bb1fbea0bb..0000000000 --- a/guides/m1x/magefordev/mage-for-dev-6.html +++ /dev/null @@ -1,408 +0,0 @@ ---- ---- - - - - - - - - - - -
-{% include m1x/eol_message.html %}
-
-by Alan Storm, updated for Magento 1.12
- - - - - - -On any fast paced software development project, the task of keeping the development and production databases in sync become a sticky wicket. Magento offers a system to create versioned resource migration scripts that can help your team deal with this often contentious part of the development process.
- -In the ORM article we created a model for a weblog post. At the time, we ran our CREATE TABLE statements directly against the database. This time, we'll create a Setup Resource for our module that will create the table for us. We'll also create an upgrade script for our module that will update an already installed module. The steps we'll need to take are
- -So, let's continue with the weblog module we created last time. In our <global /> section, add the following
- --<global> - <!-- ... --> - <resources> - <weblog_setup> - <setup> - <module>Magentotutorial_Weblog</module> - <class>Magentotutorial_Weblog_Model_Resource_Setup</class> - </setup> - </weblog_setup> - </resources> - <!-- ... --> -</global> -- -
The <weblog_setup> tag will be used to uniquely identify this Setup Resource. It's encouraged, but not necessary, that you use the modelname_setup naming convention. The <module>Magentotutorial_Weblog</module> tag block should contain the Packagename_Modulename of your module. Finally, <class>Magentotutorial_Weblog_Model_Resource_Setup</class> should contain the name of the class we'll be creating for our Setup Resource. For basic setup scripts it's not necessary to create a custom class, but by doing it now you'll give yourself more flexibility down the line.
- -After adding the above section to your config, clear your Magento cache and try to load any page of your Magento site. You'll see an exception something like
- -Fatal error: Class 'Magentotutorial_Weblog_Model_Resource_Setup' not found in- -
Magento just tried to instantiate the class you specified in your config, but couldn't find it. You'll want to create the following file, with the following contents.
- -File: app/code/local/Magentotutorial/Weblog/Model/Resource/Setup.php
-
-class Magentotutorial_Weblog_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
-}
-
-
-Now, reload any page of your Magento site. The exception should be gone, and your page should load as expected.
- -Next, we'll want to create our installer script. This is the script that will contain any CREATE TABLE or other SQL code that needs to be run to initialize our module.
- -First, take a look at your config.xml file
- --<modules> - <Magentotutorial_Weblog> - <version>0.1.0</version> - </Magentotutorial_Weblog> -</modules> -- -
This section is required in all config.xml files, and identifies the module as well as the its version number. Your installer script's name will be based on this version number. The following assumes the current version of your module is 0.1.0.
- -Create the following file at the following location
- -File: app/code/local/Magentotutorial/Weblog/sql/weblog_setup/mysql4-install-0.1.0.php
-
-echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
-die("Exit for now");
-
-
-The weblog_setup portion of the path should match the tag you created in your config.xml file (<weblog_setup />). The 0.1.0 portion of the filename should match the starting version of your module. Clear your Magento cache and reload any page in your Magento site and you should see something like
- --Running This Upgrade: Magentotutorial_Weblog_Model_Resource_Setup -Exit for now - ... -- -
Which means your update script ran. Eventually we'll put our SQL update scripts here, but for now we're going to concentrate on the setup mechanism itself. Remove the "die" statement from your script so it looks like the following
- -echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";- -
Reload your page. You should see your upgrade message displayed at the top of the page. Reload again, and your page should be displayed as normal.
- -Magento's Setup Resources allow you to simply drop your install scripts (and upgrade scripts, which we'll get to in a bit) onto the server, and have the system automatically run them. This allows you to have all your database migrations scripts stored in the system in a consistent format.
- -Using your favorite database client, take a look at the core_setup table
- -mysql> select * from core_resource; - +-------------------------+------------+--------------+ - | code | version | data_version | - +-------------------------+------------+--------------+ - | adminnotification_setup | 1.6.0.0 | 1.6.0.0 | - | admin_setup | 1.6.1.0 | 1.6.1.0 | - | api2_setup | 1.0.0.0 | 1.0.0.0 | - | api_setup | 1.6.0.0 | 1.6.0.0 | - | backup_setup | 1.6.0.0 | 1.6.0.0 | - | bundle_setup | 1.6.0.0.1 | 1.6.0.0.1 | - | captcha_setup | 1.7.0.0.0 | 1.7.0.0.0 | - | catalogindex_setup | 1.6.0.0 | 1.6.0.0 | - | cataloginventory_setup | 1.6.0.0.2 | 1.6.0.0.2 | - | catalogrule_setup | 1.6.0.3 | 1.6.0.3 | - | catalogsearch_setup | 1.6.0.0 | 1.6.0.0 | - | catalog_setup | 1.6.0.0.14 | 1.6.0.0.14 | - | checkout_setup | 1.6.0.0 | 1.6.0.0 | - | cms_setup | 1.6.0.0.1 | 1.6.0.0.1 | - | compiler_setup | 1.6.0.0 | 1.6.0.0 | - | contacts_setup | 1.6.0.0 | 1.6.0.0 | - | core_setup | 1.6.0.2 | 1.6.0.2 | - | cron_setup | 1.6.0.0 | 1.6.0.0 | - | customer_setup | 1.6.2.0.1 | 1.6.2.0.1 | - | dataflow_setup | 1.6.0.0 | 1.6.0.0 | - | directory_setup | 1.6.0.1 | 1.6.0.1 | - | downloadable_setup | 1.6.0.0.2 | 1.6.0.0.2 | - | eav_setup | 1.6.0.0 | 1.6.0.0 | - | giftmessage_setup | 1.6.0.0 | 1.6.0.0 | - | googleanalytics_setup | 0.1.0 | 0.1.0 | - | googlecheckout_setup | 1.6.0.1 | 1.6.0.1 | - | importexport_setup | 1.6.0.2 | 1.6.0.2 | - | index_setup | 1.6.0.0 | 1.6.0.0 | - | log_setup | 1.6.0.0 | 1.6.0.0 | - | moneybookers_setup | 1.6.0.0 | 1.6.0.0 | - | newsletter_setup | 1.6.0.1 | 1.6.0.1 | - | oauth_setup | 1.0.0.0 | 1.0.0.0 | - | paygate_setup | 1.6.0.0 | 1.6.0.0 | - | payment_setup | 1.6.0.0 | 1.6.0.0 | - | paypaluk_setup | 1.6.0.0 | 1.6.0.0 | - | paypal_setup | 1.6.0.2 | 1.6.0.2 | - | persistent_setup | 1.0.0.0 | 1.0.0.0 | - | poll_setup | 1.6.0.0 | 1.6.0.0 | - | productalert_setup | 1.6.0.0 | 1.6.0.0 | - | rating_setup | 1.6.0.0 | 1.6.0.0 | - | reports_setup | 1.6.0.0.1 | 1.6.0.0.1 | - | review_setup | 1.6.0.0 | 1.6.0.0 | - | salesrule_setup | 1.6.0.3 | 1.6.0.3 | - | sales_setup | 1.6.0.7 | 1.6.0.7 | - | sendfriend_setup | 1.6.0.0 | 1.6.0.0 | - | shipping_setup | 1.6.0.0 | 1.6.0.0 | - | sitemap_setup | 1.6.0.0 | 1.6.0.0 | - | tag_setup | 1.6.0.0 | 1.6.0.0 | - | tax_setup | 1.6.0.3 | 1.6.0.3 | - | usa_setup | 1.6.0.1 | 1.6.0.1 | - | weblog_setup | 0.1.0 | 0.1.0 | - | weee_setup | 1.6.0.0 | 1.6.0.0 | - | widget_setup | 1.6.0.0 | 1.6.0.0 | - | wishlist_setup | 1.6.0.0 | 1.6.0.0 | - | xmlconnect_setup | 1.6.0.0 | 1.6.0.0 | - +-------------------------+------------+--------------+ - 55 rows in set (0.00 sec) -- -
This table contains a list of all the installed modules, along with the installed version number. You can see our module near the end
- -| weblog_setup | 0.1.0 | 0.1.0 |- -
This is how Magento knows not to re-run your script on the second, and on all successive, page loads. The weblog_setup is already installed, so it won't be updated. If you want to re-run your installer script (useful when you're developing), just delete the row for your module from this table. Let's do that now, and actually add the SQL to create our table. So first, run the following SQL.
- -DELETE from core_resource where code = 'weblog_setup';- -
We'll also want to drop the table we manually created in the ORM article.
- -DROP TABLE blog_posts;- -
Then, add the following code to your setup script.
- -$installer = $this;
-$installer->startSetup();
-$installer->run("
- CREATE TABLE `{$installer->getTable('weblog/blogpost')}` (
- `blogpost_id` int(11) NOT NULL auto_increment,
- `title` text,
- `post` text,
- `date` datetime default NULL,
- `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
- PRIMARY KEY (`blogpost_id`)
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
- INSERT INTO `{$installer->getTable('weblog/blogpost')}` VALUES (1,'My New Title','This is a blog post','2009-07-01 00:00:00','2009-07-02 23:12:30');
-");
-$installer->endSetup();
-
-
-Clear your Magento cache and reload any page in the system. You should have a new blog_posts table with a single row.
- -So, let's go over the script line-by-line. First, there's this (or is that $this?)
- -$installer = $this;- -
Each installer script is run from the context of a Setup Resource class, the class you created above. That means any reference to $this from within the script will be a reference to an object instantiated from this class. While not necessary, most setup scripts in the core modules will alias $this to a variable called installer, which is what we've done here. While not necessary, it is the convention and it's always best to follow the convention unless you have a good reason for breaking it.
- -Next, you'll see our queries are bookended by the following two method calls.
- -$installer->startSetup(); -//... -$installer->endSetup(); -- -
If you take a look at the Mage_Core_Model_Resource_Setup class in app/code/core/Mage/Core/Model/Resource/Setup.php (which your setup class inherits from) you can see that these methods do some basic SQL setup
- -
- public function startSetup()
- {
- $this->getConnection()->startSetup()
- return $this;
- }
-
- public function endSetup()
- {
- $this->getConnection()->endSetup();
- return $this;
- }
-
-
-You can look into Varien_Db_Adapter_Pdo_Mysql in lib/Varien/Db/Adapter/Pdo/Mysql.php to find the real SQL setup executed for MySQL connections in the startSetup() and endSetup() methods.
- -Finally, there's the call to the run method
- -$installer->run(...);- -
which accepts a string containing the SQL needed to setup your database table(s). You may specify any number of queries, separated by a semi-colon. You also probably noticed the following
- -$installer->getTable('weblog/blogpost')
-
-The getTable method allows you to pass in a Magento Model URI and get its table name. While not necessary, using this method ensures that your script will continue to run, even if someone changes the name of their table in the config file. The Mage_Core_Model_Resource_Setup class contains many useful helper methods like this. The best way to become familiar with everything that's possible is to study the installer scripts used by the core Magento modules.
- -Since version 1.6, Magento (in theory) supports more database backends then only MySQL. Since our setup script contains raw SQL statements, it may not run correctly on a different database system, say MSSQL. For that reason the setup script name is prefixt with the string mysql4-
- -In order to make setup scripts cross-database compatible, Magento offers a DDL (Data Definition Language) Table object. Here is an alternative version of our setup script that would run on any supported RDBMS.
- -File: app/code/local/Magentotutorial/Weblog/sql/weblog_setup/mysql4-install-0.1.0.php
-$installer = $this;
-$installer->startSetup();
-$table = $installer->getConnection()->newTable($installer->getTable('weblog/blogpost'))
- ->addColumn('blogpost_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
- 'unsigned' => true,
- 'nullable' => false,
- 'primary' => true,
- 'identity' => true,
- ), 'Blogpost ID')
- ->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
- 'nullable' => false,
- ), 'Blogpost Title')
- ->addColumn('post', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
- 'nullable' => true,
- ), 'Blogpost Body')
- ->addColumn('date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
- ), 'Blogpost Date')
- ->addColumn('timestamp', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
- ), 'Timestamp')
- ->setComment('Magentotutorial weblog/blogpost entity table');
-$installer->getConnection()->createTable($table);
-
-$installer->endSetup();
-
-
-As you can see, there is no raw SQL in this version of the setup script. So which version should you use? If you want your Modules to run on any RDBMS backend, use the new DDL style upgrade scripts. If you are concerned about backward compatibility, use the raw SQL flavor, that is still supported by Magento 1.6 and 1.7 (and probably will be supported by any 1.x Magento release).
- -So, that's how you create a script that will setup your initial database tables, but what if you want to alter the structure of an existing module? Magento's Setup Resources support a simple versioning scheme that will let you automatically run scripts to upgrade your modules.
- -Once Magento runs an installer script for a module, it will never run another installer for that module again (short of manually deleting the reference in the core_resource table). Instead, you'll need to create an upgrade script. Upgrade scripts are very similar to installer scripts, with a few key differences.
- -To get started, we'll create a script at the following location, with the following contents
- -File: app/code/local/Magentotutorial/Weblog/sql/weblog_setup/upgrade-0.1.0-0.2.0.php:
--echo 'Testing our upgrade script (upgrade-0.1.0-0.2.0.php) and halting execution to avoid updating the system version number- -
'; -die(); -
Upgrade scripts are placed in the same folder as your installer script, but named slightly differently. First, and most obviously, the file name contains the word upgrade. Secondly, you'll notice there are two version numbers, separated by a "-". The first (0.1.0) is the module version that we're upgrading from. The second (0.2.0) is the module version we're upgrading to.
- -If we cleared our Magento cache and reloaded a page, our script wouldn't run. We need to update the version number in our module's config.xml file to trigger the upgrade
- --<modules> - <Magentotutorial_Weblog> - <version>0.2.0</version> - </Magentotutorial_Weblog> -</modules> -- -
With the new version number in place, we'll need to clear our Magento cache and load any page in our Magento site. You should now see output from your upgrade script.
- -By the way, we also could have names our upgrade script mysql4-upgrade-0.1.0-0.2.0.php. This would indicate our upgrade would contain MySQL specific SQL.
- -Before we continue and actually implement the upgrade script, there's one important piece of behavior you'll want to be aware of. Create another upgrade file at the following location with the following contents.
- -File: app/code/local/Magentotutorial/Weblog/sql/weblog_setup/upgrade-0.1.0-0.1.5.php:
--echo 'Testing our upgrade script (upgrade-0.1.0-0.1.5.php) and NOT halting execution <br />'; -- -
If you reload a page, you'll notice you see BOTH messages. When Magento notices the version number of a module has changed, it will run through all the setup scripts needed to bring that version up to date. Although we never really created a version 0.1.5 of the Weblog module, Magento sees the upgrade script, and will attempt to run it. Scripts will be run in order from lowest to highest. If you take a peek at the core_resource table,
- -mysql> select * from core_resource where code = 'weblog_setup'; -+--------------+---------+--------------+ -| code | version | data_version | -+--------------+---------+--------------+ -| weblog_setup | 0.1.5 | 0.1.5 | -+--------------+---------+--------------+ -1 row in set (0.00 sec) -- -
you'll notice Magento considers the version number to be 1.5. That's because we completed executing the 1.0 to 1.5 upgrade, but did not complete execution of the 1.0 to 2.0 upgrade.
- -So, with all that out of the way, writing our actual upgrade script is identical to writing an installer script. Let's change the 0.1.0-0.2.0 script to read
- -
-$installer = $this;
-$installer->startSetup();
-$installer->getConnection()
- ->changeColumn($installer->getTable('weblog/blogpost'), 'post', 'post', array(
- 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
- 'nullable' => false,
- 'comment' => 'Blogpost Body'
- )
-);
-$installer->endSetup();
-die("You'll see why this is here in a second");
-
-
-Try refreshing a page in your Magento site and ... nothing. The upgrade script didn't run. The post field in our table still allows null values, and more importantly, the call to die() did not halt execution. Here's what happened
- -The correct way to achieve what we wanted would have been to name our scripts as follows
- -upgrade-0.1.0-0.1.5.php #This goes from 0.1.0 to 0.1.5 -upgrade-0.1.5-0.2.0.php #This goes 0.1.5 to 0.2.0- -
Magento is smart enough to run both scripts on a single page load. You can go back in time and give this a try by updating the core_resource table
- -UPDATE core_resource SET version = '0.1.0', data_version = '0.1.0' WHERE code = 'weblog_setup'; -...- -
It's one of the odd quirks of the Magento system that the updates will run as previously configured. This means you'll want to be careful with multiple developers adding update scripts to the system. You'll either want a build-meister/deployment-manager type in charge of the upgrade scripts or (heaven forbid) developers will need to talk to one another.
- -You should now know the basics of how to use Magento Setup Resources to create versioned database migration scripts, as well as understand the scripts provided in the core modules. Beyond having a standard way for developers to write migration scripts, Setup Resources become much more important when creating and modifying Entity Attribute Value models.
- -
-{% include m1x/eol_message.html %}
-
-by Alan Storm, updated for Magento 1.12
- - - - - - -In the first ORM article we told you there were two kinds of Models in Magento. Regular, or "simple" Models, and Entity Attribute Value (or EAV) Models. We also told you this was a bit of a fib. Here's where we come clean.
- -ALL Magento Models interacting with the database inherit from the Mage_Core_Model_Abstract / Varien_Object chain. What makes something either a simple Model or an EAV Model is its Model Resource. While all resources extend the base Mage_Core_Model_Resource_Abstract class, simple Models have a resource that inherits from Mage_Core_Model_Resource_Db_Abstract, and EAV Models have a resource that inherits from Mage_Eav_Model_Entity_Abstract
- -If you think about it, this makes sense. As the end-programmer-user of the system you want a set of methods you can use to talk to and manipulate your Models. You don't care what the backend storage looks like, you just want to get properties and invoke methods that trigger business rules.
- -Entity-Attribute-Value model (EAV), also known as object-attribute-value model and open schema is a data model that is used in circumstances where the number of attributes (properties, parameters) that can be used to describe a thing (an "entity" or "object") is potentially very vast, but the number that will actually apply to a given entity is relatively modest. In mathematics, this model is known as a sparse matrix.- -
Another metaphor that helps me wrap my head around it is "EAV brings some aspects of normalization to the database table schema". In a traditional database, tables have a fixed number of columns
- -+------------------+ -| products | -+------------------+ -| product_id | -| name | -| price | -| etc.. | -+------------------+ - -+------------+----------------+------------------+---------+ -| product_id | name | price | etc... | -+------------+----------------+------------------+---------+ -| 1 | Widget A | 11.34 | etc... | -+------------+----------------+------------------+---------+ -| 2 | Dongle B | 6.34 | etc... | -+------------+----------------+------------------+---------+ -- -
Every product has a name, every product has a price, etc.
- -In an EAV Model, each "entity" (product) being modeled has a different set of attributes. EAV makes a lot of sense for a generic eCommerce solution. A store that sells laptops (which have a CPU speed, color, ram amount, etc) is going to have a different set of needs than a store that sells yarn (yarn has a color, but no CPU speed, etc.). Even within our hypothetical yarn store, some products will have length (balls of yarn), and others will have diameter (knitting needles).
- -There aren't many open source or commercial databases that use EAV by default. There are none that are available on a wide variety of web hosting platforms. Because of that, the Magento engineers have built an EAV system out of PHP objects that use MySQL as a data-store. In other words, they've built an EAV database system on top of a traditional relational database.
- -In practice this means any Model that uses an EAV resource has its attributes spread out over a number of MySQL tables.
-
-
-
The above diagram is a rough layout of the database tables Magento consults when it looks up an EAV record for the catalog_product entity. Each individual product has a row in catalog_product_entity. All the available attributes in the entire system (not just for products) are stored in eav_attribute, and the actual attribute values are stored in tables with names like catalog_product_entity_varchar, catalog_product_entity_decimal, catalog_product_entity_etc..
- -Beyond the mental flexibility an EAV system gives you, there's also the practical benefit of avoiding ALTER TABLE statements. When you add a new attribute for your products, a new row is inserted into eav_attribute. In a traditional relational database/single-table system, you'd need to ALTER the actual database structure, which can be a time consuming/risky proposition for tables with large data-sets.
- -The downside is there's no one single simple SQL query you can use to get at all your product data. Several single SQL queries or one large join need to be made.
- -That's EAV in a nutshell. The rest of this articles is a run-through of what's needed to create a new EAV Model in Magento. It's the hairiest thing you'll read about Magento and it's something that 95% of people working with the system will never need to do. However, understanding what it takes to build an EAV Model Resource will help you understand what's going on with the EAV Resources that Magento uses.
- -Because the EAV information is so dense, we're going to assume you're already very familiar with Magento's MVC and grouped class name features. We'll help you along the way, but training wheels are off.
- -We're going to create another Model for a weblog post, but this time using an EAV Resource. To start with, setup and create a new module which responds at the following URL
- -http://example.com/complexworld- -
If you're unsure how to do this, be sure you've mastered the concepts in the previous tutorials.
- -Next, we'll create a new Model named Weblogeav. Remember, it's the Resource that's considered EAV. We design and configure our Model the exact same way, so let's configure a Model similar to one we created in the first ORM article.
- --<global> - <!-- ... --> - <models> - <!-- ... --> - <complexworld> - <class>Magentotutorial_Complexworld_Model</class> - <resourceModel>complexworld_resource</resourceModel> - </complexworld> - <!-- ... --> - </models> - <!-- ... --> -</global> -- -
You'll notice so far there is no difference to setting up a regular Model and flat table resource Model.
- -We'll still need to let Magento know about this resource. Similar to basic Models, EAV Resources are configured in the same <model/> node with everything else.
- --<global> - <!-- ... --> - <models> - <!-- ... --> - <complexworld_resource> - <class>Magentotutorial_Complexworld_Model_Resource</class> - <entities> - <eavblogpost> - <table>eavblog_posts</table> - </eavblogpost> - </entities> - </complexworld_resource> - <!-- ... --> - </models> - <!-- ... --> -</global> -- -
Again, so far this is setup similar to our regular Model Resource. We provide a <class/> that configures a PHP class, as well as an <entities/> section that will let Magento know the base table for an individual Model we want to create. The <eavblogpost/> tag is the name of the specific Model we want to create, and its inner <table/> tag specifies the base table this Model will use (more on this later).
- -Until wide adoption of PHP 5.3 and namespaces, one of the trickier (and tedious) parts of Magento will remain remembering how <classname/>s relate to file paths, and then ensuring you create the correctly named directory structure and class files. After configuring any <classname/>s or URIs, you may find it useful to attempt to instantiate an instance of the class in a controller without first creating the class files. This way PHP will throw an exception telling me it can't find a file, along with the file location. Give the following a try in your Index Controller.
- -
-public function indexAction() {
- $weblog2 = Mage::getModel('complexworld/eavblogpost');
- $weblog2->load(1);
- var_dump($weblog2);
-}
-
-
-As predicted, a warning should be thrown
- --Warning: include(Magentotutorial/Complexworld/Model/Eavblogpost.php) [function.include]: -failed to open stream: No such file or directory in /Users/username/Sites/magento.dev/lib/Varien/Autoload.php on line 93 -- -
In addition to telling us the path where we'll need to define the new resource class this also serves as a configuration check. If we'd been warned with the following
- --Warning: include(Mage/Complexworld/Model/Eavblogpost.php) [function.include]: -failed to open stream: No such file or directory in /Users/username/Sites/magento.dev/lib/Varien/Autoload.php on line 93 -- -
we'd know our Model was misconfigured, as Magento was looking for the Model in code/core/Mage instead of code/local/Magentotutorial.
- -So, lets create our Model class
-File: app/code/local/Magentotutorial/Complexworld/Model/Eavblogpost.php:
-
-class Magentotutorial_Complexworld_Model_Eavblogpost extends Mage_Core_Model_Abstract {
- protected function _construct()
- {
- $this->_init('complexworld/eavblogpost');
- }
-}
-
-
-Remember, the Model itself is resource independent. A regular Model and an EAV Model both extend from the same class. It's the resource that makes them different.
- -Clear your Magento cache, reload your page, and you should see a new warning.
- -Warning: include(Magentotutorial/Complexworld/Model/Resource/Eavblogpost.php)- -
As expected, we need to create a class for our Model's resource. Let's do it!
- -File: app/code/local/Magentotutorial/Complexworld/Model/Resource/Eavblogpost.php: -
-class Magentotutorial_Complexworld_Model_Resource_Eavblogpost extends Mage_Eav_Model_Entity_Abstract
-{
- protected function _construct()
- {
- $resource = Mage::getSingleton('core/resource');
- $this->setType('complexworld_eavblogpost');
- $this->setConnection(
- $resource->getConnection('complexworld_read'),
- $resource->getConnection('complexworld_write')
- );
- }
-}
-
-
-So, already we're seeing a few differences between a simple Model Resource and an EAV Model Resource. First off, we're extending the Mage_Eav_Model_Entity_Abstract class. While Mage_Eav_Model_Entity_Abstract uses the same _construct concept as a regular Model Resource, there's no _init method. Instead, we need to handle the init ourselves. This means telling the resource what connection-resources it should use, and passing a unique identifier into the setType method of our object.
- -Another difference in Mage_Eav_Model_Entity_Abstract is _construct is not an abstract method, primarily for reasons of backwards compatibility with older versions of the system.
- -So, with that, let's clear the Magento cache and reload the page. You should see a new exception which reads
- -Invalid entity_type specified: complexworld_eavblogpost- -
Magento is complaining that it can't find a entity_type named complexworld_eavblogpost. This is the value you set above
- -$this->setType('complexworld_eavblogpost');
-
-Every entity has a type. Types will, among other things, let the EAV system know which attributes a Model uses, and allow the system to link to tables that store the values for attributes. We'll need to let Magento know that we're adding a new entity type. Take a look in the MySQL table named eav_entity_type.
- --mysql> select * from eav_entity_type; -*************************** 1. row *************************** - entity_type_id: 1 - entity_type_code: customer - entity_model: customer/customer - attribute_model: - entity_table: customer/entity - value_table_prefix: - entity_id_field: - is_data_sharing: 1 - data_sharing_key: default -default_attribute_set_id: 1 - increment_model: eav/entity_increment_numeric - increment_per_store: 0 - increment_pad_length: 8 - increment_pad_char: 0 -*************************** 2. row *************************** - entity_type_id: 2 - entity_type_code: customer_address - entity_model: customer/customer_address - attribute_model: - entity_table: customer/address_entity - value_table_prefix: - entity_id_field: - is_data_sharing: 1 - data_sharing_key: default -default_attribute_set_id: 2 - increment_model: - increment_per_store: 0 - increment_pad_length: 8 - increment_pad_char: 0 -- -
This table contains a list of all the entity_types in the system. The unique identifier complexworld_eavblogpost corresponds to the entity_type_code column.
- -This illustrates the single most important Magento concept, one that many people struggle to learn.
- -Consider the computer in front of you. The OS (Mac OS X, Windows, Linux, etc.) is the software system. Your web browser (Firefox, Safari, IE, Opera) is the application. Magento is a system first, and an application second. You build eCommerce applications using the Magento system. What gets confusing is, there's a lot of places in Magento where the system code is exposed in a really raw form to the application code. The EAV system configuration living in the same database as your store's data is an example of this.
- -If you're going to get deep into Magento, you need to treat it like it's an old Type 650 machine. That is to say, it's the kind of thing you can't effectively program applications in unless unless you have a deep understanding of the system itself.
- -So, it's theoretically possible to manually insert the rows you'll need into the Magento database to get your Model working, but it's not recommended. Fortunately, Magento provides a specialized Setup Resource that provides a number of helper method that will automatically create the needed records to get the system up and running.
- -So, for starters, configure the Setup Resource like you would any other.
- --<global> - <!-- ... --> - <resources> - <complexworld_setup> - <setup> - <module>Magentotutorial_Complexworld</module> - <class>Magentotutorial_Complexworld_Model_Resource_Setup</class> - </setup> - </complexworld_setup> - </resources> - <!-- ... --> -</global> -- -
Next, create its class file.
- -File: app/code/local/Magentotutorial/Complexworld/Model/Resource/Setup.php: -
-class Magentotutorial_Complexworld_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup {
-}
-
-
-Take note that we're extending from Mage_Eav_Model_Entity_Setup rather than Mage_Core_Model_Resource_Setup.
- -Finally, we'll set up our installer script. If you're not familiar with the naming conventions here, you'll want to review the setup resource tutorial on Setup Resources.
- -File: app/code/local/Magentotutorial/Complexworld/sql/complexworld_setup/install-0.1.0.php: -
-<?php
-$installer = $this;
-throw new Exception("This is an exception to stop the installer from completing");
-
-
-Clear your Magento Cache, reload you page, and the above exception should be thrown, meaning you've correctly configured your Setup Resource.
- -NOTE: We'll be building up our install script piece by piece. If you've read the previous tutorial, you'll know you need to remove the setup's row from the core_resource table and clear your cache to make an installer script re-run. For the remainder of this tutorial, please remember that anytime we add or remove an item from our installer and re-run it, you'll need to remove this row from the database and clear your Magento cache. Normally you would create this file and run it once, a tutorial is something of an edge case.
- -To begin, add the following to your Setup Resource installer script, and then run the script by loading any page (after removing the above exception)
- -
-$installer = $this;
-$installer->startSetup();
-$installer->addEntityType('complexworld_eavblogpost', array(
- //entity_mode is the URI you'd pass into a Mage::getModel() call
- 'entity_model' => 'complexworld/eavblogpost',
-
- //table refers to the resource URI complexworld/eavblogpost
- //<complexworld_resource>...<eavblogpost><table>eavblog_posts</table>
- 'table' =>'complexworld/eavblogpost',
-));
-$installer->endSetup();
-
-
-We're calling the addEntityType method on our installer object. This method allows us to pass in the entity type (complexworld_eavblogpost) along with a list of parameters to set its default values. If you've run this script, you'll notice new rows in the eav_attribute_group, eav_attribute_set, and eav_entity_type tables.
- -So, with that in place, if we reload our complexworld page, we'll get a new error.
- -SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.eavblog_posts' doesn't exist- -
So, we've told Magento about our new entity type. Next, we need to add the MySQL tables that will be used to store all the entity values, as well as configure the system so it knows about these tables.
- -Our EAV Setup Resource has a method named createEntityTables which will automatically setup the tables we need, as well as add some configuration rows to the system. Let's add the following line to our setup resource.
- -
-$installer->createEntityTables(
- $this->getTable('complexworld/eavblogpost')
-);
-
-
-The createEntityTables method accepts two parameters. The first is the base table name, the second is a list of options. We're using the Setup Resource's getTable method to pull the table name from our config. If you've been following along, you know this should resolve to the string eavblog_posts. We've omitted the second parameter which is an array of options you'll only need to used it for advanced situations that are beyond the scope of this tutorial.
- -After running the above script, you should have the following new tables in your database
- --eavblog_posts -eavblog_posts_char -eavblog_posts_datetime -eavblog_posts_decimal -eavblog_posts_int -eavblog_posts_text -eavblog_posts_varchar -- -
You'll also have an additional row in the eav_attribute_set table
- -mysql> select * from eav_attribute_set order by attribute_set_id DESC LIMIT 1 \G -*************************** 1. row *************************** - attribute_set_id: 65 - entity_type_id: 37 -attribute_set_name: Default - sort_order: 6 -- -
So, let's go back to our page and reload.
- -http://example.com/complexworld- -
Success! You should see no errors or warnings, and a dumped Magentotutorial_Complexworld_Model_Eavblogpost --- with no data.
- -The last step we need to take in our Setup Resource is telling Magento what attributes we want our EAV Model to have. This would be equivalent to adding new columns in a single database table setup. Again, the Setup Resource will help us. The method we're interested in is addAttribute.
- -The code from the previous section was simply telling Magento about a type of entity that we add to the system. These next bits of code are what will actually add possible attributes for our new type to the system.
- -We do that with the method addAttribute. When we call addAttribute, Magento will need to do several things to install your entities.
- -To start with, we'll give our Eavblogpost a single attribute named title.
- -
-/* ... */
-$this->addAttribute('complexworld_eavblogpost', 'title', array(
- //the EAV attribute type, NOT a MySQL varchar
- 'type' => 'varchar',
- 'label' => 'Title',
- 'input' => 'text',
- 'class' => '',
- 'backend' => '',
- 'frontend' => '',
- 'source' => '',
- 'required' => true,
- 'user_defined' => true,
- 'default' => '',
- 'unique' => false,
-));
-/* ... */
-
-
-All right, that's a small pile of code. Let's break it apart.
- -The first argument to addAttribute is the entity type code. It has to match the code specified when calling addEntityType. It tells Magento which entity we are adding the attribute to, in our example it is our complexworld_eavblogpost entity. To see other available entities that come shipped with Magento, remember you can look into the eav_entity_type table at the entity_type_code column.
- -The second argument to addAttribute is the attribute code. It has to be unique within the given entity.
- -The third argument is where it get real interesting. This is an array of key value pairs, describing the attribute properties. For the sake of simplicity we've chose to define a single attribute, but you could go on to define as many as you'd like, by adding additional addAttribute calls to the setup script.
- -Finally, we have a long list of attribute properties.
- --//the EAV attribute type, NOT a MySQL varchar -'type' => 'varchar', -'label' => 'Title', -'input' => 'text', -'class' => '', -'backend' => '', -'frontend' => '', -'source' => '', -'required' => true, -'user_defined' => true, -'default' => '', -'unique' => false, -- -
Most of these define how Magento would build a backend form element for this attribute, and probably you'll won't have to deal with the,. That said, the one important property you'll want to make note of is
--'type' => 'varchar' -- -
This defines the type of the value that the attribute will contain. You'll recall that we added table for each attribute type
- --eavblog_posts_datetime -eavblog_posts_decimal -eavblog_posts_int -eavblog_posts_text -eavblog_posts_varchar -- -
While these do not refer to the MySQL column types, (but instead the EAV attribute types), their names (varchar, datetime, etc.) are indicative of the values they'll hold.
- -All of these attribute properties are optional, if we wouldn't have specified them, Magento would have used a default value. These default values are defined in the _prepareValues method of the Mage_Eav_Model_Entity_Setup class (inherited by our setup class).
- -
-// Mage_Eav_Model_Entity_Setup
-protected function _prepareValues($attr)
-{
- $data = array(
- 'backend_model' => $this->_getValue($attr, 'backend'),
- 'backend_type' => $this->_getValue($attr, 'type', 'varchar'),
- 'backend_table' => $this->_getValue($attr, 'table'),
- 'frontend_model' => $this->_getValue($attr, 'frontend'),
- 'frontend_input' => $this->_getValue($attr, 'input', 'text'),
- 'frontend_label' => $this->_getValue($attr, 'label'),
- 'frontend_class' => $this->_getValue($attr, 'frontend_class'),
- 'source_model' => $this->_getValue($attr, 'source'),
- 'is_required' => $this->_getValue($attr, 'required', 1),
- 'is_user_defined' => $this->_getValue($attr, 'user_defined', 0),
- 'default_value' => $this->_getValue($attr, 'default'),
- 'is_unique' => $this->_getValue($attr, 'unique', 0),
- 'note' => $this->_getValue($attr, 'note'),
- 'is_global' => $this->_getValue($attr, 'global',
- Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
- ),
- );
-
- return $data;
-}
-
-
-The second argument to the method calls to _getValue is the array key from our addAttribute argument array, and the third is the default value. So by default Magento would assume you are adding a varchar attribute with a text input.
- -Lets add attributes for the blog post content and the post date. This is what the complete install script looks like.
- -
- $installer = $this;
- $installer->startSetup();
-
- $installer->addEntityType('complexworld_eavblogpost', array(
- //entity_mode is the URI you'd pass into a Mage::getModel() call
- 'entity_model' => 'complexworld/eavblogpost',
-
- //table refers to the resource URI complexworld/eavblogpost
- //<complexworld_resource>...<eavblogpost><table>eavblog_posts</table>
- 'table' =>'complexworld/eavblogpost',
- ));
-
- $installer->createEntityTables(
- $this->getTable('complexworld/eavblogpost')
- );
-
- $this->addAttribute('complexworld_eavblogpost', 'title', array(
- //the EAV attribute type, NOT a MySQL varchar
- 'type' => 'varchar',
- 'label' => 'Title',
- 'input' => 'text',
- 'class' => '',
- 'backend' => '',
- 'frontend' => '',
- 'source' => '',
- 'required' => true,
- 'user_defined' => true,
- 'default' => '',
- 'unique' => false,
- ));
- $this->addAttribute('complexworld_eavblogpost', 'content', array(
- 'type' => 'text',
- 'label' => 'Content',
- 'input' => 'textarea',
- ));
- $this->addAttribute('complexworld_eavblogpost', 'date', array(
- 'type' => 'datetime',
- 'label' => 'Post Date',
- 'input' => 'datetime',
- 'required' => false,
- ));
-
- $installer->endSetup();
-
-
-So, now that we have everything in place, lets refresh things one last time to run our installer script. After calling addAttribute, we should have
- -This is clearly the lamest.blogmodel.ever, but lets try adding some rows and iterating through a collection and get the heck out of here before our heads explode. Add the following two actions to your Index Controller.
- -
-public function populateEntriesAction() {
- for ($i=0;$i<10;$i++) {
- $weblog2 = Mage::getModel('complexworld/eavblogpost');
- $weblog2->setTitle('This is a test '.$i);
- $weblog2->setContent('This is test content '.$i);
- $weblog2->setDate(now());
- $weblog2->save();
- }
-
- echo 'Done';
-}
-
-public function showCollectionAction() {
- $weblog2 = Mage::getModel('complexworld/eavblogpost');
- $entries = $weblog2->getCollection()
- ->addAttributeToSelect('title')
- ->addAttributeToSelect('content');
- $entries->load();
- foreach($entries as $entry)
- {
- // var_dump($entry->getData());
- echo '<h2>' . $entry->getTitle() . '</h2>';
- echo '<p>Date: ' . $entry->getDate() . '</p>';
- echo '<p>' . $entry->getContent() . '</p>';
- }
- echo '</br>Done</br>';
-}
-
-
-Let's populate some entries! Load up the following URL
- -http://magento.dev/index.php/complexworld/index/populateEntries- -
If you take a look at your database, you should see 10 new rows in the eavblog_posts table.
- --mysql> SELECT * FROM eavblog_posts ORDER BY entity_id DESC; -+-----------+----------------+------------------+--------------+-----------+----------+---------------------+---------------------+-----------+ -| entity_id | entity_type_id | attribute_set_id | increment_id | parent_id | store_id | created_at | updated_at | is_active | -+-----------+----------------+------------------+--------------+-----------+----------+---------------------+---------------------+-----------+ -| 10 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 9 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 8 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 7 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 6 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 5 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 4 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 3 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 2 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -| 1 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | -+-----------+----------------+------------------+--------------+-----------+----------+---------------------+---------------------+-----------+ -- -
as well as 10 new rows in the eavblog_posts_varchar table.
- --mysql> SELECT * FROM eavblog_posts_varchar ORDER BY value_id DESC; -+----------+----------------+--------------+----------+-----------+------------------+ -| value_id | entity_type_id | attribute_id | store_id | entity_id | value | -+----------+----------------+--------------+----------+-----------+------------------+ -| 10 | 31 | 933 | 0 | 10 | This is a test 9 | -| 9 | 31 | 933 | 0 | 9 | This is a test 8 | -| 8 | 31 | 933 | 0 | 8 | This is a test 7 | -| 7 | 31 | 933 | 0 | 7 | This is a test 6 | -| 6 | 31 | 933 | 0 | 6 | This is a test 5 | -| 5 | 31 | 933 | 0 | 5 | This is a test 4 | -| 4 | 31 | 933 | 0 | 4 | This is a test 3 | -| 3 | 31 | 933 | 0 | 3 | This is a test 2 | -| 2 | 31 | 933 | 0 | 2 | This is a test 1 | -| 1 | 31 | 933 | 0 | 1 | This is a test 0 | -+----------+----------------+--------------+----------+-----------+------------------+ -- -
Notice that eavblog_posts_varchar is linked to eavblog_posts by the entity_id column.
- -Finally, let's pull our Models back out. Load the following URL in your browser
- -http://magento.dev/index.php/complexworld/index/showCollection- -
This should give us a
- -Warning: include(Magentotutorial/Complexworld/Model/Resource/Eavblogpost/Collection.php) [function.include]: - failed to open stream: No such file or directory in /Users/username/Sites/magento.dev/lib/Varien/Autoload.php on line 93- -
So Close! We didn't make a class for our collection object! Fortunately, doing so is just as easy as with a regular Model Resource. Add the following file with the following contents
- -File: Magentotutorial/Complexworld/Model/Resource/Eavblogpost/Collection.php: -
-class Magentotutorial_Complexworld_Model_Resource_Eavblogpost_Collection extends Mage_Eav_Model_Entity_Collection_Abstract
-{
- protected function _construct()
- {
- $this->_init('complexworld/eavblogpost');
- }
-}
-
-
-This is just a standard Magento _construct method to initialize the Model. With this in place, reload the page, and we'll see all the titles and the content outputted. But notice, the date value is missing!
- -Those of you with sharp eyes may have noticed something slightly different about the collection loading.
- -
-$entries = $weblog2->getCollection()
- ->addAttributeToSelect('title')
- ->addAttributeToSelect('content');
-
-
-Because querying for EAV data can be SQL intensive, you'll need to specify which attributes it is you want your Models to fetch for you. This way the system can make only the queries it needs. If you're willing to suffer the performance consequences, you can use a wild card to grab all the attributes
- -$entries = $weblog2->getCollection()->addAttributeToSelect('*');
-
-So, that should give you enough information to be dangerous, or at least enough information so you're not drowning the next time you're trying to figure out why the yellow shirts aren't showing up in your store. There's still plenty to learn about EAV; here's a few topics I would have liked to cover in greater detail, and may talk about in future articles
- -EAV Models are, without a doubt, the most complicated part of the Magento system that an ecommerce web developer will need to deal with. Remember to take deep breaths and that, at the end of the day, its just programming. Everything happens for a concrete reason, you just need to figure out why.
\ No newline at end of file diff --git a/guides/m1x/magefordev/mage-for-dev-8.html b/guides/m1x/magefordev/mage-for-dev-8.html deleted file mode 100644 index 130f445977..0000000000 --- a/guides/m1x/magefordev/mage-for-dev-8.html +++ /dev/null @@ -1,524 +0,0 @@ ---- ---- - - - - - - - - - - -
-{% include m1x/eol_message.html %}
-
-by Alan Storm, updated for Magento 1.12
- - - - - - - -Originally, as a PHP programmer, if you wanted to collect together a group of related variables you had one choice, the venerable Array. While it shares a name with C's array of memory addresses, a PHP array is a general purpose dictionary like object combined with the behaviors of a numerically indexed mutable array.
- -In other languages the choice isn't so simple. You have multiple data structures to chose from, each offering particular advantages in storage, speed and semantics. The PHP philosophy was to remove this choice from the client programmer and give them one useful data structure that was "good enough".
- -All of this is galling to a certain type of software developer, and PHP 5 set out to change the status quo by offering built-in classes and interfaces that allow you to create your own data structures.
- -
-$array = new ArrayObject();
-class MyCollection extends ArrayObject{...}
-$collection = new MyCollection();
-$collection[] = 'bar';
-
-
-While this is still galling to a certain type of software developer, as you don't have access to low level implementation details, you do have the ability to create array-like Objects with methods that encapsulate specific functionality. You can also setup rules to offer a level of type safety by only allowing certain kinds of Objects into your Collection.
- -It should come as no surprise that Magento offers you a number of these Collections. In fact, every Model object that follows the Magento interfaces gets a Collection type for free. Understanding how these Collections work is a key part to being an effective Magento programmer. We're going to take a look at Magento Collections, starting from the bottom and working our way up. Set up a controller action where you can run arbitrary code, and let's get started.
- -First, we're going to create a few new Objects.
- -
-$thing_1 = new Varien_Object();
-$thing_1->setName('Richard');
-$thing_1->setAge(24);
-
-$thing_2 = new Varien_Object();
-$thing_2->setName('Jane');
-$thing_2->setAge(12);
-
-$thing_3 = new Varien_Object();
-$thing_3->setName('Spot');
-$thing_3->setLastName('The Dog');
-$thing_3->setAge(7);
-
-
-The Varien_Object class defines the object all Magento Models inherit from. This is a common pattern in object oriented systems, and ensures you'll always have a way to easily add methods/functionally to every object in your system without having to edit every class file.
- -Any Object that extends from Varien_Object has magic getter and setters that can be used to set data properties. Give this a try
- -var_dump($thing_1->getName());- -
If you don't know what the property name you're after is, you can pull out all the data as an array
- -var_dump($thing_3->getData());- -
The above will give you an array something like
- - --array -'name' => string 'Spot' (length=4) -'last_name' => string 'The Dog' (length=7) -'age' => int 7 -- -
Notice the property named "last_name"? If there's an underscore separated property, you camel case it if you want to use the getter and setter magic.
- -$thing_1->setLastName('Smith');
-
-The ability to do these kinds of things is part of the power of PHP5, and the development style a certain class of people mean when they say "Object Oriented Programming".
- -So, now that we have some Objects, let's add them to a Collection. Remember, a Collection is like an Array, but is defined by a PHP programmer.
- --$collection_of_things = new Varien_Data_Collection(); -$collection_of_things - ->addItem($thing_1) - ->addItem($thing_2) - ->addItem($thing_3); -- -
The Varien_Data_Collection is the Collection that most Magento data Collections inherit from. Any method you can call on a Varien_Data_Collection you can call on Collections higher up the chain (We'll see more of this later)
- -What can we do with a Collection? For one, with can use foreach to iterate over it
- -
-foreach($collection_of_things as $thing)
-{
- var_dump($thing->getData());
-}
-
-
-There are also shortcuts for pulling out the first and last items
- --var_dump($collection_of_things->getFirstItem()->getData()); -var_dump($collection_of_things->getLastItem()->getData()); -- -
Want your Collection data as XML? There's a method for that
- -var_dump( $collection_of_things->toXml() );- -
Only want a particular field?
- -var_dump($collection_of_things->getColumnValues('name'));
-
-The team at Magento have even given us some rudimentary filtering capabilities.
- -var_dump($collection_of_things->getItemsByColumnValue('name','Spot'));
-
-Neat stuff.
- -So, this is an interesting exercise, but why do we care?
- -We care because all of Magento's built in data Collections inherit from this object. That means if you have, say, a product Collection you can do the same sort of things. Let's take a look
- -
-public function testAction()
-{
- $collection_of_products = Mage::getModel('catalog/product')->getCollection();
- var_dump($collection_of_products->getFirstItem()->getData());
-}
-
-
-Most Magento Model objects have a method named getCollection which will return a collection that, by default, is initialized to return every Object of that type in the system.
- -A Quick Note: Magento's Data Collections contain a lot of complicated logic that handles when to use an index or cache, as well as the logic for the EAV entity system. Successive method calls to the same Collection over its life can often result in unexpected behavior. Because of that, all the of the following examples are wrapped in a single method action. I'd recommend doing the same while you're experimenting. Also, XDebug's var_dump is a godsend when working with Magento Objects and Collections, as it will (usually) intelligently short circuit showing hugely recursive Objects, but still display a useful representation of the Object structure to you.
- -The products Collection, as well as many other Magento Collections, also have the Varien_Data_Collection_Db class in their ancestor chain. This gives us a lot of useful methods. For example, if you want to see the select statement your Collection is using
- -
-public function testAction()
-{
- $collection_of_products = Mage::getModel('catalog/product')->getCollection();
- var_dump($collection_of_products->getSelect()); //might cause a segmentation fault
-}
-
-
-The output of the above will be
- --object(Varien_Db_Select)[94] - protected '_bind' => - array - empty - protected '_adapter' => -... -- -
Whoops! Since Magento is using the Zend database abstraction layer, your Select is also an Object. Let's see that as a more useful string.
- -
-public function testAction()
-{
- $collection_of_products = Mage::getModel('catalog/product')->getCollection();
- //var_dump($collection_of_products->getSelect()); //might cause a segmentation fault
- var_dump(
- (string) $collection_of_products->getSelect()
- );
-}
-
-
-Sometimes this is going to result in a simple select
- -'SELECT `e`.* FROM `catalog_product_entity` AS `e`'- -
Other times, something a bit more complex
- --string 'SELECT `e`.*, `price_index`.`price`, `price_index`.`final_price`, IF(`price_index`.`tier_price`, -LEAST(`price_index`.`min_price`, `price_index`.`tier_price`), `price_index`.`min_price`) AS `minimal_price`, -`price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price` FROM `catalog_product_entity` -AS `e` INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND -price_index.website_id = '1' AND price_index.customer_group_id = 0' -- -
The discrepancy depends on which attributes you're selecting, as well as the aforementioned indexing and cache. If you've been following along with the other articles in this series, you know that many Magento models (including the Product Model) use an EAV system. By default, a EAV Collection will not include all of an Object's attributes. You can add them all by using the addAttributeToSelect method
- -
-$collection_of_products = Mage::getModel('catalog/product')
- ->getCollection()
- ->addAttributeToSelect('*'); //the asterisk is like a SQL SELECT * FROM ...
-
-
-Or, you can add just one
- -
-//or just one
-$collection_of_products = Mage::getModel('catalog/product')
- ->getCollection()
- ->addAttributeToSelect('meta_title');
-
-
-or chain together several
- -
-//or just one
-$collection_of_products = Mage::getModel('catalog/product')
- ->getCollection()
- ->addAttributeToSelect('meta_title')
- ->addAttributeToSelect('price');
-
-
-One thing that will trip up PHP developers new to Magento's ORM system is when Magento makes its database calls. When you're writing literal SQL, or even when you're using a basic ORM system, SQL calls are often made immediately when instantiating an Object.
- --$model = new Customer(); -//SQL Calls being made to Populate the Object -echo 'Done'; //execution continues -- -
Magento doesn't work that way. Instead, the concept of Lazy Loading is used. In simplified terms, Lazy loading means that no SQL calls are made until the client-programmer needs to access the data. That means when you do something something like this
- -
-$collection_of_products = Mage::getModel('catalog/product')
- ->getCollection();
-
-
-Magento actually hasn't gone out to the database yet. You can safely add attributes later
- -
-$collection_of_products = Mage::getModel('catalog/product')
- ->getCollection();
-$collection_of_products->addAttributeToSelect('meta_title');
-
-
-and not have to worry that Magento is making a database query each time a new attribute is added. The database query will not be made until you attempt to access an item in the Collection.
- -In general, try not to worry too much about the implementation details in your day to day work. It's good to know that there's s SQL backend and Magento is doing SQLy things, but when you're coding up a feature try to forget about it, and just treat the objects as block boxes that do what you need.
- -The most important method on a database Collection is addFieldToFilter. This adds your WHERE clauses to the SQL query being used behind the scenes. Consider this bit of code, run against the sample data database (substitute your own SKU is you're using a different set of product data)
- -
-public function testAction()
-{
- $collection_of_products = Mage::getModel('catalog/product')
- ->getCollection();
- $collection_of_products->addFieldToFilter('sku','n2610');
-
- //another neat thing about collections is you can pass them into the count //function. More PHP5 powered goodness
- echo "Our collection now has " . count($collection_of_products) . ' item(s)';
- var_dump($collection_of_products->getFirstItem()->getData());
-}
-
-
-The first parameter of addFieldToFilter is the attribute you wish to filter by. The second is the value you're looking for. Here's we're adding a sku filter for the value n2610.
- -The second parameter can also be used to specify the type of filtering you want to do. This is where things get a little complicated, and worth going into with a little more depth.
- -So by default, the following
- -$collection_of_products->addFieldToFilter('sku','n2610');
-
-is (essentially) equivalent to
- -WHERE sku = "n2610"- -
Take a look for yourself. Running the following
- -
-public function testAction()
-{
- var_dump(
- (string)
- Mage::getModel('catalog/product')
- ->getCollection()
- ->addFieldToFilter('sku','n2610')
- ->getSelect());
-}
-
-
-will yield
- -SELECT `e`.* FROM `catalog_product_entity` AS `e` WHERE (e.sku = 'n2610')'- -
Keep in mind, this can get complicated fast if you're using an EAV attribute. Add an attribute
- -
-var_dump(
- (string)
- Mage::getModel('catalog/product')
- ->getCollection()
- ->addAttributeToSelect('*')
- ->addFieldToFilter('meta_title','my title')
- ->getSelect()
-);
-
-
-and the query gets gnarly.
- --SELECT `e`.*, IF(_table_meta_title.value_id>0, _table_meta_title.value, _table_meta_title_default.value) AS `meta_title` -FROM `catalog_product_entity` AS `e` -INNER JOIN `catalog_product_entity_varchar` AS `_table_meta_title_default` - ON (_table_meta_title_default.entity_id = e.entity_id) AND (_table_meta_title_default.attribute_id='103') - AND _table_meta_title_default.store_id=0 -LEFT JOIN `catalog_product_entity_varchar` AS `_table_meta_title` - ON (_table_meta_title.entity_id = e.entity_id) AND (_table_meta_title.attribute_id='103') - AND (_table_meta_title.store_id='1') -WHERE (IF(_table_meta_title.value_id>0, _table_meta_title.value, _table_meta_title_default.value) = 'my title') -- -
Not to belabor the point, but try not to think too much about the SQL if you're on deadline.
- -I'm sure you're wondering "what if I want something other than an equals by query"? Not equal, greater than, less than, etc. The addFieldToFilter method's second parameter has you covered there as well. It supports an alternate syntax where, instead of passing in a string, you pass in a single element Array.
- -The key of this array is the type of comparison you want to make. The value associated with that key is the value you want to filter by. Let's redo the above filter, but with this explicit syntax
- -public function testAction()
-{
- var_dump(
- (string)
- Mage::getModel('catalog/product')
- ->getCollection()
- ->addFieldToFilter('sku', array('eq'=>'n2610'))
- ->getSelect()
- );
-}
-
-
-Calling out our filter
- -addFieldToFilter('sku',array('eq'=>'n2610'))
-
-As you can see, the second parameter is a PHP Array. Its key is eq, which stands for equals. The value for this key is n2610, which is the value we're filtering on.
- -Magento has a number of these english language like filters that will bring a tear of remembrance (and perhaps pain) to any old perl developers in the audience.
- -Listed below are all the filters, along with an example of their SQL equivalents.
- -
-array("eq"=>'n2610')
-WHERE (e.sku = 'n2610')
-
-array("neq"=>'n2610')
-WHERE (e.sku != 'n2610')
-
-array("like"=>'n2610')
-WHERE (e.sku like 'n2610')
-
-array("nlike"=>'n2610')
-WHERE (e.sku not like 'n2610')
-
-array("is"=>'n2610')
-WHERE (e.sku is 'n2610')
-
-array("in"=>array('n2610'))
-WHERE (e.sku in ('n2610'))
-
-array("nin"=>array('n2610'))
-WHERE (e.sku not in ('n2610'))
-
-array("notnull"=>true)
-WHERE (e.sku is NOT NULL)
-
-array("null"=>true)
-WHERE (e.sku is NULL)
-
-array("gt"=>'n2610')
-WHERE (e.sku > 'n2610')
-
-array("lt"=>'n2610')
-WHERE (e.sku < 'n2610')
-
-array("gteq"=>'n2610')
-WHERE (e.sku >= 'n2610')
-
-array("moreq"=>'n2610') //a weird, second way to do greater than equal (Doesn't work on > 1.8 CE EDITION do the same as eq)
-WHERE (e.sku >= 'n2610')
-
-array("lteq"=>'n2610')
-WHERE (e.sku <= 'n2610')
-
-array("finset"=>array('n2610'))
-WHERE (find_in_set('n2610',e.sku))
-
-array('from'=>'10','to'=>'20')
-WHERE e.sku >= '10' and e.sku <= '20'
-
-
-Most of these are self explanatory, but a few deserve a special callout
- -The in, nin and finset conditionals allow you to pass in an Array of values. That is, the value portion of your filter array is itself allowed to be an array.
- -
-array("in"=>array('n2610','ABC123')
-WHERE (e.sku in ('n2610','ABC123'))
-
-
-The keyword NULL is special in most flavors of SQL. It typically won't play nice with the standard equality (=) operator. Specifying notnull or null as your filter type will get you the correct syntax for a NULL comparison while ignoring whatever value you pass in
- -
-array("notnull"=>true)
-WHERE (e.sku is NOT NULL)
-
-
-This is another special format that breaks the standard rule. Instead of a single element array, you specify a two element array. One element has the key from, the other element has the key to. As the keys indicated, this filter allows you to construct a from/to range without having to worry about greater than and less than symbols
- -
-public function testAction
-{
- var_dump(
- (string)
- Mage::getModel('catalog/product')
- ->getCollection()
- ->addFieldToFilter('price',array('from'=>'10','to'=>'20'))
- ->getSelect()
- );
-}
-
-
-The above yields
-WHERE (_table_price.value >= '10' and _table_price.value <= '20')'- -
Finally, we come to the boolean operators. It's the rare moment where we're only filtering by one attribute. Fortunately, Magento's Collections have us covered. You can chain together multiple calls to addFieldToFilter to get a number of "AND" queries.
- -
-function testAction()
-{
- echo
- (string)
- Mage::getModel('catalog/product')
- ->getCollection()
- ->addFieldToFilter('sku',array('like'=>'a%'))
- ->addFieldToFilter('sku',array('like'=>'b%'))
- ->getSelect();
-}
-
-
-By chaining together multiple calls as above, we'll produce a where clause that looks something like the following
- -WHERE (e.sku like 'a%') AND (e.sku like 'b%')- -
To those of you that just raised your hand, yes, the above example would always return 0 records. No sku can begin with BOTH an a and a b. What we probably want here is an OR query. This brings us to another confusing aspect of addFieldToFilter's second parameter.
- -If you want to build an OR query, you need to pass an Array of filter Arrays in as the second parameter. I find it's best to assign your individual filter Arrays to variables
- -
-public function testAction()
-{
- $filter_a = array('like'=>'a%');
- $filter_b = array('like'=>'b%');
-}
-
-
-and then assign an array of all my filter variables
-
-public function testAction()
-{
- $filter_a = array('like'=>'a%');
- $filter_b = array('like'=>'b%');
- echo
- (string)
- Mage::getModel('catalog/product')
- ->getCollection()
- ->addFieldToFilter('sku', array($filter_a, $filter_b))
- ->getSelect();
-}
-
-
-In the interest of being explicit, here's the aforementioned array of filter arrays.
-array($filter_a, $filter_b)- -
This will gives us a WHERE clause that looks something like the following
- -WHERE (((e.sku like 'a%') or (e.sku like 'b%')))- -
You're now a Magento developer walking around with some serious firepower. Without having to write a single line of SQL you now know how to query Magento for any Model your store or application might need.
diff --git a/guides/m1x/other/appsec-900_addhandler.html b/guides/m1x/other/appsec-900_addhandler.html deleted file mode 100644 index 0bbc88c618..0000000000 --- a/guides/m1x/other/appsec-900_addhandler.html +++ /dev/null @@ -1,98 +0,0 @@ ---- -title: 'Discover credit card validation issue: Magento EE 1.9.1.1—.13.1.0 and CE 1.4.2.0—1.8.1.0' -layout: m1x ---- - -We recently identified potential exploits that:
-Creating files with a .csv extension can lead to executing files like php.csv (only under circumstances discussed in this article). The ability to run code with a .csv extension is dangerous itself and could be combined with other attacks; for example, targeting other software installed on the server.
-You can resolve this issue by changing your server's configuration as discussed in Resolving the File System Vulnerability.
-Although Magento code is protected by a hash value, the possibility of a successful exploit cannot be eliminated because of the low entropy of the hash secret value.
-We strongly recommend you to take precautions discussed in this article and apply a patch for your version of Magento Enterprise Edition or Community Edition.
- -Magento software versions affected: The issue affects all shipping versions of Magento Community Edition (CE) and Enterprise Edition (EE).
-Operating system versions affected:
-The following table shows the patch you should get for your version of CE or EE.
-| Version | -Patch | -
|---|---|
| EE 1.13 and 1.14, CE 1.8 and 1.9 | -SUPEE-1533_EE_1.13.x_v1.patch | -
| EE 1.12, CE 1.7 | -SUPEE-1533_EE_1.12.x_v1.patch | -
| EE 1.11, CE 1.6 | -SUPEE-1533_EE_1.11.x_v1.patch - |
| EE 1.10.1, CE 1.5.1 | -SUPEE-1533_EE_1.10.1.x_v1.patch | -
| EE 1.10.0.1, CE 1.5.0.1 | -SUPEE-1533_EE_1.10.0.x_v1.patch | -
| EE 1.9 | -SUPEE-1533_EE_1.9.x_v1.patch |
To get and apply your patch, see How to Apply and Revert Magento Patches.
-To determine if you're vulnerable to execution of PHP code with a non-PHP extension, search your web server configuration file for the following string:
-AddHandler application/x-httpd-php .php-
The Apache configuration file is typically /etc/httpd/conf/httpd.conf
-To confirm you're vulnerable:
-<?php -phpinfo()

To resolve this vulnerability, you must log in to the Magento server as a user with root privileges or as a user with permissions to change the web server configuration.
-To resolve the vulnerability:
-# AddHandler application/x-httpd-php .php
<FilesMatch \.php$> -SetHandler application/x-httpd-php -</FilesMatch>- Some operating systems, like Red Hat Enterprise, might require different syntax such as: -
<FilesMatch \.php$> - SetHandler php5-script -</FilesMatch>- The regular expression in this setting matches .php only to the final extension in the file name, applying the handler only to PHP files and preventing PHP from executing. -
Magento has fixed an issue that prevented some Discover credit cards from validating properly. The issue was that certain Discover credit card number ranges were not recognized as being valid. As a result of the fix, all Discover cards should validate properly.
-This fix applies to:
-To get the patch for Magento CE, submit a Magento CE help request.
- - -To get the patch for Magento EE:
-We'd like to draw your attention to new patches that were recently posted to the Partner Portal and Support Center. These patches deliver important improvements, such as improving security of the Magento Connect Manager and making it easier to install community-created translation packages.
- -Patch name:
-Result of applying this patch:
-To get this patch:
-Patch name: PATCH_SUPEE-3630_EE_1.12.x_v1.sh for EE 1.12.x. After applying this patch, your search engine returns search results to users on the web store while reindexing is underway. We recommend you install this patch if you're using the Solr search engine. This patch can result in slower performance if you're using the default MySQL Full Text search engine.
-To get this patch, contact Magento Support.
- -Customers of traditional stores and online web stores love coupons. Typically, a merchant sends coupons to customers who input them when checking out. The coupon saves the customer money and hopefully entices the customer to visit the store more frequently. In addition, the merchant can track coupon codes to individual customers to target market those customers.
- -Magento CE 1.7 introduced a new method of creating coupon codes—auto generation. Auto generating coupons means Magento programmatically creates several coupon codes at one time quickly and easily. However, if Magento generates the coupon codes, you'd have to manually distribute them to customers.
-Magento's REST API is extensible and can easily be called by an outside program to auto generate coupon codes. You can use this feature, for example, to e-mail coupon codes to your top 100 customers.
-No programming is necessary to implement the extension module discussed in this guide; however, basic familiarity with Magento modules and PHP programming is desirable.
-The Coupon AutoGen API enables any authorized external program to instruct Magento to:
-.php fileThis guide discusses how to use coupon auto generation and a web service to dynamically call the Magento REST API to generate a series of codes. The web service instantiates the underlying Magento sales rule (salesrule/rule) coupon code generator and creates a pool of new codes. These codes returned to the caller as a JSON string.
For more information about the Magento REST API, see Introduction to REST API. To extend the REST API to add a web service for generating and retrieving coupon codes, this guide discusses the following:
-.xml files and one .php file to create the web service.To implement and test the Coupon AutoGen API, you must have all of the following:
-phpmyadmin, which makes it easier to view and manipulate the Magento database. You can use phpmyadmin for convenience to get the OAuth key and shared secret later in this guide.This section discusses how to install the pecl OAuth extension on Ubuntu. Consult the pecl.php.net documentation for installation instructions on other operating systems.
-The pecl OAuth extension requires the PEAR installer. The following sections discuss the installation in detail:
-root privileges.Before you begin, create a phpinfo.php file, if you have not already done so, to determine if you already have OAuth running.
To create phpinfo.php:
phpinfo.php anywhere on the web server's docroot:
-<?php -// Show all information, defaults to INFO_ALL -phpinfo();
http://host-or-ip[:port]/path-to-phpinfo/phpinfo.php
www.example.com and you put phpinfo.php in the web server's docroot, enter:
-http://www.example.com/phpinfo.php
OAuth.
The pecl OAuth extension requires both PEAR (which enables you to install the package) and libpcre3-dev, which enables the OAuth package to be compiled.
To install the packages and confirm that OAuth is enabled:
-apt-get install php-pear -apt-get install libpcre3-dev -pecl install oauth
root privileges.Wait while each package is installed. The message Build process completed successfully displays to indicate OAuth installed successfully.
-
Error: `make' failed displays after you enter pecl install oauth, see OAuth Package Installation Error: `make' failed.php.ini file to find the OAuth library:
-configuration option "php_ini" is not set to php.ini location -You should add "extension=oauth.so" to php.ini
php.ini in a text editor.phpinfo.php page output.
-Add the following anywhere in php.ini:
-[OAuth] -extension=oauth.so
php.ini and exit the text editor.service apache2 restart
If your phpinfo.php page is still open in a web browser, press Control+R to force a refresh; otherwise, enter the URL shown in Creating a phpinfo File to view it.
The following figure shows an example of a properly set up OAuth extension.
-
-To define a Magento coupon code generation rule:
-
| Item | -Description | -
|---|---|
| Rule Name | -Enter Generate Coupons. |
-
| Description | -Enter an optional description of the rule, such as Rule that generates a sequence of coupon codes. |
-
| Status | -From the list, click Active. | -
| Websites | -Click the websites on which you want the coupons to display. Hold down the Shift key and click the names of all items to select them. | -
| Customer Groups | -Hold down the Shift key and click the names of all items to select them. | -
| Coupon | -Click Specific Coupon | -
| Coupon Code | -Leave the field blank. | -
| CE only. Auto Generation | -Select the Use Auto Generation checkbox. | -
| CE only. Uses per Coupon | -Enter 10. |
-
| Uses per Customer | -Enter 1. |
-
| From Date | -Select today's date. | -
| To Date | -Select any date in the future. | -
| Priority | -Enter 0. |
-
| Public In RSS Feed | -Click No. | -
The rule has been saved displays at the top of the page to indicate that Magento successfully saved the rule you just created.
| Item | -Description | -
|---|---|
| Apply | -From the list, click Percent of product price discount. | -
| Discount Amount | -Enter 10. |
-
| Maximum Qty Discount is Applied To | -Enter 1. |
-
| Discount Qty Step (Buy X) | -Enter 1. |
-
| Apply to Shipping Amount | -From the list, click No. | -
| Free Shipping | -From the list, click No. | -
| Stop Further Rules Processing | -From the list, click Yes. | -
| EE only Add Reward Points | -Enter 0. |
-
The rule has been saved displays to indicate that Magento saved the rule action options you just entered. Notice that this page now has a row for the Generate Coupons rule you just defined.
Now that you've created a rule, this section discusses how to use the rule to manually generate a sequence of coupon codes.
-| Item | -Description | -
|---|---|
| Coupon Qty | -Enter 3. |
-
| Code Length | -Enter 12. |
-
| Code Format | -Click Alphanumeric. | -
| Coupon Prefix | -Enter TEST-. |
-
| Coupon Suffix | -Enter -TEST. |
-
| Dash Every X Characters | -Enter 0. |
-

In the preceding section, you created a Shopping Cart Price Rule named Generate Coupons that manually generates a set of coupon codes. To use those codes, you could export them to a file, and then import them into any external program you want; however, this is a time-consuming procedure!
-Fortunately, you can automate this process by adding a coupon code auto-generate API to Magento's existing REST API. Using this API, an external program can automatically get the coupon codes it needs.
-The following sections discuss how to extend Magento's REST API to include the Coupon AutoGen API:
-While you're implementing the Coupon AutoGen API, you must disable Magento's caching so Magento will find and use your new code immediately.
-To disable the cache:
-
This section discusses how to create a module (also referred to as an extension). The module consists of configuration files that create a web service that extends the Magento REST API to take input from an external program. This program uses HTTP POST and OAuth calls to auto-generate coupon codes.
-In this guide, the external program is a PHP script; however, it could be any application that uses OAuth and REST calls.
-For more information about Magento module development, see developer documentation on Magento Connect.
-root and change the permissions appropriately later. Consult an IT administrator if you're not sure how to proceed.-magento-install-dir/app/code/community/CouponDemo -magento-install-dir/app/code/community/CouponDemo/AutoGen -magento-install-dir/app/code/community/CouponDemo/AutoGen/etc -magento-install-dir/app/code/community/CouponDemo/AutoGen/Model -magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2 -magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon -magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon/Rest -magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon/Rest/Admin-For example, if Magento is installed in
/var/www/magento, create the following directories:
--/var/www/magento/app/code/community/CouponDemo -/var/www/magento/app/code/community/CouponDemo/AutoGen/etc -/var/www/magento/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon/Rest/Admin
The following figure shows an example.
-
magento-install-dir/app/etc/modules directory.CouponDemo_AutoGen.xml and have the following contents.
-<?xml version="1.0"?>
-<config>
- <modules>
- <CouponDemo_AutoGen>
- <active>true</active>
- <codePool>community</codePool>
- </CouponDemo_AutoGen>
- </modules>
-</config>
-
-CouponDemo_AutoGen.xml and exit the text editor.magento-install-dir/app/code/community/CouponDemo/AutoGen/etc directory.config.xml with the following contents.
-<?xml version="1.0"?>
-<config>
- <modules>
- <CouponDemo_AutoGen>
- <version>0.1.0</version>
- </CouponDemo_AutoGen>
- </modules>
- <global>
- <models>
- <autogen>
- <class>CouponDemo_AutoGen_Model</class>
- </autogen>
- </models>
- </global>
-</config>
-
-api2.xml with the following contents.
-<config>
- <api2>
- <resource_groups>
- <autogen translate="title" module="CouponDemo_AutoGen">
- <title>CouponDemo API</title>
- <sort_order>10</sort_order>
- </autogen>
- </resource_groups>
- <resources>
- <autogen translate="title" module="CouponDemo_AutoGen">
- <group>autogen</group>
- <model>autogen/api2_coupon</model>
- <title>Coupon Code Auto Generation</title>
- <sort_order>10</sort_order>
- <privileges>
- <admin>
- <create>1</create>
- <retrieve>1</retrieve>
- </admin>
- </privileges>
- <attributes>
- <coupon_id>Coupon ID</coupon_id>
- <code>Code</code>
- <qty>Quantity</qty>
- <length>Length</length>
- <format>Format</format>
- </attributes>
- <routes>
- <route>
- <route>/coupondemo/rules/:rule_id/codes</route>
- <action_type>collection</action_type>
- </route>
- </routes>
- <versions>1</versions>
- </autogen>
- </resources>
- </api2>
-</config>
-
-api2.xml and exit the text editor.magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2 directory.Coupon.php with the following contents.
-<?php
-class CouponDemo_AutoGen_Model_Api2_Coupon extends Mage_Api2_Model_Resource
-{
-}
-
-Coupon.php and exit the text editor.magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon/Rest/Admin directory.V1.php with the following contents.
-<?php
-/* Coupon AutoGen REST API
-*
-* @category CouponDemo
-* @package CouponDemo_AutoGen
-* @author Chuck Hudson (used with permission). For more recipes, see Chuck's book http://shop.oreilly.com/product/0636920023968.do
-*/
-class CouponDemo_AutoGen_Model_Api2_Coupon_Rest_Admin_V1 extends CouponDemo_AutoGen_Model_Api2_Coupon
-{
- /**
- * Generate one or more coupon codes using the Generate Coupons rule defined in Magento.
- * Expected parameters are:
- * {
- * 'qty': int, - number of coupon codes to instruct Magento to generate
- * 'length': int, - length of each generated coupon code
- * 'format': string, - alphanum (for alphanumeric codes), alpha (for alphabetical codes), and num (for numeric codes)
- * }
- *
- * @param array $couponData
- * @return string|void
- */
- protected function _create($couponData)
- {
- $ruleId = $this->getRequest()->getParam('rule_id');
- $couponData['rule_id'] = $ruleId;
- $rule = $this->_loadSalesRule($ruleId);
- // Reference the MassGenerator on this rule.
- /** @var Mage_SalesRule_Model_Coupon_Massgenerator $generator */
- $generator = $rule->getCouponMassGenerator();
- // Validate the generator
- if (!$generator->validateData($couponData)) {
- $this->_critical(Mage::helper('salesrule')->__('Coupon AutoGen API: Invalid parameters passed in.'),
- Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
- } else {
- // Set the data for the generator
- $generator->setData($couponData);
- // Generate a pool of coupon codes for the Generate Coupons rule
- $generator->generatePool();
- }
- }
- /**
- * Retrieve list of coupon codes.
- *
- * @return array
- */
- protected function _retrieveCollection()
- {
- $ruleId = $this->getRequest()->getParam('rule_id');
- $rule = $this->_loadSalesRule($ruleId);
- /** @var Mage_SalesRule_Model_Resource_Coupon_Collection $collection */
- $collection = Mage::getResourceModel('salesrule/coupon_collection');
- $collection->addRuleToFilter($rule);
- $this->_applyCollectionModifiers($collection);
- $data = $collection->load()->toArray();
- return $data['items'];
- }
- /**
- * Load sales rule by ID.
- *
- * @param int $ruleId
- * @return Mage_SalesRule_Model_Rule
- */
- protected function _loadSalesRule($ruleId)
- {
- if (!$ruleId) {
- $this->_critical(Mage::helper('salesrule')
- ->__('Rule ID not specified.'), Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
- }
- $rule = Mage::getModel('salesrule/rule')->load($ruleId);
- if (!$rule->getId()) {
- $this->_critical(Mage::helper('salesrule')
- ->__('Rule was not found.'), Mage_Api2_Model_Server::HTTP_NOT_FOUND);
- }
- return $rule;
- }
-}
-
-V1.php and exit the text editor.File permissions and ownership are important for any Linux application. Magento provides general guidelines for permission and ownership although following them are not a requirement for this guide. The configuration files and directories can be owned by root or other users and it won't prevent the procedures discussed in this guide from completing successfully.
Consult your network administrator if you are not sure how to set file permissions and ownership. The procedure that follows is a suggestion only.
-The Magento guidelines discussed in the following procedure are taken from this Magento Wiki article and set the following:
-your-login-name:apache-user-group.ps -ef | grep apache2. The following procedure assumes it is www-data.To optionally set permissions and ownership according to Magento guidelines:
-root privileges, enter the following commands in the order shown to change ownership of the files and directories you created as discussed in this guide:cd magento-install-dir/app/code/community
-chown -R your-login-name:www-data CouponDemo
-find . -type f -exec chmod 644 {} +
-find . -type d -exec chmod 755 {} +root privileges, enter the following commands in the order shown to change the permissions and ownership of CouponDemo_AutoGen.xmlcd magento-install-dir/app/etc/modules -chown your-login-name:www-data CouponDemo_AutoGen.xml -chmod 644 CouponDemo_AutoGen.xml
For security reasons, Magento allows only authorized external programs to call the Magento REST API.
-The following sections discuss how to enable the test script (discussed in the next section) to call the Coupon AutoGen API:
-To use the Magento Admin Panel to create a role for the Coupon AutoGen API:
-Coupon Auto Generate Demo.Select the checkbox next to the node labeled CouponDemo API.
-Magento automatically checks the child checkboxes as the following figure shows.
-
Now that you have a role, you must add users to give them permission to call the Coupon AutoGen API as follows:
-
This section discusses how to enable any user with a REST Admin role to use the Coupon AutoGen API.
-To set REST attributes for the REST Admin role:
-
This section discusses how to create a consumer so you can test the Coupon AutoGen API before you deploy it in a production system. After successfully testing the API, you can remove this user.
-
Coupon AutoGen Test Driver.oauth_consumer. It might be more convenient for you to use phpmyadmin or database tools to retrieve them from the database after you save the role.This section discusses how to create a simple PHP file that acts as an external program and, with permissions you granted the OAuth consumer, enables the program to use the HTTP POST method to auto generate coupon codes.
-You can use any type of OAuth/REST call, in fact, such as using the Firefox REST Client plug-in as discussed here.
-The following sections discuss how to create and run the test script:
- - -The test script you create calls the Coupon AutoGen API, thereby causing Magento to generate the specified coupon codes and return them to the caller (rest_test.php) in the form of a JSON-encoded string. Finally, the server responds to the browser's request with an HTML page containing the generated coupon codes.
The PHP code that follows:
-consumerKey and consumerSecret to set up the OAuth client.$couponGenerationData. The data should include the following:
-fetch command with the resourceUrl for the web service call.Finally, the server responds to the browser's request with an HTML page containing the generated coupon codes.
-To create the test script, named rest_test.php:
magento-install-dir/rest_test.php with the following contents.
-
-<?php
-/********************************************************************
-File name: rest_test.php
-Description:
-A PHP test script that calls the Coupon AutoGen extension
-to Magento's REST API.
-The Coupon AutoGen API takes:
--- the rule ID of the "Generate Coupons" rule to execute
--- the number of coupon codes to generate
--- the length of each coupon code
--- the format of each coupon code
-The API returns the generated coupon codes, in JSON-encoded form
- ********************************************************************/
-// Replace <<...>> below with the key and secret values generated for the Coupon AutoGen Test Driver
-$consumerKey = '<<YOUR CONSUMER KEY>>'; // from Admin Panel's "REST - OAuth Consumers page"
-$consumerSecret = '<<YOUR CONSUMER SECRET>>'; // from Admin Panel's "REST - OAuth Consumers page"
-
-// Set the OAuth callback URL to this script since it contains the logic
-// to execute *after* the user authorizes this script to use the Coupon AutoGen API
-$callbackUrl = "http://<<host-or-ip:port>>/<<path>>/rest_test.php";
-
-// Set the URLs below to match your Magento installation
-$temporaryCredentialsRequestUrl = "http://<<host-or-ip:port>>/<<path>>/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
-$adminAuthorizationUrl = 'http://<<host-or-ip:port>>/<<path>>/admin/oauth_authorize';
-$accessTokenRequestUrl = 'http://<<host-or-ip:port>>/<<path>>/oauth/token';
-$apiUrl = 'http://<<host-or-ip:port>>/<<path>>/api/rest';
-
-session_start();
-if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
- $_SESSION['state'] = 0;
-}
-try {
- $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
- $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
- $oauthClient->enableDebug();
- if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
- $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
- $_SESSION['secret'] = $requestToken['oauth_token_secret'];
- $_SESSION['state'] = 1;
- header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
- exit;
- } else if ($_SESSION['state'] == 1) {
- $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
- $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
- $_SESSION['state'] = 2;
- $_SESSION['token'] = $accessToken['oauth_token'];
- $_SESSION['secret'] = $accessToken['oauth_token_secret'];
- header('Location: ' . $callbackUrl);
- exit;
- } else {
- // We have the OAuth client and token. Now, let's make the API call.
- $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
- // Set the array of params to send with the request
- $ruleId = <<RULE_ID>>; // Set to the rule ID of the Generate Coupons rule
- $couponGenerationData = array();
- $couponGenerationData['qty'] = 2; // Number of coupons codes to create
- $couponGenerationData['length'] = 7; // Length of each coupon code
- // Options for format include:
- // alphanum (for alphanumeric codes), alpha (for alphabetical codes), and num (for numeric codes)
- $couponGenerationData['format'] = "alphanum"; // Use alphanumeric for the coupon code format
- // Generate coupon codes via POST
- $resourceUrl = "$apiUrl/coupondemo/rules/{$ruleId}/codes";
- $oauthClient->fetch($resourceUrl, json_encode($couponGenerationData), OAUTH_HTTP_METHOD_POST, array(
- 'Accept' => 'application/json',
- 'Content-Type' => 'application/json',
- ));
- // Retrieve list of created coupons via GET
- $collectionFilters = array('limit' => $couponGenerationData['qty'], 'order' => 'coupon_id', 'dir' => 'dsc');
- $oauthClient->fetch($resourceUrl, $collectionFilters, OAUTH_HTTP_METHOD_GET, array(
- 'Accept' => 'application/json',
- 'Content-Type' => 'application/json',
- ));
- $coupons = json_decode($oauthClient->getLastResponse(), true);
- // Display the newly generated codes to demonstrate that the Coupon AutoGen API works
- // In reality, you might put these codes in emails to customers, store them in a database, etc.
- echo "New coupon codes:
";
- foreach ($coupons as $coupon) {
- echo " --> " . $coupon['code'] . "
";
- }
- }
-} catch (OAuthException $e) {
- print_r($e->getMessage());
- echo "
";
- print_r($e->lastResponse);
-}
-
-| String to change | -How to change it | -
|---|---|
| <<YOUR CONSUMER KEY>> | -Coupon AutoGen Test Driver OAuth consumer's key. -You can view this in the Admin Panel: System > Web Services > REST - OAuth Consumers or you can get the value from the |
-
| <<YOUR CONSUMER SECRET>> | -Coupon AutoGen Test Driver OAuth consumer's secret. -You can view this in the Admin Panel: System > Web Services > REST - OAuth Consumers or you can get the value from the |
-
| <<host-or-ip:port>>/<<path>> | -Your Magento instance's fully qualified hostname or IP address and port, if you are using a port other than 80, and the path to your Magento installation. If you are running Magento on localhost, enter For example, if your Magento server's hostname is |
-
| <<RULE_ID>> | -Generate Coupons rule ID. -Get this value by clicking Promotions > Shopping Cart Price Rules . |
-
To run the test script:
-http://magento-server-host-or-ip[:port]/rest_test.php


To optionally see these codes in the Admin Panel:
-
Only after successfully completing the test, you should re-enable Magento's caching system, so performance returns to normal.
-
To re-enable the Magento cache:
-Enable from the Actions list.Refresh from the Actions list.Congratulations! You have successfully added the Coupon AutoGen API to Magento's REST API. Following the same procedure, you can expose lots of Magento functionality to external programs.
- -The following sections discuss solutions to issues you might encounter when setting up this demonstration:
-Problem: OAuth package installation fails with the error ERROR: `make' failed.
Description: In some cases, the pecl install oauth command does not install a C compiler. If you encounter the following error, you must install the make package; otherwise, OAuth won't compile:
1: make: not found -ERROR: `make' failed-
Solution:
-root privileges:
-apt-get install make -pecl install oauth
Build process completed successfully displays to indicate OAuth compiled successfully.php.ini file to find the OAuth library:
-configuration option "php_ini" is not set to php.ini location -You should add "extension=oauth.so" to php.ini
php.ini in a text editor.phpinfo.php page output.
-Add the following anywhere in php.ini:
-[OAuth] -extension=oauth.so
php.ini and exit the text editor.service apache2 restart-
Problem: After setting up the CouponDemo configuration files, the CouponDemo API Calls checkboxes do not display in the Admin Panel. A sample is shown in a figure earlier in this guide.
-Description: The CouponDemo API Calls checkboxes display to indicate you set up the module correctly. If they don't display, either the Magento cache hasn't been entirely cleared or there's something wrong with the directory structure or configuration files.
-Solution: Use the following steps to isolate and correct the issue:
-rm -r magento-install-dir/var/cache -rm -r magento-install-dir/var/session
.xml configuration files to make sure there is no leading white space (that is, there are no blank lines at the beginning of the files..xml files.The following sections discuss issues you might encounter when you run rest_test.php in a web browser:
The following error displays in the web browser:
-Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
-{"messages":{"error":[{"code":401,"message":"oauth_problem=consumer_key_rejected"}]}}
-Description: Your OAuth authentication attempt failed because the credentials are incorrect.
-Solution: Open rest_test.php in a text editor and verify the values of the following:
$consumerKey = 'value'; -$consumerSecret = 'value';-
You can find these values in the oauth_consumer database table or in the Admin Panel: System > Web Services > REST - OAuth Consumers.
After verifying the correct values, save your changes to rest_test.php and try again.
The following error displays in the web browser:
-Invalid auth/bad request (got a 404, expected HTTP/1.1 20X or a redirect)
-{"messages":{"error":[{"code":404,"message":"Rule was not found."}]}}
-Description: The shopping cart promotion rule could not be found.
-Solution: Open rest_test.php in a text editor and verify the value of the following:
$ruleId = value;-
You can find this value in the Admin Panel: Promotions > Shopping Cart Price Rules.
-Change the value in rest_test.php, save it, and try again.
The following error displays in the web browser:
-Invalid auth/bad request (got a 404, expected HTTP/1.1 20X or a redirect) -Not Found -The requested URL /magento/oauth/initiate was not found on this server.-
Description: The HTTP redirect failed, most likely because web server rewrites are not properly enabled.
-Solution: Make sure web server rewrites are enabled. The procedure you use depends on your web server and operating system. An example for Ubuntu can be found here.
- -Refer to Magento APIs—REST for documentation explaining how the Magento's REST API framework works.
- diff --git a/guides/m1x/other/ht_install-patches.html b/guides/m1x/other/ht_install-patches.html deleted file mode 100644 index 5ac1aa3a6a..0000000000 --- a/guides/m1x/other/ht_install-patches.html +++ /dev/null @@ -1,150 +0,0 @@ ---- -layout: m1x -title: How to Apply and Revert Magento Patches ---- - - - -This article discusses how to apply and revert Magento patches you get in any of the following ways: -
If you don't already have a patch, contact Magento Support.
-.sh. If your patch file name ends in .patch or something else, contact Magento Support before proceeding.For more step-by-step details that are provided here, see one of the following:
- - -Magento Support provides some patches for Magento CE and EE on magentocommerce.com. This section discusses how to get those patches.
-If Magento Support provided a patch to you, skip this section and continue with How to Apply a Magento Patch.
-See one of the following sections for specific information about Magento CE or EE:
- - -To get patches for Magento CE:
-To get patches for Magento EE:
-
To apply a Magento patch:
-.sh file to your Magento installation root directory..sh. If your patch file name ends in .patch or something else, contact Magento Support before proceeding./var/www/html/magento.root):
- chmod +x <patch-file-name>.sh -./<patch-file-name>.sh- A message such as the following displays to confirm the patch installed successfully: -
Patch was applied/reverted successfully.
ps -o "user group command" -C httpd,apache2apache and the Apache web server user on Ubuntu is www-data.root privileges, enter the following command from the Magento installation directory:
- chown -R web-server-user-name .- For example, on Ubuntu where Apache usually runs as
www-data, enter
- chown -R www-data .
We released a security patch in October, 2016 that might cause issues for some users. This section applies to you if any of the following is true:
-PATCH_SUPEE-8788_<magento version>_v1.)We recommend the following:
-To replace SUPEE-7877 version 1 with version 2 or later:
-<your Magento install dir>/app/etc/applied.patches.list in a text editor.PATCH_SUPEE-8788_<magento version>_v1 in the name.test_oauth.php from your Magento base directory.skin/adminhtml/default/default/media/flex.swf -skin/adminhtml/default/default/media/uploader.swf -skin/adminhtml/default/default/media/uploaderSingle.swf- - If the files are present, delete them to avoid a potential security exploit. As of Magento CE 1.9.0.0 and Magento EE 1.14.0.0, we no longer distribute
.swf files with the Magento software.To apply patch SUPEE-8788:
-<your Magento install dir>/app/etc/applied.patches.list in a text editor.test_oauth.php from your Magento base directory.skin/adminhtml/default/default/media/flex.swf -skin/adminhtml/default/default/media/uploader.swf -skin/adminhtml/default/default/media/uploaderSingle.swf- - If the files are present, delete them to avoid a potential security exploit. As of Magento CE 1.9.0.0 and Magento EE 1.14.0.0, we no longer distribute
.swf files with the Magento software.If you're not sure which patches are already applied, open <your Magento install dir>/app/etc/applied.patches.list.
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
-root):sh patch-file-name.sh -R
If you get an error when you run the patch, use the following suggestions:
-/var/www/magento/var/www/html/magentoroot privileges.Magento Enterprise Edition (EE) versions 1.8.0.0 and later enable you to configure either of the following as a - catalog search engine:
-Solr enables you to provide your web store users with a powerful full-text search engine that includes:
-See one of the following sections for more information:
-This guide is intended for Magento EE administrators and systems integrators who have some familiarity with search - engines—ideally, who also have Solr configuration experience. No programming is required to perform the tasks - discussed in this guide.
-This guide discusses a simple Solr configuration that uses the example Solr configuration provided with Solr, default - Solr integration options provided with Magento EE, and also explains how to configure Magento EE to use Solr. Advanced - configuration tasks—such as setting up dictionaries—are beyond the scope of this guide.
-The following table provides a quick comparison between Magento with the default MySQL full text search and Magento - with Solr search.
-| Feature | -Magento with MySQL full-text search | -Magento with Solr search | -
|---|---|---|
| Full text search | -
- Yes and also supports two additional search modes: -
| Yes† | -
| Search recommendations | -Yes | -Yes | -
| Faceted search (used in layered navigation) | -Yes | -Yes | -
| Range (such as price range) | -Yes | -Yes | -
| Sort-by options (for example, sort by relevance) | -Yes | -Yes | -
| Zero results tips or results correction | -No | -Yes | -
| Suggestions | -No | -Yes | -
| Clustering | -No | -Yes | -
| Attribute weight based on attribute settings | -No | -Yes | -
| Search localized characters | -No | -Yes | -
| Word delimiter (for example, searching for spider man or spiderman - return spider-man) | -No | -Yes | -
The following table summarizes what versions of Magento EE work with what versions of Solr.
-| Magento EE version | -Compatible Solr version(s) | -Comment | -
|---|---|---|
| EE 1.14.x.x | -Any version - up to 3.6.2. | -No patch is required to use EE 1.14.x.x with Solr 3.6.2. Click here to browse the list of all - available Solr versions. | -
| EE 1.13.x.x | -Any version - up to 3.6.2. | -Click here to - browse the list of all available Solr versions. | -
| EE 1.12.0.x | -Any version - up to 3.5.0 | -
- If you use a later version, such as 3.6.x, see Information About - Enterprise Edition (EE) Patches for Apache Solr to get a patch. -Click here to browse the list of - all available Solr versions. - |
-
| EE 1.8.0.0 to 1.11.0.2 | -Any version - up to 3.4.0. - | -
- To use a Solr version later than 1.4.x, see Information About - Enterprise Edition (EE) Patches for Apache Solr to get a patch. - Click here to browse the list of all - available Solr versions. - |
-
Solr runs as a standalone full-text search server in a servlet container such as Jetty (which is used by the Solr - example configuration) and Tomcat.
-Solr uses the Lucene Java search library for full-text indexing and search. Your applications interact with Solr - using HTTP POST (in JSON, - XML, CSV, or binary formats) to index - documents and using HTTP - GET to retrieve search results back as JSON, XML, or a - variety of other formats (Python, Ruby, PHP, CSV, binary, and so on). If you're a programmer, try the Solr tutorial. Whether - you're a programmer or not, read the Solr FAQ.
-No programming is required to implement Solr as discussed in this guide.
-Solr's powerful external configuration allows it to be tailored to almost any type of application without Java - coding, and it has an extensive plug-in architecture when more advanced customization is required. Solr is highly - scalable, providing distributed search and index replication.
-In this guide, you'll use the example configuration provided with Solr and Magento's provided Solr configuration to - implement a simple, quick integration with Solr.
-Some reasons to use Solr with Magento include:
-Following is a simple comparison of the default MySQL full-text search and Solr search using Magento EE 1.14.0.0 and - Solr 3.6.2. Magento EE catalog content is provided by sample data you can download from Magento.
-Among the many options Solr gives you is the option to suggest names of products in the event the user - enters an incomplete or incorrect search term in your Magento store's Search field.
- -Using the default MySQL full-text search, if a user enters an incorrect search term (such as shirrt instead - of shirt, no results display as the following figure shows.
-
-
-Using Solr, if a user enters an incorrect search term, suggestions display as the following figure shows.
-
-In addition, if a user enters an incomplete search term, Magento provides dictionary-based suggestions as the - following figure shows.
-
-
-The tasks discussed in this guide require the following:
-java -version- If the message java: command not found displays, you must install the Java SDK as discussed in the next - section. If Java is installed, make sure it's version 1.6 or later.
The following sections discuss how to install the prerequisite software:
- - -To install the Java 6 SDK, enter the following command as a user with root privileges:
-apt-get install openjdk-6-jdk-
To install Java 7, enter the following command as a user with root privileges:
-apt-get install openjdk-7-jdk-
The Apache Solr package installs both Solr and Jetty. If Jetty is already installed, see the Solr with Jetty Wiki for more information.
-To install Solr and Jetty:
-If you're not sure what version of Solr to use, see Support Matrix for Solr and - Magento EE.
-cd empty-directory -wget http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz
wget http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz ---2012-11-01 16:20:16-- http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz -Resolving archive.apache.org... 140.211.11.131 -Connecting to archive.apache.org|140.211.11.131|:80... connected. -HTTP request sent, awaiting response... 200 OK -Length: 78673382 (75M) [application/x-tar] -Saving to: `apache-solr-3.6.2.tgz' - -100%[======================================>] 78,673,382 1.41M/s in 36s - -2012-11-01 16:20:52 (2.08 MB/s) - `apache-solr-3.6.2.tgz' saved [78673382/78673382]-
tar -xvf apache-solr-3.6.2.tgz-
The following topics discuss how to configure Solr to work with Magento EE:
-Magento comes packaged with a sample Solr configuration you can use and customize. To get started, you'll copy the - Magento configuration to Solr, replacing any existing files. After that you can start Solr and begin configuring - Magento to work with it.
-To copy the Magento Solr configuration:
-cd [your Solr install dir]/example/solr/conf -cp -R [your Magento install dir]/lib/Apache/Solr/conf/* .
cd /etc/solr/apache-solr-3.6.2/example/solr/conf -cp -R /var/www/magento/lib/Apache/Solr/conf/* .
<dataDir>${solr.data.dir:./solr/data}</dataDir>
- Change it to:<dataDir>${solr.data.dir:}</dataDir>
- java -jar [your Solr install dir]/example/start.jar
This section discusses how to configure Magento EE to use the Solr search engine.
-To configure Magento to work with Solr:
-| Option | -Description | -
|---|---|
| Search Engine | -Click Solr | -
| Solr Server Hostname | -Enter the fully qualified hostname or IP address of the machine running Solr. (If - Solr is running on the same host as Magento, you can optionally use 127.0.0.1.) | -
| Solr Server Port | -Enter Solr's listen port. (The example Jetty servlet container uses 8983. The - default for Tomcat is usually 8080.) | -
| Solr Server Username | -Optional. Enter a username for Solr authentication, if desired. - | -
| Solr Server Password | -Optional. Enter the user's password, if desired. | -
| Solr Server Timeout | -Enter a connection timeout value, in seconds. | -
| Solr Server Path | -
-
- Specifies the path and name of the Solr web application. The path used by the example Solr - configuration is solr. -If you customized Solr, the value you enter in this field must exactly match the value of - webapp_name=value in [your Solr install - dir]/example/solr/conf/scripts.conf. - |
-
| Indexation Mode | -
- Specifies how Solr processes indexed content. -From the Indexation Mode list, click one of the following: -
|
-
- | Button state | -Meaning | -
|---|---|
![]() |
- The test connection succeeded. Click Save Config and continue - with the next section. | -
![]() |
- The test connection failed. Try the following:
-
|
-
This section discusses how to configure Magento to work with Solr using options in the Admin Panel. Although - additional Solr customization is possible, it is beyond the scope of this guide.
-To configure Magento to work with Solr:
-| Option | -Description | -
|---|---|
| Minimal Query Length | -Enter the minimum number of characters permitted for a catalog search. | -
| Maximum Query Length | -Enter the maximum number of characters permitted for a catalog search. | -
| Search Engine - Solr Server Hostname - Solr Server Port - Solr Server Username - Solr Server Password - Solr Server Timeout - Solr Server Path - Indexation Mode - |
- Discussed in Configuring Solr to Work With Magento. - | -
| Enable Search Suggestions | -
- Suggestions are the native Solr mechanism of advising users in the event they enter - incomplete or incorrect user input. Suggestions, when enabled, are automatically provided as part of - any search request. -Solr completes incomplete or incorrect input using a dictionary that is based on the main index (and - can be customized using configuration files to use any other arbitrary dictionary). Suggestions - display with default text "Did you mean:" in the search results page if needed. -Notes: -
|
-
| Search Suggestions Count | -Enter the maximum number of suggestions to return. | -
| Show Results Count for Each Suggestion | -
- The default option, No, displays only the suggestion and not the number of results - for each suggestion. -Click Yes to display the number of results for each suggestion. - |
-
| Enable Search Recommendations | -
- Recommendations display terms related to a requested word or phrase on the search results - page. -This functionality is not based on third party engine functionality, but is implemented as part of - the Enterprise_Search module and can be shown with the Solr search suggestions block. -By default, Magento uses the Enterprise_Search_Model_Adapter_HttpStream module for - recommendations. If you install the Apache - Solr PHP extension, Magento automatically uses the - Enterprise_Search_Model_Adapter_PhpExtension adapter instead. Both adapters function in the - same way with no difference in performance. However, the PhpExtension adapter is not tested - by Magento so you must thoroughly test any modifications you make to it before deploying it in a - production environment. - |
-
| Search Recommendations Count | -Enter the maximum number of recommendations to return. | -
| Show Results Count for Each Recommendation | -
- The default option, No, displays only the recommendation and not the number of - results for each recommendation. -Click Yes to display the number of results for each recommendation. - |
-
| Enable Solr Engine for Catalog Navigation | -
- Click Yes (the default) to use Solr to enable layered navigation in the category view. -Click No to use the database for layered navigation in the category view. - |
-
After you change the Solr configuration, you must reindex the catalog search index and refresh the full page - cache as follows:
-
- cd /var/www/html/magento/shell-
php indexer.php --reindex catalogsearch_fulltext
In a production environment, you should start and stop Solr using a script.
-Create a script named /etc/init.d/solr with options similar to the following:
-#!/bin/sh
-
-#Starts, stops, and restarts Apache Solr.
-#chkconfig: 35 92 08
-#description: Starts and stops Apache Solr
-
-SOLR_DIR="[your Solr install dir]"
-JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=jetty-stop-port -DSTOP.KEY=jetty-stop-key -jar start.jar"
-LOG_FILE="path-to-solr-log-file"
-JAVA="java_home"
-
-case $1 in
-start)
-echo -n "Starting Solr"
-cd $SOLR_DIR
-$JAVA $JAVA_OPTIONS 2> $LOG_FILE &
-;;
-stop)
-echo -n "Stopping Solr"
-cd $SOLR_DIR
-$JAVA $JAVA_OPTIONS --stop
-;;
-restart)
-$0 stop
-sleep 1
-$0 start
-;;
-*)
-echo "Usage: $0 {start|stop|restart}" >&2
-exit 1
-;;
-esac
- All parameters shown in the following table are required.
-| Value | -Description | -
|---|---|
| [your Solr install dir] | -The absolute file system path to your Solr installation. (For example, - /etc/solr/apache-solr-3.6.2 | -
| jetty-stop-port - jetty-stop-key |
-
- Security parameters used to prevent malicious attempts to stop Jetty. -For -DSTOP.PORT=, specify any unused port. -For -DSTOP.KEY=, specify a string. If you omit a value for -DSTOP.KEY=, Jetty - generates a random key you must enter to stop Jetty. -For more information, see Securing Jetty. - |
-
| path-to-solr-log-file | -Absolute file system path to the Solr log file. (For example, - /var/log/solr.log) | -
| java_home | -Absolute file system path to your Java executable. (For example, - /usr/bin/java) | -
An example follows:
-#!/bin/sh
-
-#Starts, stops, and restarts Apache Solr.
-#chkconfig: 35 92 08
-#description: Starts and stops Apache Solr
-
-SOLR_DIR="/etc/solr/apache-solr-3.6.2/example"
-JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=mykey -jar start.jar"
-LOG_FILE="/var/log/solr.log"
-JAVA="/usr/bin/java"
-
-case $1 in
-start)
-echo -n "Starting Solr"
-cd $SOLR_DIR
-$JAVA $JAVA_OPTIONS 2> $LOG_FILE &
-;;
-stop)
-echo -n "Stopping Solr"
-cd $SOLR_DIR
-$JAVA $JAVA_OPTIONS --stop
-;;
-restart)
-$0 stop
-sleep 1
-$0 start
-;;
-*)
-echo "Usage: $0 {start|stop|restart}" >&2
-exit 1
-;;
-esac
- To complete the script:
-chmod +x /etc/init.d/solr-
For additional information about Solr, see the following:
-
-{% include m1x/eol_message.html %}
-
-
-
-
-This guide helps you create and configure an iOS app for Magento MobileConnect. Your app enables customers to view and make purchases for your store.
-We provide you with a sample app in the MagentoMobile extension package that you can open as an XCode project to do the customization.
- -Before you begin:
-To create the iOS app:
-MagentoShop/MagentoShop.xcodeproj in Xcode.Configuration.plist.serverURL to your store's base URL (for example, http://mystore.example.com).applicationCode to the application code displayed in the Magento Admin Panel. The following sections discuss how you can customize your Magento MobileConnect iOS app.
- -Launch images are located in MagentoShop/Resources/Images/LaunchImages.xcassets.
Refer to Apple's Human Interface Guidelines for details.
- -App icons are located in MagentoShop/Resources/Images/ApplicationIcon.xcassets.
Refer to Apple's HIG for best practices.
- -Thumbnail images display when a category or a product does not have an image defined for it.
-You can find customizable images in MagentoShop/Resources/Images/Images.xcassets/thumbnails.
A customer applies a coupon code when checking out in a web store that runs EE 1.12.0.2 and is configured to use the Payflow Pro or Payflow Express payment methods. The following error displays:
-PayPal gateway rejected the request. Field format error: 10431-Item amount is invalid
-
-To resolve this issue, contact Magento Support and request the patch for support issue ID SUPEE-1474.
-Then apply the patch as discussed in How to Apply and Revert Magento Patches.
diff --git a/guides/m1x/other/php5.4_patch.html b/guides/m1x/other/php5.4_patch.html deleted file mode 100644 index 36c7826508..0000000000 --- a/guides/m1x/other/php5.4_patch.html +++ /dev/null @@ -1,23 +0,0 @@ ---- -layout: m1x -title: Getting the PHP 5.4 patch for Magento Enterprise Edition (EE) and Community Edition (CE) ---- - - - -Magento has a patch that enables you to use PHP 5.4.x with Magento Enterprise Edition (EE) and Magento Community Edition (CE).
-This patch applies to:
-To get the patch for Magento CE:
-To get the patch for Magento EE:
-We recently identified potential exploits that:
-Creating files with a .csv extension can lead to executing files like php.csv (only under - circumstances discussed in this article). The ability to run code with a .csv extension is dangerous - itself and could be combined with other attacks; for example, targeting other software installed on the server. -
-You can resolve this issue by changing your server's configuration as discussed in Resolving - the File System Vulnerability.
-Although Magento code is protected by a hash value, the possibility of a successful exploit cannot be eliminated - because of the low entropy of the hash secret value.
-We strongly recommend you to take precautions discussed in this article and apply a patch for your - version of Magento Enterprise Edition or Community Edition.
- -Magento software versions affected: The issue affects all shipping versions of Magento Community Edition - (CE) and Enterprise Edition (EE).
-Operating system versions affected:
-The following table shows the patch you should get for your version of CE or EE.
-| Version | -Patch | -
|---|---|
| EE 1.13 and 1.14, CE 1.8 and 1.9 | -SUPEE-1533_EE_1.13.x_v1.patch | -
| EE 1.12, CE 1.7 | -SUPEE-1533_EE_1.12.x_v1.patch | -
| EE 1.11, CE 1.6 | -SUPEE-1533_EE_1.11.x_v1.patch - | -
| EE 1.10.1, CE 1.5.1 | -SUPEE-1533_EE_1.10.1.x_v1.patch | -
| EE 1.10.0.1, CE 1.5.0.1 | -SUPEE-1533_EE_1.10.0.x_v1.patch | -
| EE 1.9 | -SUPEE-1533_EE_1.9.x_v1.patch | -
To get and apply your patch, see How - to Apply and Revert Magento Patches.
-To determine if you're vulnerable to execution of PHP code with a non-PHP extension, search your web server - configuration file for the following string:
-AddHandler application/x-httpd-php .php-
The Apache configuration file is typically /etc/httpd/conf/httpd.conf
-To confirm you're vulnerable:
-<?php -phpinfo()-

To resolve this vulnerability, you must log in to the Magento server as a user with root privileges or - as a user with permissions to change the web server configuration.
-To resolve the vulnerability:
-# AddHandler application/x-httpd-php .php-
<FilesMatch \.php$> -SetHandler application/x-httpd-php -</FilesMatch>- Some operating systems, like Red Hat Enterprise, might require different syntax such as: -
<FilesMatch \.php$> - SetHandler php5-script -</FilesMatch>- The regular expression in this setting matches .php only to the final extension in the file name, - applying the handler only to PHP files and preventing PHP from executing. -
This article lists patches that Magento Support has made available for Magento EE versions 1.10.1.0 and later. The patches themselves are available on the Magento EE support portal.
-To get the patches:
-http://magento.com with your Magento EE credentials.Following is a list of available patches:
-This fix affects Magento EE 1.12.0.0, 1.12.0.1, and 1.12.0.1
- -To install this fix:
-sh PATCH_SUPEE-111_EE_1.12.0.0_v6.sh
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
-sh PATCH_SUPEE-111_EE_1.12.0.0_v6.sh -R
If you get an error when you run the patch, use the following suggestions:
-This fix affects Magento EE 1.11.1.0.
- -To install this fix:
-sh PATCH_SUPEE-107_EE_1.11.1.0_v1.sh
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
-sh PATCH_SUPEE-107_EE_1.11.1.0_v1.sh -R
If you get an error when you run the patch, use the following suggestions:
-This fix affects Magento EE 1.11.0.0, 1.11.0.1, and 1.11.0.2.
- -To install this fix:
-sh PATCH_SUPEE-108_EE_1.11.0.2_v1.sh
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
-sh PATCH_SUPEE-108_EE_1.11.0.2_v1.sh -R
If you get an error when you run the patch, use the following suggestions:
-This fix affects Magento EE 1.10.1.0 and 1.10.1.1.
- -To install this fix:
-sh PATCH_SUPEE-110_EE_1.10.1.1_v2.sh
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
-sh PATCH_SUPEE-110_EE_1.10.1.1_v2.sh -R
If you get an error when you run the patch, use the following suggestions:
-Welcome to the Magento 1.x REST API home page.
+ +\ No newline at end of file diff --git a/guides/v1.8/api/rest/Resources/Orders/order_addresses.html b/guides/v1.8/api/rest/Resources/Orders/order_addresses.html new file mode 100644 index 0000000000..3eb7895a20 --- /dev/null +++ b/guides/v1.8/api/rest/Resources/Orders/order_addresses.html @@ -0,0 +1,288 @@ +--- +layout: v1x_rest +title: Order Addresses +--- + + +
Allows you to retrieve information about billing and shipping addresses of the required order.
+ +URL Structure: http://magentohost/api/rest/orders/:orderid/addresses
+Version: 1
Description: Allows you to retrieve information on billing and shipping addresses from the required order.
+Notes: Customers can retrieve addresses only from their orders.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/32/addresses |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia +844 Jefferson Street; 4510 Willis Avenue</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + </data_item> + <data_item> + <region>Massachusetts</region> + <postcode>01852</postcode> + <lastname>Doe</lastname> + <street>1073 Smith Street</street> + <city>Lowell</city> + <telephone>508-857-6870</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Allows you to retrieve information on the order billing address.
+Notes: Customers can retrieve information on billing addresses only from their own orders.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/32/addresses/billing |
Response example:
+<?xml version="1.0"?> +<magento_api> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia +844 Jefferson Street; 4510 Willis Avenue</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ + +Description: Allows you to retrieve information on the order shipping address.
+Notes: Customers can retrieve information on shipping addresses only from their own orders.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/32/addresses/shipping |
Response example:
+<?xml version="1.0"?> +<magento_api> + <region>Massachusetts</region> + <postcode>01852</postcode> + <lastname>Doe</lastname> + <street>1073 Smith Street</street> + <city>Lowell</city> + <telephone>508-857-6870</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ +| Attribute Name | +Attribute Description | +
|---|---|
| Customer Last Name | +Customer last name | +
| Customer First Name |
+Customer first name | +
| Customer Middle Name |
+Customer middle name or initial | +
| Customer Prefix |
+Customer prefix | +
| Customer Suffix |
+Customer suffix | +
| Company |
+Company name | +
| Street |
+Street address | +
| City |
+City | +
| State |
+State | +
| ZIP/Postal Code |
+ZIP or postal code | +
| Country |
+Country name | +
| Phone Number |
+Customer phone number | +
| Address Type |
+Address type. Can have the following values: billing or shipping | +
Allows you to retrieve information about comments of the required order.
+ +URL Structure: http://magentohost/api/rest/orders/:orderid/comments
+Version: 1
Description: Allows you to retrieve information about comments of the required order.
+ +Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/33/comments |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <created_at>2012-03-09 11:20:49</created_at> + <comment></comment> + <is_customer_notified>1</is_customer_notified> + <is_visible_on_front>0</is_visible_on_front> + <status>pending</status> + </data_item> + <data_item> + <created_at>2012-03-09 11:21:32</created_at> + <comment>This is a new order for John Doe.</comment> + <is_customer_notified>1</is_customer_notified> + <is_visible_on_front>1</is_visible_on_front> + <status>pending</status> + </data_item> +</magento_api>+
Authentication: Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/33/comments |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <created_at>2012-03-09 11:21:32</created_at> + <comment>This is a new order for John Doe.</comment> + </data_item> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ + + +| Attribute Name | +Attribute Description | +Notes | +
|---|---|---|
| Comment Date | +Date when the comment was added | +Admin and Customer | +
| Comment Text | +Comment text | +Admin and Customer | +
| Is Customer Notified | +Defines whether the customer is notified about the comment. Can have the following values: 0 - Customer is not notified, 1 - Customer is notified. | +Admin only | +
| Is Comment Visible on Frontend | +Defines whether the comment is visible on the frontend. Can have the following values: 0 - Comment is not visible, 1 - Comment is visible. | + Admin only |
+
| Comment Status | +Comment status. | + Admin only |
+
Allows you to retrieve information about order items.
+ +URL Structure: http://magentohost/api/rest/orders/:orderId/items
+Version: 1
Description: Allows you to retrieve the list of existing order items with detailed items information.
+Notes: The list of attributes that will be returned for order items is configured in the Magento Admin Panel.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Response Example: XML
+ +| GET http://magentohost/api/rest/orders/410/items |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>43</item_id> + <parent_item_id></parent_item_id> + <sku>Sunglasses_1</sku> + <name>Sunglasses 1</name> + <qty_canceled>0.0000</qty_canceled> + <qty_invoiced>0.0000</qty_invoiced> + <qty_ordered>3.0000</qty_ordered> + <qty_refunded>0.0000</qty_refunded> + <qty_shipped>0.0000</qty_shipped> + <price>74.9137</price> + <base_price>106.0050</base_price> + <original_price>106.0050</original_price> + <base_original_price>150.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>26.2500</tax_amount> + <base_tax_amount>37.1400</base_tax_amount> + <discount_amount>212.0100</discount_amount> + <base_discount_amount>300.0000</base_discount_amount> + <row_total>318.0300</row_total> + <base_row_total>450.0000</base_row_total> + <price_incl_tax>114.7550</price_incl_tax> + <base_price_incl_tax>162.3800</base_price_incl_tax> + <row_total_incl_tax>344.2650</row_total_incl_tax> + <base_row_total_incl_tax>487.1400</base_row_total_incl_tax> + <status>Ordered</status> + </data_item> + <data_item> + <item_id>44</item_id> + <parent_item_id></parent_item_id> + <sku>test_simple_product</sku> + <name>test simple product</name> + <qty_canceled>0.0000</qty_canceled> + <qty_invoiced>0.0000</qty_invoiced> + <qty_ordered>10.0000</qty_ordered> + <qty_refunded>0.0000</qty_refunded> + <qty_shipped>0.0000</qty_shipped> + <price>249.7124</price> + <base_price>353.3500</base_price> + <original_price>353.3500</original_price> + <base_original_price>500.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>291.5000</tax_amount> + <base_tax_amount>412.5000</base_tax_amount> + <discount_amount>706.7000</discount_amount> + <base_discount_amount>1000.0000</base_discount_amount> + <row_total>3533.5000</row_total> + <base_row_total>5000.0000</base_row_total> + <price_incl_tax>382.5000</price_incl_tax> + <base_price_incl_tax>541.2500</base_price_incl_tax> + <row_total_incl_tax>3825.0000</row_total_incl_tax> + <base_row_total_incl_tax>5412.5000</base_row_total_incl_tax> + <status>Ordered</status> + </data_item> +</magento_api>+
Authentication: Customer
+Default Format: XML
+Parameters:
+No Parameters
Response Example: XML
+ +| GET http://magentohost/api/rest/orders/410/items |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>43</item_id> + <parent_item_id></parent_item_id> + <sku>Sunglasses_1</sku> + <name>Sunglasses 1</name> + <qty_canceled>0.0000</qty_canceled> + <qty_invoiced>0.0000</qty_invoiced> + <qty_ordered>3.0000</qty_ordered> + <qty_refunded>0.0000</qty_refunded> + <qty_shipped>0.0000</qty_shipped> + <price>74.9137</price> + <row_total>318.0300</row_total> + <price_incl_tax>114.7550</price_incl_tax> + <row_total_incl_tax>344.2650</row_total_incl_tax> + </data_item> + <data_item> + <item_id>44</item_id> + <parent_item_id></parent_item_id> + <sku>test_simple_product</sku> + <name>test simple product</name> + <qty_canceled>0.0000</qty_canceled> + <qty_invoiced>0.0000</qty_invoiced> + <qty_ordered>10.0000</qty_ordered> + <qty_refunded>0.0000</qty_refunded> + <qty_shipped>0.0000</qty_shipped> + <price>249.7124</price> + <row_total>3533.5000</row_total> + <price_incl_tax>382.5000</price_incl_tax> + <row_total_incl_tax>3825.0000</row_total_incl_tax> + </data_item> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ + + + diff --git a/guides/v1.8/api/rest/Resources/Orders/sales_orders.html b/guides/v1.8/api/rest/Resources/Orders/sales_orders.html new file mode 100644 index 0000000000..288bd3b416 --- /dev/null +++ b/guides/v1.8/api/rest/Resources/Orders/sales_orders.html @@ -0,0 +1,367 @@ +--- +layout: v1x_rest +title: Sales Orders +--- + + +Allows you to retrieve information on existing order/orders.
+ +URL Structure: http://magentohost/api/rest/orders
+Version: 1
Description: Allows you to retrieve the list of existing orders. Each order contains the following information: general order information, information on ordered items, order comments, and order addresses (both billing and shipping).
+The list of attributes that will be returned for the order is configured in the Magento Admin Panel.
Authentication: Admin, Customer, Guest
+Default Format: XML
Response Example: XML
+ +| GET http://magentohost/api/rest/orders |
<?xml version="1.0"?> +<magento_api> + <data_item_1> + <customer_id>3</customer_id> + <base_discount_amount>0.0000</base_discount_amount> + <base_shipping_amount>455.0000</base_shipping_amount> + <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> + <base_subtotal>13650.0000</base_subtotal> + <base_tax_amount>0.0000</base_tax_amount> + <base_total_paid></base_total_paid> + <base_total_refunded></base_total_refunded> + <tax_amount>0.0000</tax_amount> + <total_paid></total_paid> + <total_refunded></total_refunded> + <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> + <base_subtotal_incl_tax>13650.0000</base_subtotal_incl_tax> + <base_total_due>14105.0000</base_total_due> + <total_due>14105.0000</total_due> + <base_currency_code>USD</base_currency_code> + <tax_name></tax_name> + <tax_rate></tax_rate> + <addresses> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia, PA 19103</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia, PA 19103</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> + </addresses> + <order_items> + <data_item> + <sku>Sunglasses_1</sku> + <price>150.0000</price> + <base_price>150.0000</base_price> + <base_original_price>150.0000</base_original_price> + <tax_percent>0.0000</tax_percent> + <tax_amount>0.0000</tax_amount> + <base_tax_amount>0.0000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>13650.0000</base_row_total> + <base_price_incl_tax>150.0000</base_price_incl_tax> + <base_row_total_incl_tax>13650.0000</base_row_total_incl_tax> + </data_item> + </order_items> + </data_item_1> + <data_item_2> + <customer_id>3</customer_id> + <base_discount_amount>0.0000</base_discount_amount> + <base_shipping_amount>95.0000</base_shipping_amount> + <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> + <base_subtotal>3350.0000</base_subtotal> + <base_tax_amount>0.0000</base_tax_amount> + <base_total_paid>2445.0000</base_total_paid> + <base_total_refunded>1845.0000</base_total_refunded> + <tax_amount>0.0000</tax_amount> + <total_paid>2445.0000</total_paid> + <total_refunded>1845.0000</total_refunded> + <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> + <base_subtotal_incl_tax>3350.0000</base_subtotal_incl_tax> + <base_total_due>1000.0000</base_total_due> + <total_due>1000.0000</total_due> + <base_currency_code>USD</base_currency_code> + <tax_name></tax_name> + <tax_rate></tax_rate> + <addresses> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia, PA 19103</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia, PA 19103</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> + </addresses> + <order_items> + <data_item> + <sku>Sunglasses_1</sku> + <price>150.0000</price> + <base_price>150.0000</base_price> + <base_original_price>150.0000</base_original_price> + <tax_percent>0.0000</tax_percent> + <tax_amount>0.0000</tax_amount> + <base_tax_amount>0.0000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>1350.0000</base_row_total> + <base_price_incl_tax>150.0000</base_price_incl_tax> + <base_row_total_incl_tax>1350.0000</base_row_total_incl_tax> + </data_item> + <data_item> + <sku>Sun_glasses</sku> + <price>200.0000</price> + <base_price>200.0000</base_price> + <base_original_price>200.0000</base_original_price> + <tax_percent>0.0000</tax_percent> + <tax_amount>0.0000</tax_amount> + <base_tax_amount>0.0000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>2000.0000</base_row_total> + <base_price_incl_tax>200.0000</base_price_incl_tax> + <base_row_total_incl_tax>2000.0000</base_row_total_incl_tax> + </data_item> + </order_items> + </data_item_2> +</magento_api>+
Description: Not implemented.
+ + +Description: Not implemented.
+ + +Description: Not implemented.
+ +Allows you to retrieve information on a single order.
+The list of attributes that will be returned for the order is configured in the Magento Admin Panel.
URL Structure: http://magentohost/api/rest/orders/:id
+Version: 1
Description: Allows you to retrieve the order information.
+Authentication: Admin, Customer
+Default Format: XML
Response Example: XML
+ +| GET http://magentohost/api/rest/orders/32 |
<?xml version="1.0"?> +<magento_api> + <customer_id>3</customer_id> + <base_discount_amount>0.0000</base_discount_amount> + <base_shipping_amount>0.0000</base_shipping_amount> + <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> + <base_subtotal>5220.0000</base_subtotal> + <base_tax_amount>430.6500</base_tax_amount> + <base_total_paid></base_total_paid> + <base_total_refunded></base_total_refunded> + <tax_amount>304.3300</tax_amount> + <total_paid></total_paid> + <total_refunded></total_refunded> + <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> + <base_subtotal_incl_tax></base_subtotal_incl_tax> + <base_total_due></base_total_due> + <total_due></total_due> + <base_currency_code>USD</base_currency_code> + <tax_name>US-CA-*-Rate 1</tax_name> + <tax_rate>8.2500</tax_rate> + <addresses> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia +844 Jefferson Street; 4510 Willis Avenue</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + </data_item> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia +844 Jefferson Street; 4510 Willis Avenue</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + </data_item> + </addresses> + <order_items> + <data_item> + <sku>Sun_glasses</sku> + <price>141.3400</price> + <base_price>200.0000</base_price> + <base_original_price>200.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>11.6600</tax_amount> + <base_tax_amount>16.5000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>200.0000</base_row_total> + <base_price_incl_tax>216.5000</base_price_incl_tax> + <base_row_total_incl_tax>216.5000</base_row_total_incl_tax> + </data_item> + <data_item> + <sku>Virtual_product</sku> + <price>14.1340</price> + <base_price>20.0000</base_price> + <base_original_price>20.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>1.1700</tax_amount> + <base_tax_amount>1.6500</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>20.0000</base_row_total> + <base_price_incl_tax>21.6500</base_price_incl_tax> + <base_row_total_incl_tax>21.6500</base_row_total_incl_tax> + </data_item> + <data_item> + <sku>test_simple_product</sku> + <price>353.3500</price> + <base_price>500.0000</base_price> + <base_original_price>500.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>291.5000</tax_amount> + <base_tax_amount>412.5000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>5000.0000</base_row_total> + <base_price_incl_tax>541.2500</base_price_incl_tax> + <base_row_total_incl_tax>5412.5000</base_row_total_incl_tax> + </data_item> + </order_items> +</magento_api>+
Description: Not implemented.
+ + +Description: Not implemented.
+ + +Description: Not implemented.
+ + + + diff --git a/guides/v1.8/api/rest/Resources/Products/product_categories.html b/guides/v1.8/api/rest/Resources/Products/product_categories.html new file mode 100644 index 0000000000..9bec6c280f --- /dev/null +++ b/guides/v1.8/api/rest/Resources/Products/product_categories.html @@ -0,0 +1,155 @@ +--- +layout: v1x_rest +title: Product Categories +--- + + +Allows you to retrieve information about assigned categories, assign, and unassign a category from/to a product.
+ +URL Structure: http://magentohost/api/rest/products/productid/categories
+Version: 1
Description: Allows you to retrieve information about categories assigned to the specified product.
+ + +Authentication: Admin, Customer
+Default Format: JSON
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/categories |
Response Body:
+{
+ category_id: 8
+}
+ Description: Allows you to assign a category to a specified product.
+ + +Authentication: Admin
+Default Format: JSON
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| category_id | +The category ID | +required | +int | +2 | +
Example:
+ +| POST http://magentohost/api/rest/products/8/categories |
Request Body:
+{
+"category_id":"2"
+}
+ As a result, the category with ID equal to 2 will be assigned to the specified product.
+ + +Description: Allows you to unassign a category from a specified product.
+ + +Authentication: Admin
+Default Format: JSON
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/products/8/categories/2 |
| Status Code | +Message | +Description | +
|---|---|---|
| 400 | +Product <product ID> is already assigned to category <category ID> | +The message is returned when the required category is already assigned to the product | +
| 400 | +Category not found | +The specified category is not found | +
| 405 | +Resource method not implemented yet | +The specified method is not implemented yet | +
Allows you to manage images of the required product.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/images
+Version: 1
Description: Allows you to retrieve information about all images of a specified product.
+Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/images |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <id>5</id> + <label></label> + <position>1</position> + <exclude>0</exclude> + <url>http://magento/media/catalog/product/v/e/ve2011.jpg</url> + <types> + <data_item>image</data_item> + <data_item>thumbnail</data_item> + </types> + </data_item> + <data_item> + <id>7</id> + <label>second dress</label> + <position>2</position> + <exclude>1</exclude> + <url>http://magento/media/catalog/product/1/2/12.jpg</url> + <types> + <data_item>small_image</data_item> + </types> + </data_item> +</magento_api>+
Description: Allows you to add an image for the required product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| file_mime_type | +File mime type. Can have the following values: image/jpeg, image/png, etc. | +required | +string | +image/jpeg | +
| file_content | +Graphic image file content (base_64 encoded) | +required | +string | +iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg== | +
| file_name | +Name for the added image file | +optional | +string | +new image | +
Note: If the file_name parameter is not defined, the original file name is set for the image. The first created image will be called "image", the second created image will be called "image_2", etc.
+ +Example:
+ +| POST http://magentohost/api/rest/products/1/images |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <file_mime_type>image/jpeg</file_mime_type> <file_content>iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==</file_content> +</magento_api>+
Allows you to manage product images for a specified store.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/images/store/:store_id
+Version: 1
Description: Allows you to retrieve information about product images for a specified store view.
+Notes: Images can have different labels for different stores. For example, image label "flower" in the English store view can be set as "fleur" in the French store view. If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/images/store/2 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <id>6</id> + <label>white dress</label> + <position>1</position> + <exclude>0</exclude> + <url>http://magento/media/catalog/product/1/2/12.jpg</url> + <types> + <data_item>image</data_item> + <data_item>small_image</data_item> + <data_item>thumbnail</data_item> + </types> + </data_item> +</magento_api>+
Description: Allows you to add an image for the required product with image settings for a specific store.
+Notes: The image is added on the Global level; specified image parameters are set for a specific store.
Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| file_mime_type | +File mime type. Can have the following values: image/jpeg, image/png, etc. | +required | +string | +image/png | +
| file_content | +Graphic image file content (base_64 encoded) | +required | +string | +iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg== | +
| file_name | +Name for the added image file | +optional | +string | +test image | +
Note: If the file_name parameter is not defined, the original file name is set for the image. The first created image will be called "image", the second created image will be called "image_2", etc.
+ +Example:
+ +| POST http://magentohost/api/rest/products/8/images/store/3 |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <file_mime_type>image/jpeg</file_mime_type> <file_content>iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==</file_content> +</magento_api>+
Allows you to manage a specified product image.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/images/:image_id
+Version: 1
Description: Allows you to retrieve information about a specified product image.
+Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/images/7 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <id>7</id> + <label>second dress</label> + <position>2</position> + <exclude>1</exclude> + <url>http://magento/media/catalog/product/1/2/12.jpg</url> + <types> + <data_item>small_image</data_item> + </types> +</magento_api>+
Description: Allows you to update information for the specified product image.
+Notes: When updating information, you need to pass only those parameters that you want to be updated. Parameters that were not passed in the request, will preserve the previous values.
Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example | +
|---|---|---|---|---|
| exclude | +Defines whether the image will associate only to one of the three image types. | +optional | +int | +0 | +
| file_content | +Image file content (base_64 encoded). | +optional | +string | +base_64 encoded file content | +
| file_mime_type | +File mime type. Can have the following values: image/jpeg, image/png, etc. | +optional | +string | +image/png | +
| file_name | +Image file name. | +optional | +string | +test name | +
| label | +A label that will be displayed on the frontend when pointing to the image | +optional | +string | +test label | +
| position | +The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. | +optional | +int | +1 | +
| types | +Array of image types. Can have the following values: image, small_image, and thumbnail. | +optional | +array | +thumbnail | +
Example:
+ +| PUT http://magentohost/api/rest/products/8/images/7 |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <label>English store image</label> + <position>3</position> + <exclude>0</exclude> + <types> + <data_item>image</data_item> + <data_item>small_image</data_item> + <data_item>thumbnail</data_item> + </types> +</magento_api>+
Description: Allows you to remove the specified image from a product.
+Notes: The image will not be deleted physically, the image parameters will be set to No Image.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/products/14/images/6 |
Allows you to manage a specified product image for a specified store.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/images/:image_id/store/:store_id
+Version: 1
Description: Allows you to retrieve information about the specified product image from a specified store.
+Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/images/7/store/3 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <id>10</id> + <label></label> + <position>5</position> + <exclude>1</exclude> + <url>http://magento/media/catalog/product/n/e/new_image.gif</url> + <types/> +</magento_api>+
Description: Allows you to update the specified product image information for s specified store.
+Notes: When updating information, you need to pass only those parameters that you want to be updated. Parameters that were not passed in the request will preserve the previous values.
Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example | +
|---|---|---|---|---|
| exclude | +Defines whether the image will associate only to one of the three image types. | +optional | +int | +0 | +
| file_content | +Image file content (base_64 encoded). | +optional | +string | +base_64 encoded file content | +
| file_mime_type | +File mime type. Can have the following values: image/jpeg, image/png, etc. | +optional | +string | +image/png | +
| file_name | +Image file name. | +optional | +string | +test name | +
| label | +A label that will be displayed on the frontend when pointing to the image | +optional | +string | +test label | +
| position | +The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. | +optional | +int | +1 | +
| types | +Array of image types. Can have the following values: image, small_image, and thumbnail. | +optional | +array | +thumbnail | +
Example:
+ +| PUT http://magentohost/api/rest/products/8/images/7/store/3 |
Request Body:
+<?xml version="1.0"?> +<magento_api> +Â <position>3</position> +Â <exclude>0</exclude> +Â <types> +Â Â Â <data_item>image</data_item> +Â Â </types> +</magento_api>+
Description: Allows you to remove an image from the required product in the specified store.
+Notes: The image will not be deleted physically, the image parameters will be set to No Image for the current store.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/products/14/images/6/store/3 |
| Status Code | +Message | +Description | +
|---|---|---|
| 400 | + Requested store is invalid |
+The specified store is not valid or does not exist | +
| 404 | +Resource not found | +The specified resource is not found or does not exist | +
| 404 | +Product image not found | +The specified product image is not found or does not exist | +
| 400 | +Resource data pre-validator error | +Resource validation error | +
| 400 | + The image content must be valid base64 encoded data |
+The image file content must be in the base_64 encoded format (when image content does not contain supported letters and symbols) | +
| 400 | + Requested product does not support images |
+The specified product does not support images adding | +
| 400 | + Unsupported image MIME type |
+The image MIME type is not supported (e.g., image/bmp) | +
| 400 | + Resource unknown error |
+Resource unknown error | +
| 500 | + Resource internal error |
+Resource internal error | +
| - | + The image is not specified |
+The image is not specified during the POST request. | +
Allows you to retrieve information about websites assigned to a product, assign a website to a product, and copy data for a product from a specified store view.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/websites
+Version: 1
Description: Allows you to retrieve information about websites assigned to the specified product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/websites |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <website_id>2</website_id> + </data_item> +</magento_api>+
Description: Allows you to assign a website to a specified product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +The website ID | +required | +int | +2 | +
Example:
+ +| POST http://magentohost/api/rest/products/8/websites |
Request Body:
+<?xml version="1.0"?> +<magento_api> +Â Â <website_id>1</website_id> +</magento_api>+
Response Body:
+ +<?xml version="1.0"?> +<magento_api> + <success> + <data_item> + <website_id>1</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + </success> +</magento_api>+
+
Description: Allows you to assign a website and copy product data from the attached store to the one being attached. Only product data that is set on the Store View level is copied. All other data set on the Website or Global levels is not copied.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +The website ID | +required | +int | +2 | +
| store_from | +The store ID from which data will be copied | +required | +int | +1 | +
| store_to | +The store ID to which data will be copied | +required | +int | +2 | +
Notes: The store_to parameter must belong to the website which we want to assign to a product.
+ +Example:
+ +| POST http://magentohost/api/rest/products/8/websites |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <website_id>2</website_id> + <copy_to_stores> + <data_item> + <store_from>1</store_from> + <store_to>2</store_to> + </data_item> + </copy_to_stores> +</magento_api>+
+
Description: Allows you to assign multiple websites to a product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +The website ID | +required | +int | +2 | +
Example:
+ +| POST http://magentohost/api/rest/products/8/websites |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <website_id>1</website_id> + </data_item> + <data_item> + <website_id>3</website_id> + </data_item> +</magento_api>+
Response Body:
+ +<?xml version="1.0"?> +<magento_api> + <success> + <data_item> + <website_id>1</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + <data_item> + <website_id>3</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + </success> +</magento_api>+
+
Description: Allows you to assign multiple websites to a product together with copying product data from the attached store to the one being attached. Only product data that is set on the Store View level is copied. All other data set on the Website or Global levels is not copied.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +The website ID | +required | +int | +2 | +
| store_from | +The store ID from which data will be copied | +required | +int | +1 | +
| store_to | +The store ID to which data will be copied | +required | +int | +2 | +
Example:
+ +| POST http://magentohost/api/rest/products/8/websites |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <website_id>2</website_id> + <copy_to_stores> + <data_item> + <store_from>1</store_from> + <store_to>2</store_to> + </data_item> + </copy_to_stores> + </data_item> + <data_item> + <website_id>3</website_id> + <copy_to_stores> + <data_item> + <store_from>1</store_from> + <store_to>5</store_to> + </data_item> + </copy_to_stores> + </data_item> +</magento_api>+
Response Body:
+ +<?xml version="1.0"?> +<magento_api> + <success> + <data_item> + <website_id>2</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + <data_item> + <website_id>3</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + </success> +</magento_api>+
+
Allows you to unassign a website from a specified product.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/websites/:website_id
+Version: 1
Description: Allows you to unassign a website from a specified product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/products/8/websites/1 |
| Status Code | +Message | +Description | +
|---|---|---|
| 404 | +Product not found | +The specified product is not found or does not exist. | +
| 404 | +Website not found | +The specified website is not found or does not exist. | +
| 400 | +Invalid value for "store_from" for the website with ID <ID value>. | +The entered value for "store_from" is not valid. | +
| 400 | + Invalid value for "store_to" for the website with ID <ID value>. |
+The entered value for "store_to" is not valid. | +
| 400 | +Store not found <store ID> for website <website ID>. | +The specified store is not found or does not exist. | +
| 400 | +Store <store ID> from which we will copy the information does not belong to the product <product ID> being edited. | +The specified store is not assigned to the product. | +
| 400 | +Store <store ID> to which we will copy the information does not belong to the website <website ID> being added. | +The specified store does not belong to the website. | +
| 400 | +Product <product ID> isn't assigned to website <website ID>. | +The specified product is not assigned to the website. | +
| 400 | +Invalid value for "website_id" in request. | +The value for "website_id" is not valid. | +
Allows you to retrieve the list of all products with detailed information.
+ +URL Structure: http://magentohost/api/rest/products
+Version: 1
Description: Allows you to retrieve the list of all products with detailed information.
+Notes: The list of attributes that will be returned in the response is configured in the Magento Admin Panel. The list of attributes differs for each type of user.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
| GET http://magentohost/api/rest/products |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>1</entity_id> + <type_id>simple</type_id> + <sku>dress_test</sku> + <status>1</status> + <visibility>4</visibility> + <tax_class_id>2</tax_class_id> + <weight>1.0000</weight> + <price>1500.0000</price> + <special_price>1000.0000</special_price> + <name>Wedding dress</name> + <url_key>dress</url_key> + <country_of_manufacture>AO</country_of_manufacture> + <msrp_display_actual_price_type>2</msrp_display_actual_price_type> + <gift_message_available>1</gift_message_available> + <news_from_date>2012-03-21 00:00:00</news_from_date> + <news_to_date>2012-03-24 00:00:00</news_to_date> + <special_from_date>2012-03-21 00:00:00</special_from_date> + <special_to_date>2012-03-24 00:00:00</special_to_date> + <description>White wedding dress</description> + </data_item> + <data_item> + <entity_id>2</entity_id> + <type_id>simple</type_id> + <sku>black_sunglasses</sku> + <status>1</status> + <visibility>4</visibility> + <tax_class_id>2</tax_class_id> + <weight>0.2000</weight> + <price>500.0000</price> + <special_price>300.0000</special_price> + <name>Sunglasses</name> + <url_key>sunglasses</url_key> + <country_of_manufacture>AR</country_of_manufacture> + <msrp_display_actual_price_type>2</msrp_display_actual_price_type> + <gift_message_available></gift_message_available> + <news_from_date></news_from_date> + <news_to_date></news_to_date> + <special_from_date>2012-03-21 00:00:00</special_from_date> + <special_to_date>2012-03-24 00:00:00</special_to_date> + <description>Black sunglasses</description> + </data_item> +</magento_api>+
Response Example: JSON
+ +{"1":{"entity_id":"1","type_id":"simple","sku":"dress_test","status":"1","visibility":"4","tax_class_id":"2","weight":"1.0000","price":"1500.0000","special_price":"1000.0000","name":"Wedding dress","url_key":"dress","country_of_manufacture":"AO","msrp_display_actual_price_type":"2","gift_message_available":"1","news_from_date":"2012-03-21 00:00:00","news_to_date":"2012-03-24 00:00:00","special_from_date":"2012-03-21 00:00:00","special_to_date":"2012-03-24 00:00:00","description":"White wedding dress"},"2":{"entity_id":"2","type_id":"simple","sku":"black_sunglasses","status":"1","visibility":"4","tax_class_id":"2","weight":"0.2000","price":"500.0000","special_price":"300.0000","name":"Sunglasses","url_key":"sunglasses","country_of_manufacture":"AR","msrp_display_actual_price_type":"2","gift_message_available":null,"news_from_date":null,"news_to_date":null,"special_from_date":"2012-03-21 00:00:00","special_to_date":"2012-03-24 00:00:00","description":"Black sunglasses"}}
+ Authentication: Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
| GET http://magentohost/api/rest/products |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>1</entity_id> + <type_id>simple</type_id> + <sku>dress_test</sku> + <description>White wedding dress</description> + <short_description>dress</short_description> + <meta_keyword>white, dress</meta_keyword> + <name>Wedding dress</name> + <meta_title>dress</meta_title> + <meta_description>A nice wedding dress</meta_description> + <regular_price_with_tax>1500</regular_price_with_tax> + <regular_price_without_tax>1500</regular_price_without_tax> + <final_price_with_tax>1000</final_price_with_tax> + <final_price_without_tax>1000</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magentohost/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/1/2/wedding_dress.jpg</image_url> + </data_item> + <data_item> + <entity_id>2</entity_id> + <type_id>simple</type_id> + <sku>black_sunglasses</sku> + <description>Black sunglasses</description> + <short_description>Black sunglasses</short_description> + <meta_keyword>sunglasses, black</meta_keyword> + <name>Sunglasses</name> + <meta_title>sunglasses</meta_title> + <meta_description>black sunglasses</meta_description> + <regular_price_with_tax>500</regular_price_with_tax> + <regular_price_without_tax>500</regular_price_without_tax> + <final_price_with_tax>300</final_price_with_tax> + <final_price_without_tax>300</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magentohost/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/a/l/sunglasses-1.jpg</image_url> + </data_item> +</magento_api>+
Response Example: JSON
+ +{"1":{"entity_id":"1","type_id":"simple","sku":"dress_test","description":"White wedding dress","short_description":"dress","meta_keyword":"white, dress","name":"Wedding dress","meta_title":"dress","meta_description":"A nice wedding dress","regular_price_with_tax":1500,"regular_price_without_tax":1500,"final_price_with_tax":1000,"final_price_without_tax":1000,"is_saleable":"1","image_url":"http:\/\/magentohost\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/1\/2\/wedding_dress.jpg"},"2":{"entity_id":"2","type_id":"simple","sku":"black_sunglasses","description":"Black sunglasses","short_description":"Black sunglasses","meta_keyword":"sunglasses, black","name":"Sunglasses","meta_title":"sunglasses","meta_description":"black sunglasses","regular_price_with_tax":500,"regular_price_without_tax":500,"final_price_with_tax":300,"final_price_without_tax":300,"is_saleable":"1","image_url":"http:\/\/magentohost\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/a\/l\/sunglasses-1.jpg"}}
+ Description: Allows you to retrieve the list of products of a specified category. These products will be returned in the product position ascending order.
+ +In the following example, product with ID=4 has position equal to 7 and the product with ID=3 has position equal to 1. The list of products, therefore, is sorted by the product position in the category.
+ +| GET http://magentohost/api/rest/products?category_id=5 |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>4</entity_id> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <tax_class_id>2</tax_class_id> + <weight>1.0000</weight> + <price>329.9900</price> + </data_item> + <data_item> + <entity_id>3</entity_id> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <tax_class_id>2</tax_class_id> + <weight>1.0000</weight> + <price>550.0000</price> + </data_item> +</magento_api>+
Description: Allows you to create a new simple product.
+ +Authentication: Admin
+Default Format: JSON
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| type_id | +Product type. Can have the "simple" value. | +required | +string | +simple | +
| attribute_set_id | +Attribute set for the product. | +required | +int | +4 | +
| sku | +Product SKU | +required | +string | +new_product | +
| name | +Product name | + required |
+string | +New product | +
| meta_title | +Product meta title | +optional | +string | +new product | +
| meta_description |
+Product meta description | +optional | +string | +This is a new product | +
| url_key |
+A friendly URL path for the product | +optional | +string | +new-product | +
| custom_design |
+Custom design applied for the product page | +optional | +string | +enterprise/default | +
| page_layout |
+Page template that can be applied to the product page | +optional | +string | +one_column | +
| options_container |
+Defines how the custom options for the product will be displayed. Can have the following values: Block after Info Column or Product Info Column | +optional | +string | +container2 | +
| country_of_manufacture |
+Product country of manufacture | +optional | +string | +AD | +
| msrp_enabled |
+The Apply MAP option. Defines whether the price in the catalog in the frontend is substituted with a Click for price link | +optional | +int | +1 | +
| msrp_display_actual_price_type |
+Defines how the price will be displayed in the frontend. Can have the following values: In Cart, Before Order Confirmation, and On Gesture | +optional | +int | +2 | +
| gift_message_available |
+Defines whether the gift message is available for the product | +optional | +int | +1 | +
| price | +Product price | + required |
+string | +2000 | +
| special_price |
+Product special price | +optional | +string | +150 | +
| weight | +Product weight | + required |
+string | +0.5 | +
| msrp |
+The Manufacturer's Suggested Retail Price option. The price that a manufacturer suggests to sell the product at | +optional | +string | +140 | +
| status | +Product status. Can have the following values: 1- Enabled, 2 - Disabled. | + required |
+int | +1 | +
| visibility | +Product visibility. Can have the following values: 1 - Not Visible Individually, 2 - Catalog, 3 - Search, 4 - Catalog, Search. | + required |
+int | +4 | +
| enable_googlecheckout |
+Defines whether the product can be purchased with the help of the Google Checkout payment service. Can have the following values: Yes and No | +optional | +int | +1 | +
| tax_class_id | +Product tax class. Can have the following values: 0 - None, 2 - taxable Goods, 4 - Shipping, etc., depending on created tax classes. | + required |
+int | +7 | +
| description | +Product description. | + required |
+string | +This is a new product. | +
| short_description | +Product short description. | + required |
+string | +A new product. | +
| meta_keyword |
+Product meta keywords | +optional | +string | +new | +
| custom_layout_update |
+An XML block to alter the page layout | +optional | +string | +XML body | +
| special_from_date |
+Date starting from which the special price will be applied to the product | +optional | +string | +2012-03-15 00:00:00 | +
| special_to_date |
+Date till which the special price will be applied to the product | +optional | +string | +2012-03-15 00:00:00 | +
| news_from_date |
+Date starting from which the product is promoted as a new product | +optional | +string | +2012-03-15 00:00:00 | +
| news_to_date |
+Date till which the product is promoted as a new product | +optional | +string | +2012-03-15 00:00:00 | +
| custom_design_from |
+Date starting from which the custom design will be applied to the product page | +optional | +string | +2012-03-15 00:00:00 | +
| custom_design_to |
+Date till which the custom design will be applied to the product page | +optional | +string | +2012-03-15 00:00:00 | +
| group_price |
+Product group price | +optional | +array | +array of group price | +
| tier_price |
+Product tier price | +optional | +array | +array of tier price | +
| stock_data |
+Product inventory data | +optional | +array | +array of stock data | +
Array of Group Price attributes is as follows:
+ +| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +Website ID | +optional | +int | +0 | +
| cust_group | +Customer group | +optional | +int | +1 | +
| price |
+Group price | +optional | +string | +140 | +
Array of Tier Price attributes is as follows:
+ +| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +Website ID | +optional | +int | +0 | +
| cust_group | +Customer group | +optional | +int | +1 | +
| price | +Tier price | +optional | +string | +140 | +
| price_qty | +Price quantity | +optional | +string | +10 | +
Array of Stock Data attributes is as follows:
+ +| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| qty | +Quantity of stock items for the current product | +optional | +string | +99 | +
| min_qty | +Quantity for stock items to become out of stock | +optional | +string | +5 | +
| use_config_min_qty | +Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock option | +optional | +int | +1 | +
| is_qty_decimal | +Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) | +optional | +int | +1 | +
| backorders |
+ Defines whether the customer can place the order for products that are out of stock at the moment. |
+ optional |
+int | +0 | +
| use_config_backorders |
+Choose whether the Config settings will be applied for the Backorders option | + optional |
+int | +1 | +
| min_sale_qty |
+ Minimum number of items in the shopping cart to be sold |
+ optional |
+string | +10 | +
| use_config_min_sale_qty |
+Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option | + optional |
+int | +1 | +
| max_sale_qty |
+ Maximum number of items in the shopping cart to be sold |
+ optional |
+string | +50 | +
| use_config_max_sale_qty |
+Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option | + optional |
+int | +1 | +
| is_in_stock |
+Defines whether the product is available for selling. | + optional |
+int | +1 | +
| notify_stock_qty |
+The number of inventory items below which the customer will be notified | + optional |
+string | +5 | +
| use_config_notify_stock_qty |
+Choose whether the Config settings will be applied for the Notify for Quantity Below option | + optional |
+int | +1 | +
| manage_stock |
+Choose whether to view and specify the product quantity and availability and whether the product is in stock management. | + optional |
+int | +1 | +
| use_config_manage_stock |
+Choose whether the Config settings will be applied for the Manage Stock option | + optional |
+int | +1 | +
| use_config_qty_increments |
+Choose whether the Config settings will be applied for the Qty Increments option | + optional |
+int | +1 | +
| qty_increments |
+The product quantity increment value | + optional |
+string | +3 | +
| use_config_enable_qty_inc |
+Choose whether the Config settings will be applied for the Enable Qty Increments option | + optional |
+int | +1 | +
| enable_qty_increments |
+Defines whether the customer can add products only in increments to the shopping cart | + optional |
+int | +0 | +
| is_decimal_divided |
+Defines whether the stock items can be divided into multiple boxes for shipping | + optional |
+int | +0 | +
| POST http://magentohost/api/rest/products |
Request Example: JSON
+ +{
+ "custom_design" : "default/blank",
+ "custom_design_from" : "02/16/2012",
+ "custom_design_to" : "05/01/2012",
+ "description" : "Test description",
+ "gift_message_available" : 1,
+ "meta_description" : "Test meta",
+ "meta_keyword" : "Test keyword",
+ "meta_title" : "Test title",
+ "msrp" : 11.015000000000001,
+ "msrp_display_actual_price_type" : 1,
+ "msrp_enabled" : 1,
+ "name" : "Test",
+ "news_from_date" : "02/16/2012",
+ "news_to_date" : "16.02.2012",
+ "options_container" : "container1",
+ "page_layout" : "one_column",
+ "price" : 25.5,
+ "attribute_set_id" : "4",
+ "short_description" : "Test short description",
+ "sku" : "simple4f5490f31959f",
+ "special_from_date" : "02/16/2012",
+ "special_price" : 11.199999999999999,
+ "special_to_date" : "03/17/2012",
+ "status" : 1,
+ "stock_data" : { "backorders" : 1,
+ "enable_qty_increments" : 0,
+ "is_in_stock" : 0,
+ "is_qty_decimal" : 0,
+ "manage_stock" : 1,
+ "max_sale_qty" : 1,
+ "min_qty" : 1.5600000000000001,
+ "min_sale_qty" : 1,
+ "notify_stock_qty" : -50.990000000000002,
+ "qty" : 1,
+ "use_config_manage_stock" : 1,
+ "use_config_min_qty" : 1,
+ "use_config_min_sale_qty": 1,
+ "use_config_max_sale_qty" : 1,
+ "use_config_backorders": 1,
+ "use_config_enable_qty_inc":1,
+ "use_config_notify_stock_qty":1 },
+ "tax_class_id" : "2",
+ "type_id" : "simple",
+ "use_config_gift_message_available" : 0,
+ "visibility" : "4",
+ "weight" : 125
+}
+ Request Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <sku>test_dress</sku> + <name>Test_dress</name> + <country_of_manufacture>AD</country_of_manufacture> + <price>2000.0000</price> + <special_price>1500.0000</special_price> + <weight>0.5000</weight> + <status>1</status> + <visibility>4</visibility> + <tax_class_id>7</tax_class_id> + <description>dress</description> + <short_description>Wedding dress</short_description> +</magento_api>+
Allows you to retrieve, update, and delete a specified product in Magento.
+ +URL Structure: http://magentohost/api/rest/products/:id
+Version: 1
Description: Allows you to retrieve information on a required simple product.
+Notes: The list of attributes that will be returned in the response is configured in the Magento Admin Panel. The list of attributes differs for each type of user.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
| GET http://magentohost/api/rest/products/8 |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <entity_id>8</entity_id> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <sku>dress</sku> + <name>Dress</name> + <url_key>my-new-dress</url_key> + <country_of_manufacture>AD</country_of_manufacture> + <msrp_display_actual_price_type>2</msrp_display_actual_price_type> + <gift_message_available>1</gift_message_available> + <price>2000.0000</price> + <weight>0.5000</weight> + <status>1</status> + <visibility>4</visibility> + <tax_class_id>7</tax_class_id> + <description>dress</description> + <group_price> + <data_item> + <website_id>0</website_id> + <cust_group>1</cust_group> + <price>1400.0000</price> + </data_item> + </group_price> + <tier_price> + <data_item> + <website_id>0</website_id> + <cust_group>1</cust_group> + <price>1300.0000</price> + <price_qty>1.0000</price_qty> + </data_item> + </tier_price> + <stock_data> + <qty>50.0000</qty> + <min_qty>0.0000</min_qty> + <use_config_min_qty>1</use_config_min_qty> + <is_qty_decimal>0</is_qty_decimal> + <backorders>0</backorders> + <use_config_backorders>1</use_config_backorders> + <min_sale_qty>1.0000</min_sale_qty> + <use_config_min_sale_qty>1</use_config_min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <use_config_max_sale_qty>1</use_config_max_sale_qty> + <is_in_stock>1</is_in_stock> + <notify_stock_qty></notify_stock_qty> + <use_config_notify_stock_qty>1</use_config_notify_stock_qty> + <manage_stock>0</manage_stock> + <use_config_manage_stock>1</use_config_manage_stock> + <use_config_qty_increments>1</use_config_qty_increments> + <qty_increments>0.0000</qty_increments> + <use_config_enable_qty_inc>1</use_config_enable_qty_inc> + <enable_qty_increments>0</enable_qty_increments> + <is_decimal_divided>0</is_decimal_divided> + <use_config_enable_qty_increments>1</use_config_enable_qty_increments> + </stock_data> +</magento_api>+
Response Example: JSON
+ +{"entity_id":"8","attribute_set_id":"4","type_id":"simple","sku":"dress","name":"Dress","url_key":"my-new-dress","country_of_manufacture":"AD","msrp_display_actual_price_type":"2","gift_message_available":"1","price":"2000.0000","weight":"0.5000","status":"1","visibility":"4","tax_class_id":"7","description":"dress","group_price":[{"website_id":"0","cust_group":"1","price":"1400.0000"}],"tier_price":[{"website_id":"0","cust_group":"1","price":"1300.0000","price_qty":"1.0000"}],"stock_data":{"qty":"50.0000","min_qty":"0.0000","use_config_min_qty":"1","is_qty_decimal":"0","backorders":"0","use_config_backorders":"1","min_sale_qty":"1.0000","use_config_min_sale_qty":"1","max_sale_qty":"0.0000","use_config_max_sale_qty":"1","is_in_stock":"1","notify_stock_qty":null,"use_config_notify_stock_qty":"1","manage_stock":"0","use_config_manage_stock":"1","use_config_qty_increments":"1","qty_increments":"0.0000","use_config_enable_qty_inc":"1","enable_qty_increments":"0","is_decimal_divided":"0","use_config_enable_qty_increments":"1"}}
+ Authentication: Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
| GET http://magentohost/api/rest/products/8 |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <entity_id>1</entity_id> + <type_id>simple</type_id> + <sku>dress_test</sku> + <name>Wedding dress</name> + <meta_title>dress</meta_title> + <meta_description>A nice wedding dress</meta_description> + <description>White wedding dress</description> + <short_description>dress</short_description> + <meta_keyword>white, dress</meta_keyword> + <tier_price/> + <is_in_stock>1</is_in_stock> + <regular_price_with_tax>1500</regular_price_with_tax> + <regular_price_without_tax>1500</regular_price_without_tax> + <final_price_with_tax>1000</final_price_with_tax> + <final_price_without_tax>1000</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magento/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/1/2/wedding_dress.jpg</image_url> + <url>http://magento/index.php/catalog/product/view/id/1/s/dress/</url> + <buy_now_url>http://magento/index.php/checkout/cart/add/uenc/aHR0cDovLzEyNy4wLjAuMS9Tb3VyY2VzL2FwaS9yZXN0L3Byb2R1Y3RzLzE,/product/1/</buy_now_url> + <total_reviews_count>0</total_reviews_count> + <has_custom_options></has_custom_options> +</magento_api>+
Response Example: JSON
+ +{"entity_id":"1","type_id":"simple","sku":"dress_test","name":"Wedding dress","meta_title":"dress","meta_description":"A nice wedding dress","description":"White wedding dress","short_description":"dress","meta_keyword":"white, dress","tier_price":[],"is_in_stock":"1","regular_price_with_tax":1500,"regular_price_without_tax":1500,"final_price_with_tax":1000,"final_price_without_tax":1000,"is_saleable":"1","image_url":"http:\/\/magento\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/1\/2\/wedding_dress.jpg","url":"http:\/\/magento\/index.php\/catalog\/product\/view\/id\/1\/s\/dress\/","buy_now_url":"http:\/\/magento\/index.php\/checkout\/cart\/add\/uenc\/aHR0cDovLzEyNy4wLjAuMS9Tb3VyY2VzL2FwaS9yZXN0L3Byb2R1Y3RzLzE,\/product\/1\/","total_reviews_count":"0","has_custom_options":false}
+ Description: Allows you to update an existing product.
+ + +Authentication: Admin
+Default Format: JSON
+Parameters:
+Enter only those parameters which you want to update.
| PUT http://magentohost/api/rest/products/8 +PUT for specific store http://magentohost/api/rest/products/8/store/3 |
Request Example: JSON
+ +{
+"attribute_set_id":"4",
+"type_id":"simple",
+"sku":"wedding dress",
+"name":"Dress_test",
+"meta_title":"dress",
+"meta_description":"a wedding dress",
+"price":"2000.0000",
+"weight":"0.5000",
+"status":"1",
+"visibility":"4",
+"enable_googlecheckout":"1",
+"tax_class_id":"7",
+"description":"dress",
+"meta_keyword":"dress, wedding"
+}
+ Request Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <sku>wedding dress</sku> + <name>Dress_test</name> + <meta_title>dress</meta_title> + <price>2000.0000</price> + <weight>0.5000</weight> + <status>1</status> + <visibility>4</visibility> + <enable_googlecheckout>1</enable_googlecheckout> + <tax_class_id>7</tax_class_id> + <description>dress</description> + <meta_keyword>dress, wedding</meta_keyword> +</magento_api>+
Description: Allows you to delete an existing product.
+ + +Authentication: Admin
+Default Format: JSON
+Parameters: no parameters
+Request Example:
| DELETE http://magentohost/api/rest/products/1 |
| Status Code | +Message | +Description | +
|---|---|---|
| 404 | +Resource not found. | +The required resource is not found. | +
| 405 | +Resource method not implemented yet. | +The required method is not implemented yet. | +
| 405 | +Resource does not support method. | +The current resource does not support the specified method. | +
Some requests use GET parameters in the URL. These are as follows:
+ +If the attribute value consists of several words separated by a whitespace, the '%20' sign is used:
+ + + +For example, to filter products with the description equal to simple01:
+ + + + + diff --git a/guides/v1.8/api/rest/Resources/inventory.html b/guides/v1.8/api/rest/Resources/inventory.html new file mode 100644 index 0000000000..d3804c96c1 --- /dev/null +++ b/guides/v1.8/api/rest/Resources/inventory.html @@ -0,0 +1,626 @@ +--- +layout: v1x_rest +title: Inventory +--- + + +Allows you to manage existing stock items. Inventory management is available only for Admin.
+ +URL Structure: http://magentohost/api/rest/stockitems
Version: 1
Description: Allows you to retrieve the list of existing stock items.
+ Notes: The list of attributes that will be returned for stock items is configured in the Magento Admin Panel.
+
Authentication: Admin
+ Default Format: JSON
+ Parameters :
+ No Parameters
Response Example: XML
+ +| GET http://magentohost/api/rest/stockitems | +
<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>1</item_id> + <qty>100.0000</qty> + <backorders>0</backorders> + <min_sale_qty>1.0000</min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <low_stock_date></low_stock_date> + <manage_stock>0</manage_stock> + <stock_status_changed_auto>0</stock_status_changed_auto> + <enable_qty_increments>0</enable_qty_increments> + </data_item> + <data_item> + <item_id>2</item_id> + <qty>100.0000</qty> + <backorders>0</backorders> + <min_sale_qty>1.0000</min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <low_stock_date></low_stock_date> + <manage_stock>0</manage_stock> + <stock_status_changed_auto>0</stock_status_changed_auto> + <enable_qty_increments>0</enable_qty_increments> + </data_item> + <data_item> + <item_id>3</item_id> + <qty>1.0000</qty> + <backorders>0</backorders> + <min_sale_qty>1.0000</min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <low_stock_date></low_stock_date> + <manage_stock>0</manage_stock> + <stock_status_changed_auto>0</stock_status_changed_auto> + <enable_qty_increments>0</enable_qty_increments> + </data_item> + <data_item> + <item_id>4</item_id> + <qty>0.0000</qty> + <backorders>0</backorders> + <min_sale_qty>1.0000</min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <low_stock_date></low_stock_date> + <manage_stock>0</manage_stock> + <stock_status_changed_auto>1</stock_status_changed_auto> + <enable_qty_increments>0</enable_qty_increments> + </data_item> +</magento_api>+
Response Example: JSON
+ +| GET http://magentohost/api/rest/stockitems | +
[{"item_id":"1","qty":"100.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"2","qty":"100.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"3","qty":"1.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"4","qty":"0.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"1","enable_qty_increments":"0"}]
+ Description: Allows you to update existing stock items.
+ + +Authentication: Admin
+ Default Format: JSON
Notes: The Content-Type: text/xml parameter must be added to the request header.
+ +Parameters:
+ +| Name | +Description | +Type | +Example Value | +
|---|---|---|---|
| item_id | +Item ID | +int | +1 | +
| product_id | +Product ID | +int | +1 | +
| stock_id | +Stock ID | +int | +1 | +
| qty | +Quantity of stock items for the current product | +string | +20 | +
| min_qty | +Quantity for stock items to become out of stock | +string | +0 | +
| use_config_min_qty | +Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock + option + | +int | +1 | +
| is_qty_decimal | +Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) | +int | +0 | +
| backorders | +The customer can place the order for products that are out of stock at the moment (0 - No Backorders, 1 - + Allow Qty Below 0, and 2 - Allow Qty Below 0 and Notify Customer) + | +int | +0 | +
| use_config_backorders | +Choose whether the Config settings will be applied for the Backorders option | +int | +1 | +
| min_sale_qty | +Minimum number of items in the shopping cart to be sold | +string | +10 | +
| use_config_min_sale_qty | +Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option | +int | +0 | +
| max_sale_qty | +Maximum number of items in the shopping cart to be sold | +string | +100 | +
| use_config_max_sale_qty | +Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option | +int | +0 | +
| is_in_stock | +Defines whether the product is available for selling (0 - Out of Stock, 1 - In Stock) | +int | +1 | +
| low_stock_date | +Date when the number of stock items became lower than the number defined in the Notify for Quantity Below + option + | +string | +2012-02-24 12:37:51 | +
| notify_stock_qty | +The number of inventory items below which the customer will be notified via the RSS feed | +string | +10 | +
| use_config_notify_stock_qty | +Choose whether the Config settings will be applied for the Notify for Quantity Below option | +int | +0 | +
| manage_stock | +Choose whether to view and specify the product quantity and availability and whether the product is in + stock management( 0 - No, 1 - Yes) + | +int | +0 | +
| use_config_manage_stock | +Choose whether the Config settings will be applied for the Manage Stock option | +int | +1 | +
| stock_status_changed_auto | +Defines whether products can be automatically returned to stock when the refund for an order is created + | +int | +0 | +
| use_config_qty_increments | +Choose whether the Config settings will be applied for the Enable Qty Increments option | +int | +1 | +
| qty_increments | +The product quantity increment value | +string | +5 | +
| use_config_enable_qty_inc | +Choose whether the Config settings will be applied for the Qty Increments option | +int | +1 | +
| enable_qty_increments | +Defines whether the customer can add products only in increments to the shopping cart | +int | +0 | +
| is_decimal_divided | +Defines whether the stock items can be divided into multiple boxes for shipping. | +int | +0 | +
Example: XML
+ +| PUT http://magentohost/api/rest/stockitems | +
Request Body:
+<?xml version="1.0"?> +<magento_api> + <data_item item_id="157"> + <product_id>262</product_id> + <stock_id>1</stock_id> + <qty>100.0000</qty> + <min_qty>0.0000</min_qty> + </data_item> + <data_item item_id="158"> + <product_id>263</product_id> + <stock_id>1</stock_id> + <qty>100.0000</qty> + <min_qty>0.0000</min_qty> + </data_item> + <data_item item_id="159"> + <product_id>264</product_id> + <stock_id>1</stock_id> + <qty>120.0000</qty> + <min_qty>0.0000</min_qty> + </data_item> + <data_item item_id="153"> + <product_id> </product_id> + <qty>110.0000</qty> + <min_qty>0.0000</min_qty> + </data_item> +</magento_api>+
Response Body:
+<?xml version="1.0"?> +<magento_api> + <success> + <data_item> + <message>Resource updated successful.</message> + <code>200</code> + <item_id>157</item_id> + </data_item> + </success> + <error> + <data_item> + <message>Resource not found.</message> + <code>404</code> + <item_id>158</item_id> + </data_item> + <data_item> + <message>Resource not found.</message> + <code>404</code> + <item_id>159</item_id> + </data_item> + <data_item> + <message>Empty value for "product_id" in request.</message> + <code>400</code> + <item_id>153</item_id> + </data_item> + </error> +</magento_api>+
Allows you to update, delete, or retrieve information on a single stock item.
+ Notes: The list of attributes that will be returned for stock items is configured in the Magento Admin Panel.
+
URL Structure: http://magentohost/api/rest/stockitems/:id
+ Version: 1
Description: Allows you to retrieve the stock item information.
+ Authentication: Admin
+ Default Format: JSON
Response Example: XML
+ +| GET http://magentohost/api/rest/stockitems/1 | +
Response Body:
+<?xml version="1.0"?> +<magento_api> + <item_id>1</item_id> + <product_id>1</product_id> + <stock_id>1</stock_id> + <qty>200.0000</qty> + <min_qty>0.0000</min_qty> + <use_config_min_qty>1</use_config_min_qty> + <is_qty_decimal>1</is_qty_decimal> + <backorders>0</backorders> + <use_config_backorders>1</use_config_backorders> + <min_sale_qty>1.0000</min_sale_qty> + <use_config_min_sale_qty>1</use_config_min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <use_config_max_sale_qty>1</use_config_max_sale_qty> + <is_in_stock>1</is_in_stock> + <low_stock_date></low_stock_date> + <notify_stock_qty>10.0000</notify_stock_qty> + <use_config_notify_stock_qty>0</use_config_notify_stock_qty> + <manage_stock>0</manage_stock> + <use_config_manage_stock>1</use_config_manage_stock> + <stock_status_changed_auto>0</stock_status_changed_auto> + <use_config_qty_increments>1</use_config_qty_increments> + <qty_increments>0.0000</qty_increments> + <use_config_enable_qty_inc>1</use_config_enable_qty_inc> + <enable_qty_increments>0</enable_qty_increments> + <is_decimal_divided>1</is_decimal_divided> +</magento_api>+
Response Example: JSON
+ +| GET http://magentohost/api/rest/stockitems/157 + | +
Response Body:
+{"item_id":"1","product_id":"1","stock_id":"1","qty":"200.0000","min_qty":"0.0000","use_config_min_qty":"1","is_qty_decimal":"1","backorders":"0","use_config_backorders":"1","min_sale_qty":"1.0000","use_config_min_sale_qty":"1","max_sale_qty":"0.0000","use_config_max_sale_qty":"1","is_in_stock":"1","low_stock_date":null,"notify_stock_qty":"10.0000","use_config_notify_stock_qty":"0","manage_stock":"0","use_config_manage_stock":"1","stock_status_changed_auto":"0","use_config_qty_increments":"1","qty_increments":"0.0000","use_config_enable_qty_inc":"1","enable_qty_increments":"0","is_decimal_divided":"1"}
+ Description: Allows you to update existing stock item data.
+ Notes: The Content-Type: text/xml parameter must be added to the request header.
+ Authentication: Admin
+ Default Format: JSON
+ Parameters:
+ Enter only those parameters which you want to update.
Example: XML
+ +| PUT http://magentohost/api/rest/stockitems/1 | +
Request Body:
+<?xml version="1.0"?> +<magento_api> + <qty>99</qty> +</magento_api>+
Example: JSON
+ +| PUT http://magentohost/api/rest/stockitems/1 | +
Request Body:
+{
+"qty":"99"
+}
+ Description: Not allowed. The DELETE method is not allowed because you cannot delete a stock item. The + required stock item is deleted together with the product which it is associated to.
+ + +Possible HTTP Status Codes:
+ +| Error Code | +Error Message | +Error Description | +
|---|---|---|
| 200 | +Resource updated successful. | +The required resource was successfully updated. | +
| 404 | +Resource not found. | +The required resource is not found or does not exist. | +
| 400 | +Empty value for <name of the parameter> in request. | +Value is not defined for the specified parameter in the request body. | +
| 400 | +Invalid value for "item_id" in request. | +The specified value for "item_id" is not valid. | +
| 400 | +Missing <name of the parameter> in request. | +The specified parameter is missing in the request body. | +
| 500 | +Resource internal error. | +Resource internal error. | +
Allows you to manage existing customer addresses.
+ +URL Structure: http://magentohost/api/rest/customers/:customer_id/addresses
+Version: 1
Description: Allows you to retrieve the list of existing customer addresses.
+Notes: The list of attributes that will be returned for customer addresses is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses. Also, Admin can add additional non-system customer address attributes by selecting Customers > Attributes > Manage Customer Address Attributes (available only in Magento Enterprise Edition). If these attributes are set as visible on frontend, they will be returned in the response.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/customers/1/addresses |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>2</entity_id> + <firstname>John</firstname> + <lastname>Doe</lastname> + <city>PA</city> + <region>Palau</region> + <postcode>19103</postcode> + <country_id>US</country_id> + <telephone>610-634-1181</telephone> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + <fax></fax> + <vat_id>123456789</vat_id> + <street> + <data_item>2356 Jody Road Philadelphia</data_item> + <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> + </street> + <is_default_billing>1</is_default_billing> + <is_default_shipping>1</is_default_shipping> + </data_item> +</magento_api>+
response body: json:
+
+
+[
+ {
+ "entity_id": "98",
+ "firstname": "John",
+ "middlename": null,
+ "lastname": "Doe",
+ "company": null,
+ "city": "Philly",
+ "country_id": "US",
+ "region": "California",
+ "postcode": "94131",
+ "telephone": "888-555-1212",
+ "fax": null,
+ "street": [
+ "123 Center St"
+ ],
+ "is_default_billing": 0,
+ "is_default_shipping": 1
+ },
+ {
+ "entity_id": "99",
+ "firstname": "John",
+ "lastname": "Doe",
+ "city": "San Jose",
+ "country_id": "US",
+ "region": "California",
+ "postcode": "94070",
+ "telephone": "898-555-1212",
+ "street": [
+ "123 Easy St"
+ ],
+ "is_default_billing": 1,
+ "is_default_shipping": 0
+ }
+]
+
+ Notes: If the customer has more than two street addresses, they will be returned in the following form: first address in the first string and all other addresses in the second string separated with a semicolon (like in the example above).
+ +Description: Allows you to create a new address for the required customer.
+Notes: The Customer user type can create addresses only for themselves.
When adding a street address for the customer, it should look like the following:
+<street> + <data_item>street address 1</data_item> + <data_item>street address 2</data_item> + <data_item>street address 3</data_item> +</street>+
Authentication: Admin, Customer
+Default Format: XML
Parameters:
+ +| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| firstname | +Customer first name | +required | +string | +John | +
| lastname | +Customer last name | + required |
+string | +Doe | +
| street |
+Customer street address. There can be more than one street address. | + required |
+string | + 2800 Watson Lane |
+
| city |
+Name of the city | + required |
+string | + Asheville |
+
| country_id |
+Name of the country | + required |
+string | + US |
+
| region | +Region name or code | +required for countries with regions (USA, Canada, etc.) | +string | +Palau | +
| postcode |
+Customer ZIP/postal code | + required |
+string | + 28803 |
+
| telephone |
+Customer phone number | + required |
+string | + 828-775-0519 |
+
Example:
+ +| POST http://magentohost/api/rest/customers/1/addresses |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <firstname>Johny</firstname> + <lastname>Doe</lastname> + <city>PA</city> + <region>Palau</region> + <postcode>19103</postcode> + <country_id>US</country_id> + <telephone>611-634-1181</telephone> + <street> + <data_item>2354 Jody Road Philadelphia</data_item> + <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> + </street> +</magento_api>+
Update Customer Address: not allowed.
+ + +Description: Not allowed.
+ + + +Allows you to manage an existing customer address.
+ +URL Structure: http://magentohost/api/rest/customers/addresses/:address_id
+Version: 1
Description: Allows you to retrieve an existing customer address.
+Notes: The list of attributes that will be returned for customer address is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses. Also, Admin can add additional non-system customer address attributes by selecting Customers > Attributes > Manage Customer Address Attributes (available only in Magento Enterprise Edition). If these attributes are set as visible on frontend, they will be returned in the response.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/customers/addresses/2 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <entity_id>2</entity_id> + <firstname>John</firstname> + <lastname>Doe</lastname> + <city>PA</city> + <region>Palau</region> + <postcode>19103</postcode> + <country_id>US</country_id> + <telephone>610-634-1181</telephone> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + <fax></fax> + <vat_id>123456789</vat_id> + <street> + <data_item>2356 Jody Road Philadelphia</data_item> + <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> + </street> + <is_default_billing>1</is_default_billing> + <is_default_shipping>1</is_default_shipping> +</magento_api>+
response body: json:
+
+
+{
+ "entity_id": "2",
+ "firstname": "John",
+ "lastname": "Doe",
+ "city": "San Jose",
+ "country_id": "US",
+ "region": "California",
+ "postcode": "94070",
+ "telephone": "898-555-1212",
+ "street": [
+ "123 Easy St"
+ ],
+ "is_default_billing": 1,
+ "is_default_shipping": 0
+}
+ Description: Not allowed.
+ +Description: Allows you to update an existing customer address.
+Notes: The list of attributes that will be updated for customer address is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses.
If you want to add more addresses, it should look like the following:
+<street> +Â Â <data_item>street address 1</data_item> +Â Â <data_item>street address 2</data_item> +Â Â <data_item>street address 3</data_item> +</street>+
Authentication: Admin, Customer
+Default Format: XML
Example:
+ +| PUT http://magentohost/api/rest/customers/addresses/7 |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <firstname>Johny</firstname> + <lastname>Doe</lastname> + <city>PA</city> + <region>Palau</region> + <postcode>19103</postcode> + <country_id>US</country_id> + <telephone>610-634-1181</telephone> + <street> + <data_item>2356 Jody Road Philadelphia</data_item> + <data_item>844 Jefferson Street</data_item> + </street> + <is_default_billing>1</is_default_billing> + <is_default_shipping>1</is_default_shipping> +</magento_api>+
request body: json:
+
+
+{
+ "entity_id": "99",
+ "firstname": "John",
+ "lastname": "Doe",
+ "city": "San Jose",
+ "country_id": "US",
+ "region": "California",
+ "postcode": "94070",
+ "telephone": "898-555-1212",
+ "street": [
+ "123 Easy St"
+ ],
+ "is_default_billing": 1,
+ "is_default_shipping": 0
+}
+ Description: Allows you to delete an existing customer address.
+Notes: The Customer user type can delete only his/her own addresses.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/customers/addresses/7 |
| Status Code | +Message | +Description | +
|---|---|---|
| 405 | +Resource method not implemented yet. | +The required method is not implemented or not allowed. | +
| 404 | + Resource not found. |
+The specified resource is not found or does not exist. | +
| 400 | +Invalid country identifier type | +The <country_id> value is passed not as a string type. | +
| 400 | + <value name> is a required value. |
+The specified value is a required one. | +
| 400 | + Country does not exist |
+The specified country does not exist. | +
| 400 | +Country is required | +The <country_id> value is required. | +
| 400 | + Country is not between '2' and '3' inclusively. |
+The country code is not in the range of 2 and 3 symbols inclusively. | +
| 400 | + Invalid State/Province type |
+The <region> value is invalid (value is empty or passed as an array) | +
| 400 | + State/Province is required |
+The <region> value is required for the specified country. | +
| 400 | + State/Province is invalid |
+The entered value for <region> is invalid. It must be the region code (TX) or region name (Texas). | +
| 400 | + State/Province does not exist |
+The specified region does not exist (only for the country with predefined regions). | +
| 400 | + Address is default for customer so is not allowed to be deleted |
+The address cannot be deleted because it is set as a default one for billing or shipping. | +
Allows you to create and retrieve customers.
+ +URL Structure: http://magentohost/api/rest/customers
+Version: 1
Description: Allows you to retrieve the list of existing customers.
+Notes:: Only Admin user can retrieve the list of customers with all their attributes.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example
+| GET http://magentohost/api/rest/customers |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>2</entity_id> + <website_id>1</website_id> + <email>test@example.com</email> + <group_id>1</group_id> + <created_at>2012-03-22 14:15:54</created_at> + <disable_auto_group_change>1</disable_auto_group_change> + <firstname>john</firstname> + <lastname>Doe</lastname> + <created_in>Default Store View</created_in> + </data_item> + <data_item> + <entity_id>4</entity_id> + <website_id>1</website_id> + <email>earl@example.com</email> + <group_id>1</group_id> + <created_at>2012-03-28 13:54:04</created_at> + <disable_auto_group_change>0</disable_auto_group_change> + <firstname>Earl</firstname> + <lastname>Hickey</lastname> + <created_in>Admin</created_in> + </data_item> +</magento_api>+
response example: json
+| get http://magentohost/api/rest/customers |
response body:
+
+
+{
+ "2": {
+ "entity_id": "2",
+ "website_id": "1",
+ "email": "test@example.com",
+ "group_id": "1",
+ "created_at": "2012-03-22 14:15:54",
+ "disable_auto_group_change": "1",
+ "firstname": "john",
+ "lastname": "Doe",
+ "created_in": "Admin",
+ "prefix": null,
+ "suffix": null,
+ "taxvat": null,
+ "dob": "2001-01-03 00:00:00",
+ "reward_update_notification": "1",
+ "reward_warning_notification": "1",
+ "gender": "1"
+ },
+ "4": {
+ "entity_id": "4",
+ "website_id": "1",
+ "email": "earl@example.com",
+ "group_id": "1",
+ "created_at": "2013-03-28 18:59:41",
+ "disable_auto_group_change": "0",
+ "firstname": "Earl",
+ "lastname": "Hickey",
+ "created_in": "Admin",
+ "prefix": null,
+ "suffix": null,
+ "taxvat": null,
+ "dob": "2012-03-28 13:54:04",
+ "reward_update_notification": "1",
+ "reward_warning_notification": "1",
+ "gender": "1"
+ }
+
+ Description: Allows you to create a new customer.
+Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| firstname | +The customer first name | +required | +string | +John | +
| lastname | +The customer last name | +required | +string | +Doe | +
| The customer email address | +required | +string | +johny@example.com | +|
| password | +The customer password. The password must contain minimum 7 characters | +required | +string | +123123q | +
| website_id | +Website ID | +required | +int | +1 | +
| group_id | +Customer group ID | +required | +int | +1 | +
| disable_auto_group_change | +Defines whether the automatic group change for the customer will be disabled | +optional | +int | +0 | +
| prefix |
+Customer prefix | + optional |
+string | +Mr. | +
| middlename |
+Customer middle name or initial | + optional |
+string | +R. | +
| suffix |
+Customer suffix | + optional |
+string | +Sr. | +
| taxvat |
+Customer Tax or VAT number | + optional |
+string | + GB999 9999 73 |
+
Notes: The list of parameters may change depending on the attributes settings in Customers > Attributes > Manage Customer Attributes page in Magento Admin Panel. For example, a required status of the middlename attribute (Middle Name/Initial) may be changed to 'YES". Please note that managing customer attributes is available only in Magento Enterprise Edition.
+ +Example:
+| POST http://magentohost/api/rest/customers |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <firstname>Earl</firstname> + <lastname>Hickey</lastname> + <password>123123q</password> + <email>earl@example.com</email> + <website_id>1</website_id> + <group_id>1</group_id> +</magento_api>+
Response:
+If the customer was created successfully, we receive Response HTTP Code = 200, empty Response Body and Location header like '/api/rest/customers/555' where '555' - an entity id of the new customer.
Description: Not allowed
+ +Description: Not allowed
+ +Allows you to manage existing customers.
+ +URL Structure: http://magentohost/api/rest/customers/:customerId
+Version: 1
Description: Allows you to retrieve information on an existing customer.
+Notes:: The list of attributes that will be returned for customers is configured in the Magento Admin Panel. The Customer user type has access only to his/her own information. Also, Admin can add additional non-system customer attributes by selecting Customers > Attributes > Manage Customer Attributes. If these attributes are set as visible on frontend, they will be returned in the response. Also, custom attributes will be returned in the response only after the customer information is updated in the Magento Admin Panel or the specified custom attribute is updated via API (see the PUT method below). Please note that managing customer attributes is available only in Magento Enterprise Edition.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+| GET http://magentohost/api/rest/customers/2 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <entity_id>2</entity_id> + <website_id>1</website_id> + <email>test@example.com</email> + <group_id>1</group_id> + <created_at>2012-03-22 14:15:54</created_at> + <disable_auto_group_change>1</disable_auto_group_change> + <created_in>Default Store View</created_in> + <firstname>john</firstname> + <lastname>Doe</lastname> + <last_logged_in>2012-03-22 14:15:56</last_logged_in> +</magento_api>+
response example: json
+ + +response body:
+
+
+{
+ "entity_id": "2",
+ "website_id": "1",
+ "email": "test@example.com",
+ "group_id": "1",
+ "created_at": "2012-03-22 14:15:54",
+ "disable_auto_group_change": "1",
+ "created_in": "English",
+ "firstname": "john",
+ "lastname": "Doe"
+}
+
+ Description: Not allowed.
+ +Description: Allows you to update an existing customer.
+Notes: The list of attributes that will be updated for customer is configured in the Magento Admin Panel. The Customer user type has access only to his/her own information.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+You must specify only those parameters which you want to update. Parameters that are not defined in the request body will preserve the previous values. The website_id and created_in attributes are not allowed for updating.
Example:
+| PUT http://magentohost/api/rest/customers/2 |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <firstname>Earl</firstname> + <lastname>Hickey</lastname> + <email>customerss@example.com</email> + <group_id>1</group_id> +</magento_api>+
Description: Allows you to delete an existing customer.
+Notes: Admin only can delete a customer.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+| DELETE http://magentohost/api/rest/customers/2 |
The Magento REST API allows you to manage customers, customer addresses, sales orders, inventory, and products. REST API is organized into the following categories:
+ + + +Retrieve the list of products, create, update, delete a product.
+ +Resource Structure: http://magentohost/api/rest/products
+ +Retrieve the list of categories assigned to a product, assign and unassign the category from a product.
+ +Resource Structure: http://magentohost/api/rest/products/:id/categories
+ +Retrieve the list of images assigned to a product, add, update, remove an image to/from a product.
+ +Resource Structure: http://magentohost/api/rest/products/:id/images
+ +Retrieve the list of websites assigned to a product, assign, unassign a website to/from a product.
+ +Resource Structure: http://magentohost/api/rest/products/:id/websites
+ +Retrieve the list of customers, create, delete a customer, and update the customer information.
+ +Resource Structure: http://magentohost/api/rest/customers
+ +Retrieve the list of customer addresses, create, update, and delete the customer address.
+ +Resource Structure: http://magentohost/api/rest/customers/:id/addresses
+ +Retrieve the list of stock items, update required stock items.
+ +Resource Structure: http://magentohost/api/rest/stockitems
+ +Retrieve the list of sales orders with detailed information on order addresses, items, and comments.
+ +Resource Structure: http://magentohost/api/rest/orders
+ +Retrieve information on order billing and shipping addresses.
+ +Resource Structure: http://magentohost/api/rest/orders/:id/addresses
+ +Retrieve information on the specified order comments.
+ +Resource Structure: http://magentohost/api/rest/orders/:id/comments
+ +Retrieve information on specified order items.
+ +Resource Structure: http://magentohost/api/rest/orders/:id/items
+ + + + diff --git a/guides/v1.8/api/rest/authentication/oauth_authentication.html b/guides/v1.8/api/rest/authentication/oauth_authentication.html new file mode 100644 index 0000000000..379b182e19 --- /dev/null +++ b/guides/v1.8/api/rest/authentication/oauth_authentication.html @@ -0,0 +1,469 @@ +--- +layout: v1x_rest +title: Authentication +--- + +In most cases, the third-party application must be authenticated to use the Magento API. But users never reveal their credentials to the application to preserve their privacy. So, the question is as follows: how is your application going to authenticate users if it does not know user credentials. OAuth is the solution.
+ +Magento authentication is based on OAuth, an open standard for secure API authentication. OAuth is a token-passing mechanism that allows users to control which applications have access to their data without revealing their passwords or other credentials.
+ +The OAuth concept lies in three basic elements that can be easily described in the following picture:
+ + +
+
+To learn more about OAuth, you can visit the official OAuth site.
+ + +The current API supports OAuth 1.0a.
+ +The OAuth authentication works by asking the user to authorize their application. When the user authorizes the application, the application can access that user protected resources by using an access token. This token will be used in each further request. Access tokens are long-lived and will not expire unless the user revokes access to the application.
+ +OAuth is completely invisible for the site visitors.
+ +Magento uses OAuth to allow access to its data. You need to use OAuth if you want to use any of the following Magento APIs:
+ +There are some definitions you need to get familiar with before you start using OAuth. These are as follows:
+The OAuth process consists of several steps:
+
+
+The application that requires access to data is known as the Consumer and Magento is the Service Provider.
+ + +Before starting to make API requests, you need to register the application. After the registration, you will receive the Consumer Key that will identify you in Magento. Also, you will receive a Consumer Secret. This secret will be used when requesting for a Request Token.
+ +You can register your application by selecting System > Web Services > REST - OAuth Consumers and clicking Add New in the Admin Panel.
+ +When registering the application, you also need to define the callback URL, to which the user will be redirected after he/she successfully authorizes your application.
+ +The authentication endpoints include the following ones:
+ +Also, the simple form can be used for authentication. To use a simple form, add the /simple endpoint to the authentication endpoint. For example: /oauth/authorize/simple
+ + +The first step to authenticate the user is to retrieve a Request Token from Magento. This is a temporary token that will be exchanged for the Access Token.
+ + + +| Endpoint: | +/oauth/initiate | +
|---|---|
| Description: | +The first step of authentication. Allows you to obtain the Request Token used for the rest of the authentication process. | +
| Method: | +POST | +
| Returns: | +Request Token | +
| Sample Response: | +oauth_token=4cqw0r7vo0s5goyyqnjb72sqj3vxwr0h&oauth_token_secret=rig3x3j5a9z5j6d4ubjwyf9f1l21itrr&oauth_callback_confirmed=true | +
The following request parameters should be present in the Authorization header:
+The second step is to request user authorization. After receiving the Request Token from Magento, the application provides an authorization page to the user. The only required parameter for this step is the Request Token (oauth_token value) received from the previous step. The endpoint is followed by an oauth_token parameter with the value set to the oauth_token value.
+ +After this, the user is asked to enter their credentials and authorize. When the user is granted the access, he/she is redirected to the URL specified in the oauth_callback parameter. This URL is followed by two parameters:
+| Endpoint: | +/oauth/authorize | +
|---|---|
| Description: | +The second step of authentication. Without the user authorization in this step, it is impossible for your application to obtain an Access Token. | +
| Method: | +GET | +
| Sample Response: | +/callback?oauth_token=tz2kmxyf3lagl3o95xnox9ia15k6mpt3&oauth_verifier=cbwwh03alr5huiz5c76wi4l21zf05eb0 | +
The final third authentication step. After the application access is authorized, the application needs to exchange the Request Token for an Access Token. For this step, you will need the Request Token (the oauth_token and oauth_token_secret values) and the oauth_verifier value from the previous step.
+ + + +| Endpoint: | +/oauth/token | +
|---|---|
| Description: | +The third step of authentication. Getting an Access Token. | +
| Method: | +POST | +
| Returns: | +An access token and the corresponding access token secret, URL-encoded. | +
| Sample Response: | +oauth_token=0lnuajnuzeei2o8xcddii5us77xnb6v0&oauth_token_secret=1c6d2hycnir5ygf39fycs6zhtaagx8pd | +
The following components should be present in the Authorization header:
+The response will contain the following response parameters:
+When the third-party application performs invalid requests to Magento, the following errors related to OAuth can occur:
+ + +| HTTP Code | +Error Code | +Text Representation | +Description | +
|---|---|---|---|
| 400 | +1 | +version_rejected | +This error is used when the oauth_version parameter does not correspond to the "1.0a" value. | +
| 400 | +2 | + parameter_absent |
+This error is used there is no required parameter in the request. The name of the missing parameter is specified additionally in the response. | +
| 400 | +3 | + parameter_rejected |
+This error is used when the type of the parameter or its value does not meet the protocol requirements (e.g., array is passed instead of the string). | +
| 400 | +4 | + timestamp_refused |
+This error is used if there is incorrect value of the timestamp in the oauth_timestamp parameter. | +
| 401 | +5 | + nonce_used |
+This error is used if the nonce-timestamp combination has already been used. | +
| 400 | +6 | + signature_method_rejected |
+This error is used for unsupported signature method. The following methods are supported: HMAC-SHA1, RSA-SHA1, and PLAINTEXT. | +
| 401 | +7 | + signature_invalid |
+This error is used if the signature is invalid. | +
| 401 | +8 | + consumer_key_rejected |
+This error is used if the Consumer Key has incorrect length or does not exist. | +
| 401 | +9 | + token_used |
+This error is used if there is an attempt of authorization of an already authorized token or an attempt to exchange a not temporary token for a permanent one. | +
| 401 | +10 | + token_expired |
+This error is used if the temporary token has expired. At the moment, the mechanism of expiration of temporary tokens is not implemented and the current error is not used. | +
| 401 | +11 | + token_revoked |
+This error is used if the token is revoked by the user who authorized it. | +
| 401 | +12 | + token_rejected |
+This error is used if the token is not valid, or does not exist, or is not valid for using in the current type of request. | +
| 401 | +13 | + verifier_invalid |
+This error is used if the confirmation string does not correspond to the token. | +
<?php
+/**
+ * Example of retrieving the products list using Customer account via Magento REST API. OAuth authorization is used
+ * Preconditions:
+ * 1. Install php oauth extension
+ * 2. If you were authorized as an Admin before this step, clear browser cookies for 'yourhost'
+ * 3. Create at least one product in Magento and enable it for viewing in the frontend
+ * 4. Configure resource permissions for Customer REST user for retrieving all product data for Customer
+ * 5. Create a Consumer
+ */
+// $callbackUrl is a path to your file with OAuth authentication example for the Customer user
+$callbackUrl = "http://yourhost/oauth_customer.php";
+$temporaryCredentialsRequestUrl = "http://yourhost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
+$customerAuthorizationUrl = 'http://yourhost/oauth/authorize';
+$accessTokenRequestUrl = 'http://yourhost/oauth/token';
+$apiUrl = 'http://yourhost/api/rest';
+$consumerKey = 'yourconsumerkey';
+$consumerSecret = 'yourconsumersecret';
+
+session_start();
+if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
+ $_SESSION['state'] = 0;
+}
+try {
+ $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
+ $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
+ $oauthClient->enableDebug();
+
+ if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
+ $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
+ $_SESSION['secret'] = $requestToken['oauth_token_secret'];
+ $_SESSION['state'] = 1;
+ header('Location: ' . $customerAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
+ exit;
+ } else if ($_SESSION['state'] == 1) {
+ $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
+ $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
+ $_SESSION['state'] = 2;
+ $_SESSION['token'] = $accessToken['oauth_token'];
+ $_SESSION['secret'] = $accessToken['oauth_token_secret'];
+ header('Location: ' . $callbackUrl);
+ exit;
+ } else {
+ $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
+
+ $resourceUrl = "$apiUrl/products";
+ $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json'));
+ $productsList = json_decode($oauthClient->getLastResponse());
+ print_r($productsList);
+ }
+} catch (OAuthException $e) {
+ print_r($e->getMessage());
+ echo "<br/>";
+ print_r($e->lastResponse);
+}
+
diff --git a/guides/v1.8/api/rest/authentication/oauth_configuration.html b/guides/v1.8/api/rest/authentication/oauth_configuration.html
new file mode 100644
index 0000000000..832f9b971e
--- /dev/null
+++ b/guides/v1.8/api/rest/authentication/oauth_configuration.html
@@ -0,0 +1,261 @@
+---
+layout: v1x_rest
+title: OAuth Configuration
+---
+
+
+Before starting to use OAuth, you need to perform several steps in the Magento Admin Panel. These steps allow you to enable the OAuth functionality for further actions.
+ +First, you need to create a Consumer in the Admin Panel. Creating a new consumer means registering the application. To do this, perform the following steps:
+ +
To edit an existing consumer, perform the following steps:
+ +| The Key and Secret fields cannot be edited. |
To delete the required consumer, perform the following steps:
+You can search for a required consumer by several parameters: ID, consumer name, and date of creation.
+To search for a consumer, perform the following steps:
To view authorized tokens in the Admin panel, perform the following steps:
+ +From the Authorized OAuth Tokens page, you can enable, revoke, or delete the required token.
+ +To view the list of applications, perform the following steps:
+If a token is revoked (the Yes value in the Revoked column on the Authorized OAuth Tokens page), you can enable it. To do this, perform the following steps:
+| You can select more than one token with the Revoked status and enable all of them by using the mass action. |
If a token is enabled (the No value in the Revoked column), you can revoke it. To do this, perform the following steps:
+| You can select more than one token with the Revoked status set to No and revoke all of them by using the mass action. |
To delete the required token, perform the following steps:
+| You can select more than one token and delete all of them by using the mass action. |
To view the authorized applications from the frontend, perform the following steps:
+ +
From this page, you can enable, revoke, or delete the required token.
+ +| If the token is revoked, there will be the Disabled status next to it. |
| If the token is enabled, there will be the Enabled status next to it. |
You can set the email template that will be used for user notification if the token status changes. Also, you can set different email templates for different store views. For example, you have two store views: English and German. Magento allows you to set one email template for the English store view and another one for the German store view.
+To set the email template, perform the following steps:

You can also create your own email template that will be used for user notification if the token status changes.
+To create a new template, perform the following steps:
You can configure the cleanup functionality for temporary tokens. These tokens can be deleted after a certain period of time or after a certain number of OAuth requests.
+To configure cleanup, perform the following steps:

HTTP status codes are an essential part of the REST concept. You can get familiar with all of them on Wikipedia.
+ +The Magento API attempts to return appropriate HTTP status codes for all requests. Any information is returned in the form of a standard HTTP response with an HTTP status code describing the error and the body message.
+ +The following table contains possible common HTTP status codes:
+ +| Status Code | +Message | +
|---|---|
| 200 OK | +- | +
| 201 Created | + Resource was partially created + |
+
| 207 Multi-Status | +- | +
| 400 Bad Request | + Resource data pre-validation error. +Resource data invalid. +Resource unknown error. +The request data is invalid. +Resource collection paging error. +The paging limit exceeds the allowed number. +Resource collection ordering error. +Resource collection filtering error. +Resource collection including additional attributes error. |
+
| 403 Forbidden | +Access denied. | +
| 404 Not Found | + Resource not found. |
+
| 405 Method Not Allowed | + Resource does not support method. +Resource method not implemented yet. |
+
| 500 Internal Error | + Unhandled simple errors. +Resource internal error. |
+
When the Magento API returns an error message, it returns it in your requested format. For example, an error in the XML format might look like the following:
+<?xml version="1.0"?> +<magento_api> + <messages> + <error> + <data_item> + <code>404</code> + <message>Resource not found.</message> + </data_item> + </error> + </messages> +</magento_api>+
An error in the JSON format might look like the following:
+ +{"messages":{"error":[{"code":404,"message":"Resource not found."}]}}
+ Some requests use GET parameters in the URL. These are as follows:
+ +If the attribute value consists of several words separated by a whitespace, the '%20' sign is used:
+ + + +For example, to filter products with the description equal to simple01:
+ + + +To filter customers by email address:
+ +http://magentohost/api/rest/customers?filter[1][attribute]=email&filter[1][in][0]=ryan@test.com
+ + diff --git a/guides/v1.8/api/rest/http_methods.html b/guides/v1.8/api/rest/http_methods.html new file mode 100644 index 0000000000..f58d4dd98c --- /dev/null +++ b/guides/v1.8/api/rest/http_methods.html @@ -0,0 +1,90 @@ +--- +layout: v1x_rest +title: HTTP Methods +--- + + +Accessing API is performed via HTTP. When you enter a URL into a web browser address bar, the browser performs an HTTP GET request to the URL. This usually returns a web page in the form of an HTTP response that the browser displays. But the GET method is one of several HTTP request methods. Magento REST API uses the four main HTTP methods: GET, POST, PUT, and DELETE. The most widespread methods are GET and POST. The other methods are less known but they became widely known due to the popularity of REST web services. An important concept of the REST architecture is that different HTTP request methods perform different actions when applied to the same URL.
+ +For example:
+ + + +will retrieve information about the specified customer;
+ + + +will delete the specified customer.
+ +Retrieving Resources with the HTTP GET Method
+ +The HTTP GET method is defined in section 9.3 of the RFC2616 document:
+ +++The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.
You can retrieve a representation of a resource by getting its URL.
+ + + +Creating or Updating Resources with the HTTP POST and PUT Methods
+ +The POST method is defined in section 9.5 of the RFC2616 document:
+ +++ + +The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:
+ ++
+ + +- Annotation of existing resources;
++
+ + +- Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;
++
+ + +- Providing a block of data, such as the result of submitting a form, to a data-handling process;
++
+ +- Extending a database through an append operation.
+
The PUT method is defined in section 9.6 of the RFC2616 document:
+ ++ + +The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.
Creating or updating a resource involves performing an HTTP POST or HTTP PUT to a resource URL.
+ + + +Deleting Resources with the HTTP DELETE Method
+ +The DELETE method is defined in section 9.7 of the RFC2616 document:
+ ++ + +The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server.
Deleting a resource is performed by means of making an HTTP DELETE request to the resource URL.
+ + + diff --git a/guides/v1.8/api/rest/introduction.html b/guides/v1.8/api/rest/introduction.html new file mode 100644 index 0000000000..3b8d378e2f --- /dev/null +++ b/guides/v1.8/api/rest/introduction.html @@ -0,0 +1,510 @@ +--- +layout: v1x_rest +title: Introduction to the Magento 1.x REST API +--- + + +What is REST API? To make it simple, REST API defines a set of functions to which the developers can perform requests + and receive responses. The interaction is performed via the HTTP protocol. An advantage of such an approach is the + wide usage of HTTP. That is why REST API can be used practically for any programming language.
+ +Common characteristics of Magento REST API resources are as follows: (magentohost is your domain)
+ +Magento REST API allows managing a number of features, namely:
+ +Magento REST API uses 3-legged OAuth 1.0a protocol to authenticate + the application to access the Magento service.
+ + +The REST API supports the response in two formats, which are XML and JSON.
+ +HTTP verbs are used to manage the state of resources. In Magento REST API, there are four verbs used to manage + resources: GET, POST, PUT, and DELETE. You can get the contents of the data using HTTP GET, delete the data using + HTTP DELETE, and create or update the data using POST/PUT.
+ +All URLs in REST API have the following base URL.
+ +http://magentohost/api/rest/
+ + +Example
+ +Supposing, you want to retrieve the list of customers from Magento. To do this, you need to use the GET HTTP method. + The GET request to retrieve the list of customers will look as follows:
+ +http://magentohost/api/rest/customers
+where
+ +The Magento REST API allows you to manage customers, customer addresses, sales orders, inventory, and products. REST + API is organized into the following categories:
+ +These steps are required for utilizing REST API resources:
+ +
<?php
+/**
+* Example of simple product POST using Admin account via Magento REST API. OAuth authorization is used.
+*
+* This file is a stand-alone OAuth client PHP file, which handles everything with the OAuth three-legged authentication.
+* It uses PHP session to persist the current authentication state (step), the OAuth request token with its secret
+* and the OAuth access token with its secret.
+*
+* Create this file oauth_admin.php in your Magento 1.x instance root folder to run this oauth authentication example.
+*
+* oauth_admin.php
+*
+*/
+
+$callbackUrl = "http://yourhost/oauth_admin.php";
+$temporaryCredentialsRequestUrl = "http://magentohost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
+$adminAuthorizationUrl = 'http://magentohost/admin/oauth_authorize';
+$accessTokenRequestUrl = 'http://magentohost/oauth/token';
+$apiUrl = 'http://magentohost/api/rest';
+$consumerKey = 'yourconsumerkey';
+$consumerSecret = 'yourconsumersecret';
+
+session_start();
+if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
+ $_SESSION['state'] = 0;
+}
+try {
+ $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
+ $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
+ $oauthClient->enableDebug();
+
+ if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
+ // step 1 (state 1) - Get the initial temporary request token.
+ $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
+
+ // persist the request token secret in the session variable for step 3 to get the access token and secret.
+ $_SESSION['secret'] = $requestToken['oauth_token_secret'];
+ $_SESSION['state'] = 1;
+
+ // step 2 (state 2) - redirect to the Oauth admin authorization url to validate and confirm / reject the admin Oauth authorization request.
+ // variable $requestToken['oauth_token'] has the temporary request token
+ header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
+ exit;
+ } elseif ($_SESSION['state'] == 1) {
+ //step 3 (state 3) Exchange the temporary request token and secret to get the final access token and secret.
+ $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
+ $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
+
+ // persist the access token and its secret in the session variable
+ $_SESSION['state'] = 2;
+ $_SESSION['token'] = $accessToken['oauth_token'];
+ $_SESSION['secret'] = $accessToken['oauth_token_secret'];
+
+ // redirect back to the callback url which is the same file
+ header('Location: ' . $callbackUrl);
+ exit;
+ } else {
+
+ // send a POST request to create a simple product
+ $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
+ $resourceUrl = "$apiUrl/products";
+ $productData = json_encode(array(
+ 'type_id' => 'simple',
+ 'attribute_set_id' => 4,
+ 'sku' => 'simple' . uniqid(),
+ 'weight' => 1,
+ 'status' => 1,
+ 'visibility' => 4,
+ 'name' => 'Simple Product',
+ 'description' => 'Simple Description',
+ 'short_description' => 'Simple Short Description',
+ 'price' => 99.95,
+ 'tax_class_id' => 0,
+ ));
+ $headers = array('Content-Type' => 'application/json');
+ $oauthClient->fetch($resourceUrl, $productData, OAUTH_HTTP_METHOD_POST, $headers);
+ print_r($oauthClient->getLastResponseInfo());
+ }
+} catch (OAuthException $e) {
+ print_r($e);
+}
+ <?php
+/**
+* Example of products list retrieve using Customer account via Magento REST API. OAuth authorization is used
+*
+* This file is a stand-alone Oauth client PHP file, which handles everything with the Oauth three-legged authentication.
+* It uses PHP session to persist the current authentication state (step), the oauth request token with its secret
+* and the oauth access token with its secret.
+*
+* Create this file oauth_customer in your Magento 1.x instance root folder to run this oauth authentication example.
+*
+* oauth_customer.php
+*
+*/
+$callbackUrl = "http://yourhost/oauth_customer.php";
+$temporaryCredentialsRequestUrl = "http://magentohost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
+$adminAuthorizationUrl = 'http://magentohost/oauth/authorize';
+$accessTokenRequestUrl = 'http://magentohost/oauth/token';
+$apiUrl = 'http://magentohost/api/rest';
+$consumerKey = 'yourconsumerkey';
+$consumerSecret = 'yourconsumersecret';
+
+session_start();
+if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
+ $_SESSION['state'] = 0;
+}
+try {
+ $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
+ $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
+ $oauthClient->enableDebug();
+
+ if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
+ // step 1 (state 1) - Get the initial temporary request token.
+ $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
+
+ // persist the request token secret in the session variable for step 3 to get the access token and secret.
+ $_SESSION['secret'] = $requestToken['oauth_token_secret'];
+ $_SESSION['state'] = 1;
+
+ // step 2 (state 2) - redirect to the Oauth customer authorization url.
+ // variable $requestToken['oauth_token'] has the temporary request token
+ header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
+ exit;
+ } elseif ($_SESSION['state'] == 1) {
+ //step 3 (state 3) Exchange the temporary request token and secret to get the final access token and secret.
+ $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
+ $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
+
+ // persist the access token and its secret in the session variable to access the products resource
+ $_SESSION['state'] = 2;
+ $_SESSION['token'] = $accessToken['oauth_token'];
+ $_SESSION['secret'] = $accessToken['oauth_token_secret'];
+
+ // redirect back to the callback url which is the same file
+ header('Location: ' . $callbackUrl);
+ exit;
+ } else {
+ // send a GET request to list all the products
+ $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
+ $resourceUrl = "$apiUrl/products";
+ $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => '*/*'));
+ $productsList = json_decode($oauthClient->getLastResponse());
+ print_r($productsList);
+ }
+} catch (OAuthException $e) {
+ print_r($e);
+}
+ Retrieving the list of Products as a Guest
+ +Example: XML
+<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>16</entity_id> + <type_id>simple</type_id> + <sku>n2610</sku> + <description>The Nokia 2610 is an easy to use device that combines multiple messaging options including email, instant messaging, and more. You can even download MP3 ringtones, graphics, and games straight to the phone, or surf the Internet with Cingular's MEdia Net service. It's the perfect complement to Cingular service for those even remotely interested in mobile Web capabilities in an affordable handset. +Design +Compact and stylish, the 2610 features a candybar design sporting a bright 128 x 128 pixel display capable of displaying over 65,000 colors. Most of the phone's features and on-screen menus are controlled by a center toggle on the control pad. A standard hands-free headphone jack is provided, as are volume control keys, and there's even a "Go-To" button that can be assigned by the user for quick access to favorite applications. Lastly, the included speakerphone allows you to talk handsfree, and because the phone sports an internal antenna, there's nothing to snag or break off. +</description> + <meta_keyword>Nokia 2610, cell, phone, </meta_keyword> + <short_description>The words "entry level" no longer mean "low-end," especially when it comes to the Nokia 2610. Offering advanced media and calling features without breaking the bank</short_description> + <name>Nokia 2610 Phone</name> + <meta_title>Nokia 2610</meta_title> + <meta_description>Offering advanced media and calling features without breaking the bank, The Nokia 2610 is an easy to use</meta_description> + <regular_price_with_tax>149.99</regular_price_with_tax> + <regular_price_without_tax>149.99</regular_price_without_tax> + <final_price_with_tax>149.99</final_price_with_tax> + <final_price_without_tax>149.99</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magentohost/imageulr/nokia.jpg</image_url> + </data_item> + <data_item> + <entity_id>17</entity_id> + <type_id>simple</type_id> + <sku>bb8100</sku> + <description> Like the BlackBerry 7105t, the BlackBerry 8100 Pearl is +The BlackBerry 8100 Pearl sports a large 240 x 260 screen that supports over 65,000 colors-- plenty of real estate to view your e-mails, Web browser content, messaging sessions, and attachments. The venerable BlackBerry trackwheel has been replaced on this model with an innovative four-way trackball placed below the screen. On the rear of the handheld, you'll find a 1.3-megapixel camera and a self portrait mirror. The handheld's microSD memory card slot is located inside the device, behind the battery. There's also a standard 2.5mm headset jack that can be used with the included headset, as well as a mini-USB port for data connectivity.</description> + <meta_keyword>Blackberry, 8100, pearl, cell, phone</meta_keyword> + <short_description>The BlackBerry 8100 Pearl is a departure from the form factor of previous BlackBerry devices. This BlackBerry handset is far more phone-like, and RIM's engineers have managed to fit a QWERTY keyboard onto the handset's slim frame.</short_description> + <name>BlackBerry 8100 Pearl</name> + <meta_title>BlackBerry 8100 Pearl</meta_title> + <meta_description>BlackBerry 8100 Pearl sports a large 240 x 260 screen that supports over 65,000 colors-- plenty of real estate to view your e-mails, Web browser content, messaging sessions, and attachments.</meta_description> + <regular_price_with_tax>349.99</regular_price_with_tax> + <regular_price_without_tax>349.99</regular_price_without_tax> + <final_price_with_tax>349.99</final_price_with_tax> + <final_price_without_tax>349.99</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magentohost/imageulr/blackberry.jpg</image_url> + </data_item> +</magento_api>+
Additional Information
+ +You can define the limit of items returned in the response by passing the limit parameter. By default, 10 items are + returned and the maximum number is 100 items. You can also define the page number by passing the page parameter. + Example:
+ +http://magentohost/api/rest/products?page=2&limit=20
+Authorization header will be required for Admin and Customer user types. The following parameters must be provided in + the Authorization header for the call:
+REST attributes allow specifying additional filters for different types of users. Attributes allow limiting user access more precisely.
+ + +
+
+The REST attributes tree includes the following elements (as subnodes):
+The Resources tree may be too immense. To avoid scrolling down when searching for the required resource, you can fold the nodes for better representation.
+ + + +This section provides some examples of limiting Guest and Customer access to certain resource elements.
+ +To allow Guests (users that are not registered in the Magento system) view only product name and final price with tax, perform the following steps:
+To allow Customers (users that are registered in the Magento system) view only product name and final price with tax, perform the following steps:
+The following table describes REST attributes that can be managed in the Magento Admin Panel.
+To access these attributes, go to System > Web Services > REST Attributes and select the type of the user for which attributes will be managed.
| Attribute Name | +Attribute Description | +Notes | +
|---|---|---|
| Order ID | +Sales order ID | ++ |
| Order Date |
+Date when the sales order was placed | ++ |
| Order Status | +Sales order status. Can have the following values: Pending, Processing, Complete, Closed, Holded, Pending PayPal, and Payment Review. | ++ |
| Shipping Method | +Shipping method selected during the checkout process (e.g., Flat rate - Fixed) | ++ |
| Payment Method | +Payment method selected during the checkout process (e.g., Check/money order) | ++ |
| Base Currency |
+Base currency code (e.g., USD) | ++ |
| Order Currency | + Order currency code (e.g., EUR) |
++ |
| Store Name |
+ Name of the store from which the order was placed |
++ |
| Placed from IP |
+ IP address from which the order was placed |
++ |
| Store Currency to Base Currency Rate |
+ Store currency to base currency rate |
++ |
| Subtotal |
+ Subtotal amount in order currency (excluding shipping and tax) |
++ |
| Subtotal Including Tax |
+ Subtotal amount including tax (in order currency) |
++ |
| Discount |
+ Discount amount applied in the sales order in order currency |
++ |
| Grand Total to Be Charged |
+ Total amount of money to be paid for the order in base currency (including tax) |
++ |
| Grand Total |
+ Grand total amount in order currency (including tax and shipping) |
++ |
| Shipping |
+ Shipping amount applied in the sales order in order currency |
++ |
| Shipping Including Tax |
+ Shipping amount including tax (in order currency) |
++ |
| Shipping Tax |
+ Tax amount for shipping in order currency |
++ |
| Tax Amount |
+ Tax amount applied in the sales order in order currency |
++ |
| Tax Name |
+Name of the applied tax | ++ |
| Tax Rate |
+Tax rate applied in the order (in order currency) | ++ |
| Gift Cards Amount |
+Gift card pricing amount | +This attribute is available only in Magento EE | +
| Reward Points Balance |
+Reward points amount (that can be converted to currency) | + This attribute is available only in Magento EE |
+
| Reward Currency Amount |
+Reward currency amount | + This attribute is available only in Magento EE |
+
| Coupon Code |
+ Coupon code that was applied in the order |
++ |
| Base Discount |
+ Amount of applied discount in base currency |
++ |
| Base Subtotal |
+ Subtotal amount for all products in the order in base currency (excluding tax and shipping) |
++ |
| Base Shipping |
+ Amount of money to be paid for shipping in base currency |
++ |
| Base Shipping Tax |
+ Tax amount for shipping in base currency |
++ |
| Base Tax Amount |
+ Tax amount applied to the order items in base currency |
++ |
| Total Paid |
+ Total amount paid for the order (in order currency) |
++ |
| Base Total Paid |
+ Total amount paid for the order (in base currency) |
++ |
| Total Refunded |
+ Total refunded amount in order currency |
++ |
| Base Total Refunded |
+ Total amount refunded for the order (in base currency) |
++ |
| Base Subtotal Including Tax |
+ Subtotal amount including tax but excluding the discount amount (in base currency) |
++ |
| Base Total Due |
+ The rest of the money to be paid for the order in base currency (e.g., when partial invoice is applied) |
++ |
| Total Due |
+ The rest of the money to be paid for the order in order currency (e.g., when partial invoice is applied) |
++ |
| Shipping Discount |
+ Discount amount for shipping (in order currency) |
++ |
| Base Shipping Discount |
+ Discount amount for shipping (in base currency) |
++ |
| Discount Description |
+ Discount code (coupon code applied in the order) |
++ |
| Customer Balance |
+Customer balance (in order currency) | ++ |
| Base Customer Balance |
+Customer balance (in base currency) | ++ |
| Base Gift Cards Amount |
+Gift card pricing amount (in base currency) | + This attribute is available only in Magento EE |
+
| Base Rewards Currency |
+Reward currency amount (in base currency) | + This attribute is available only in Magento EE |
+
| Attribute Name | +Attribute Description | +
|---|---|
| Customer Last Name | +Customer last name | +
| Customer First Name |
+Customer first name | +
| Customer Middle Name |
+Customer middle name or initial | +
| Customer Prefix |
+Customer prefix | +
| Customer Suffix |
+Customer suffix | +
| Company |
+Company name | +
| Street |
+Street address | +
| City |
+City | +
| State |
+State | +
| ZIP/Postal Code |
+ZIP or postal code | +
| Country |
+Country name | +
| Phone Number |
+Customer phone number | +
| Address Type |
+Address type. Can have the following values: billing or shipping | +
| Attribute Name | +Attribute Description | +
|---|---|
| Base Discount Amount | +Discount amount applied to the row in base currency | +
| Base Item Subtotal | +Row subtotal in base currency | +
| Base Item Subtotal Including tax | + Row subtotal including tax in base currency |
+
| Base Original Price | + Original item price in base currency |
+
| Base Price | + Item price in base currency |
+
| Base Price Including tax | + Item price including tax in base currency |
+
| Base Tax Amount | + Tax amount applied to the row in base currency |
+
| Canceled Qty | + Number of canceled order items |
+
| Discount Amount | +Discount amount applied to the row in order currency | +
| Invoiced Qty | + Number of invoiced order items |
+
| Item Subtotal | +Row subtotal in order currency | +
| Item Subtotal Including Tax | +Row subtotal including tax in order currency | +
| Order Item ID | +Order item ID | +
| Ordered Qty | + Number of ordered items |
+
| Original Price | +Original item price in order currency | +
| Parent Order Item ID | +ID of the configurable product to which the simple product is assigned | +
| Price | + Item price in order currency |
+
| Price Including Tax | +Item price including tax in order currency | +
| Product and Custom Options Name | +Name of the product (custom options name) | +
| Refunded Qty | + Number of refunded order items |
+
| SKU | + Product SKU |
+
| Shipped Qty | + Number of shipped order items |
+
| Tax Amount | +Tax amount applied to the row in order currency | +
| Tax Percent | +Tax percent applied to the row | +
| Attribute Name | +Attribute Description | +
|---|---|
| Automatically Return Credit Memo Item to Stock | +Defines whether products can be automatically returned to stock when the refund for an order is created | +
| Backorders | +Defines whether the customer can place the order for products that are out of stock at the moment. Can have the following values: 0 - No Backorders, 1 - Allow Qty Below 0, and 2 - Allow Qty Below 0 and Notify Customer | +
| Can Be Divided into Multiple Boxes for Shipping | + Defines whether the stock items can be divided into multiple boxes for shipping |
+
| Enable Qty Increments | + Defines whether the customer can add products only in increments to the shopping cart |
+
| Item ID | + Stock item ID |
+
| Low Stock Date | + Date when the number of stock items became lower than the number defined in the Notify for Quantity Below option |
+
| Manage Stock | + Choose whether to view and specify the product quantity and availability and whether the product is in stock management. Can have the following values: 0 - No, 1 - Yes |
+
| Maximum Qty Allowed in Shopping Cart | + Maximum number of items in the shopping cart to be sold |
+
| Minimum Qty Allowed in Shopping Cart | + Minimum number of items in the shopping cart to be sold |
+
| Notify for Quantity Below | + The number of inventory items below which the customer will be notified via the RSS feed |
+
| Product ID | + Product ID |
+
| Qty | + Quantity of stock items for the current product |
+
| Qty Increments | + The product quantity increment value |
+
| Qty Uses Decimals | + Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) |
+
| Qty for Item's Status to Become Out of Stock | + Quantity for stock items to become out of stock |
+
| Stock Availability | + Defines whether the product is available for selling. Can have the following values: 0 - Out of Stock, 1 - In Stock |
+
| Stock ID | + Stock ID |
+
| Use Config Settings for Backorders | + Choose whether the Config settings will be applied for the Backorders option |
+
| Use Config Settings for Enable Qty Increments | + Choose whether the Config settings will be applied for the Enable Qty Increments option |
+
| Use Config Settings for Manage Stock | + Choose whether the Config settings will be applied for the Manage Stock option |
+
| Use Config Settings for Maximum Qty Allowed in Shopping Cart | + Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option |
+
| Use Config Settings for Minimum Qty Allowed in Shopping Cart | + Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option |
+
| Use Config Settings for Notify for Quantity Below | + Choose whether the Config settings will be applied for the Notify for Quantity Below option |
+
| Use Config Settings for Qty Increments | + Choose whether the Config settings will be applied for the Qty Increments option |
+
| Use Config Settings for Qty for Item's Status to Become Out of Stock | + Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock option |
+
Notes: The Admin user type has restrictions concerning the WRITE operations for definite stock item attributes. These are as follows:
+ +| Attribute Name | +Admin | +
|---|---|
| Item ID | +No | +
| Product ID | +No | +
| Stock ID | +No | +
| Low Stock Date | +No | +
However, these attributes are available for READ operations.
+ + + +| Attribute Name | +Attribute Description | +
|---|---|
| Customer ID | +Customer ID | +
| Last Logged In | +Date when the customer was logged in last | +
| Is Confirmed | +Defines whether the email confirmation is sent to the customer | +
| Created At | +Date when the customer was created | +
| Associate to Website | +Website ID to which the customer is associated | +
| Created From | +Store view from which the customer was created | +
| Group | +Customer group ID | +
| Disable automatic group change | +Defines whether the automatic group change will be applied to the customer | +
| Prefix | +Customer prefix | +
| First Name | +Customer first name | +
| Middle Name/Initial | +Customer middle name or initial | +
| Last Name | +Customer last name | +
| Suffix | +Customer suffix | +
| Customer email address | +|
| Date Of Birth | +Customer date of birth | +
| Tax/VAT Number | +Customer tax or VAT number | +
| Gender | +Customer gender (male or female) | +
| Attribute Name | +Attribute Description | +
|---|---|
| City | +City name | +
| Company | +Company name | +
| Country | +Country | +
| Customer Address ID | +Customer address ID | +
| Fax | +Fax number | +
| First Name | +Customer first name | +
| Is Default Billing Address | +Defines whether the address is a default one for billing | +
| Is Default Shipping Address | +Defines whether the address is a default one for shipping | +
| Last Name | +Customer last name | +
| Middle Name/Initial | +Customer middle name or initial | +
| Prefix | +Customer prefix | +
| State/Province | +Customer state/region | +
| Street Address | +Customer street address | +
| Suffix | +Customer suffix | +
| Telephone | +Customer phone number | +
| VAT Number | +Customer VAT number | +
| ZIP/Postal Code | +Customer ZIP or postal code | +
Attributes for the product resource are divided into those available for the Admin type of user and those available for the Customer and Guest types of user.
+ + +| Attribute Name | +Attribute Description | +Notes | +
|---|---|---|
| Product ID | +Product ID | +Available only for Admin | +
| name | +Product Name | ++ |
| Product Type | +Product type. Can have the following values: Simple, Grouped, Configurable, Virtual, Bundle, or Downloadable | ++ |
| Attribute Set Name | +Name of the attribute set which the product is based on | + Available only for Admin |
+
| sku |
+Product SKU | ++ |
| price | +Product price | ++ |
| visibility | +Product visibility in the store. Can have the following values: Catalog, Search; Search; Catalog; Not Visible Individually | + Available only for Admin |
+
| description | +Product description | ++ |
| short_description | +Product short description | ++ |
| weight | +Product weight | + Available only for Admin |
+
| news_from_date | +Date starting from which the product is promoted as a new product | + Available only for Admin |
+
| news_to_date | +Date till which the product is promoted as a new product | + Available only for Admin |
+
| status | +Product status in the store. Can have the following values: Enabled or Disabled | + Available only for Admin |
+
| url_key | +A friendly URL path for the product | + Available only for Admin |
+
| Create Permanent Redirect for Old URL | +Defines whether the redirect to an original URL will be applied (when the existing URL for a product is edited) | + Available only for Admin; available only for product update |
+
| country_of_manufacture | +Product country of manufacture | + Available only for Admin |
+
| is_returnable | +Defines whether the product can be returned | + Available only for Admin |
+
| special_price | +Product special price | + Available only for Admin |
+
| special_from_date | +Date starting from which the special price will be applied for the product | + Available only for Admin |
+
| special_to_date | +Date till which the special price will be applied for the product | + Available only for Admin |
+
| group_price | +Product group price | + Available only for Admin |
+
| tier_price | +Product tier price | ++ |
| msrp_enabled | +The Apply MAP option. Defines whether the price in the catalog in the frontend is substituted with a Click for price link | + Available only for Admin |
+
| msrp_display_actual_price_type | +Defines how the price will be displayed in the frontend. Can have the following values: In Cart, Before Order Confirmation, and On Gesture | + Available only for Admin |
+
| msrp | +The Manufacturer's Suggested Retail Price option. The price that a manufacturer suggests to sell the product at | + Available only for Admin |
+
| enable_googlecheckout | +Defines whether the product can be purchased with the help of the Google Checkout payment service. Can have the following values: Yes and No | + Available only for Admin |
+
| tax_class_id | +The product tax class to which the product will be associated | + Available only for Admin |
+
| meta_title | +Product meta title | ++ |
| meta_keyword | +Product meta keywords | ++ |
| meta_description | +Product meta description | ++ |
| custom_design | +Custom design applied for the product page | + Available only for Admin |
+
| custom_design_from | +Date starting from which the custom design will be applied for the product page | + Available only for Admin |
+
| custom_design_to | +Date till which the custom design will be applied for the product page | + Available only for Admin |
+
| custom_layout_update | +An XML block to alter the page layout | + Available only for Admin |
+
| page_layout | +Page template that can be applied to the product page | + Available only for Admin |
+
| options_container | +Defines how the custom options for the product will be displayed. Can have the following values: Block after Info Column or Product Info Column | + Available only for Admin |
+
| gift_message_available | +Defines whether the gift message is available for the product | + Available only for Admin |
+
| Use Config Settings for Allow Gift Message | +Defines whether the configuration settings will be used for the Allow Gift Message option | + Available only for Admin |
+
| gift_wrapping_available | +Defines whether the gift wrapping is available for the product | +Available only for Admin. This attribute is available in Magento EE | +
| Use Config Settings for Allow Gift Wrapping | +Defines whether the configuration settings will be used for the Allow Gift Wrapping option | + Available only for Admin. This attribute is available in Magento EE |
+
| gift_wrapping_price | +Price for the gift wrapping (available in Magento EE) | + Available only for Admin |
+
| Inventory Data | +Product inventory data | + Available only for Admin |
+
| Custom attr | +Product custom attributes | +The customer can see only attributes that are set as visible on frontend | +
| Regular Price | +The original product price displayed in the frontend | + Available only for Customer and Guest |
+
| Final Price | +The final product price | + Available only for Customer and Guest |
+
| Final Price with Tax |
+The final product price with tax | + Available only for Customer and Guest |
+
| Final Price Without Tax |
+The final product price without tax | + Available only for Customer and Guest |
+
| Stock Status |
+The product stock status (availability) | + Available only for Customer and Guest |
+
| Product Is Saleable |
+Defines whether the product can be sold | + Available only for Customer and Guest |
+
| Total Reviews Number |
+The number of all reviews for a product | + Available only for Customer and Guest |
+
| Product URL Link |
+A link to the product without the assigned category | + Available only for Customer and Guest |
+
| Buy Now Link |
+A link that adds a product to the shopping cart | + Available only for Customer and Guest |
+
| Product Has Custom Options |
+Defines whether the product has custom options or not | + Available only for Customer and Guest |
+
| Default Product Image |
+Default product image | +Available only for Customer and Guest | +
| Attribute Name | +Attribute Description | +
|---|---|
| Category ID | +ID of the category to which the product is assigned | +
| Attribute Name | +Attribute Description | +Notes | +
|---|---|---|
| Exclude | +Defines whether the image will associate only to one of the three image types. | ++ |
| ID | +Image file ID | +Available only for READ operations | +
| Label | + A label that will be displayed on the frontend when pointing to the image |
++ |
| Position | + The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. |
++ |
| Type | +Image type. Can have the following values: Base Image, Small Image, or Thumbnail. | ++ |
| URL | +Image file URL path | + Available only for READ operations |
+
| File Content | +Image file content (base_64 encoded) | +Available only for WRITE operations | +
| File MIME Type | +File MIME type. Can have the following values: image/jpeg, image/png, image/gif, etc. | + Available only for WRITE operations |
+
| File Name | +Image file name | + Available only for WRITE operations |
+
After the authentication is complete successfully, the Access Token is received and will be used in every API call. This key allows identifying the client that accesses the API. With the help of this key, the following information about the user can be retrieved:
+ +There is a three-level authorization approach in Magento REST API. These three levels are as follows:
+The following graphic describes the default rights for each access level with each level obtaining more rights up to Admin who has access to everything.
+ +
+
+
+Each user type will be described below.
+Magento grants permissions for the following three types of users:
Guest
+ +Guest can be a type of application that does not require authentication. This application has access only to public resources.
+ +Customer
+ +Customer can be a registered and logged in user. This type of user can have access only to its own resources as well as to public resources.
+ +Admin
+ +Admin can be the store owner. This type has full set of permissions.
+ +Understanding of access levels is the basis of the ACL work.
+ +Every user has a specific role and purpose. To accomplish their goals, each user must be able to access certain resources and perform specific actions. Allowing users to access the resources without any limits can compromise Magento security.
+ +The Access Control List (ACL) is a set of permissions (access rights) that particular users have for certain resources. When a user wants to perform a specific action with a resource (for example, update the customer information), Magento checks the permission for this combination of user, resource, and action. If the action is allowed, the user can proceed. Otherwise, the action is denied.
+ +Access control lists include two main things: a subject and an object. Usually, the subject is the user who wants to use the resource. The object is the resource that a certain user wants to have access to. So, ACL is used to decide when the subject can have access to object.
+ +You should remember that ACL is not the same as authentication. ACL is the next step after the authentication is passed successfully. These two concepts are closely connected but the difference lies in the following: authentication is understanding who the user is and ACL is understanding what the user can do.
+ + + +ACL is implemented in a tree structure. There is a tree of resources for each user type. Namely, Admin, Customer, and Guest have their own trees of resources.
+Each ACL entry specifies two instances: a subject and an action the subject can perform.
Example of the resource tree for the Admin role is as follows:
+
All REST resource attributes are divided into two categories: Read and Write. The Read category includes the operation of retrieving. So, when selecting the attributes in the Read category, you specify them for the resource retrieving. The Write category includes the operations of creating and updating. So, when selecting the attributes in the Write category, you specify them for the resource creation and updating. To illustrate the situation, let's take the following example:
+
Setting up ACL is performed on two levels:
+ + + +REST roles in Magento are used to limit access to certain resources. Limiting access lies in configuration of a REST role and assigning a user to it. You can select which resources will be available for the user and which will not.
+ +REST roles management consists in the role creation, editing, deleting, and user assignment. Note that REST role creation and deletion is available only for Admin role.
+ +The REST Roles page initially includes two roles: Customer and Guest.
+ +Only API Resources can be edited in the Guest and Customer roles. You cannot change the name or assigned users in these roles. Also, you cannot delete the Guest or Customer role. For example, when editing the Guest Role, the page looks as follows:
+
To view the list of REST roles, perform the following steps:
+To add a new REST role for Admin, perform the following steps:
+ +To edit an existing Admin REST role, perform the following steps:
+To delete an existing Admin REST role, perform the following steps:
+To assign a REST role to admin, perform the following steps:
+To assign more than one user to an existing Admin REST role, perform the following steps:
+To view the list of users assigned to a REST role, perform the following steps:
+To unassign the Admin REST role from a user, perform the following steps:
+As it has been mentioned before, the Customer and Guest roles cannot be removed and can be only partially edited. You can edit only the resources and actions allowed for the user.
+ +To edit the Guest REST role, perform the following steps:
+To edit the Customer REST role, perform the following steps:
+If you make a Magento API call, you are guaranteed to receive some kind of a response. If you make a successful call, you will receive an HTTP response with a 200 OK status.
+ +You can view the response data from any Magento API call in one of the following two formats:
+ +The format of returned data is defined in the request header. The format you choose depends on what you are familiar with most or tools available to you.
+ + +The XML response format is a simple XML block.
+To set the response format to XML, add the Accept request header with the text/xml value.
A successful call will return the following response (example of retrieving information about stock items):
+ +<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>1</item_id> + <product_id>1</product_id> + <stock_id>1</stock_id> + <qty>99.0000</qty> + <low_stock_date></low_stock_date> + </data_item> + <data_item> + <item_id>2</item_id> + <product_id>2</product_id> + <stock_id>1</stock_id> + <qty>100.0000</qty> + <low_stock_date></low_stock_date> + </data_item> +</magento_api>+
If an error occurs, the call may return the following response:
+ +<?xml version="1.0"?> +<magento_api> + <messages> + <error> + <data_item> + <code>404</code> + <message>Resource not found.</message> + </data_item> + </error> + </messages> +</magento_api>+
JSON (JavaScript Object Notation) is a lightweight data-interchange format.
+To set the response format to JSON, add the Accept request header with the application/json value.
The JSON objects represent a direct mapping of the XML block from the XML response format.
+ +A simple XML error
+ +<messages> + <error> + <data_item> + <code>404</code> + <message>Resource not found.</message> + </data_item> + </error> + </messages>+
will be transformed to
+ +{"messages":{"error":[{"code":404,"message":"Resource not found."}]}}
+ A successful API call to the Stock Items resource will return the following XML response:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>1</item_id> + <product_id>1</product_id> + <stock_id>1</stock_id> + <qty>99.0000</qty> + <low_stock_date></low_stock_date> + </data_item> + <data_item> + <item_id>2</item_id> + <product_id>2</product_id> + <stock_id>1</stock_id> + <qty>100.0000</qty> + <low_stock_date></low_stock_date> + </data_item> +</magento_api>+
The JSON equivalent will be as follows:
+[{"item_id":"1","product_id":"1","stock_id":"1","qty":"99.0000","low_stock_date":null},{"item_id":"2","product_id":"2","stock_id":"1","qty":"100.0000","low_stock_date":null}]
+ The list of HTTP status codes that are returned in the API response is described in the Common HTTP Status Codes part of the documentation. There, you can find the list of codes themselves together with their description.
+ + + diff --git a/guides/v1.8/api/rest/testing_rest_resources.html b/guides/v1.8/api/rest/testing_rest_resources.html new file mode 100644 index 0000000000..c57b136bfa --- /dev/null +++ b/guides/v1.8/api/rest/testing_rest_resources.html @@ -0,0 +1,170 @@ +--- +layout: v1x_rest +title: Testing REST Resources +--- + +Three steps are required for utilizing REST API resources:
+The following headers are required for the call:
+The following parameters must be provided in the Authorization header for the call:
+
+
+ An authorization header is created on the main page of REST Client.
+
+
+ 

Example: Retrieving the List of Products
+ +



+ Example: Retrieving the list of customers
+ +
Example: Creating a customer address
+ +
Welcome to the Magento 1.x SOAP API home page.
+ +The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage categories and how products are assigned to categories.
+ +Resource Name: catalog_category
+ +Aliases:
+Methods:
+Allows you to retrieve the list of category attributes and options.
+ +Resource Name: catalog_category_attribute
+ +Aliases:
+Methods:
+Allows you to manage products.
+ +Resource Name: catalog_product
+ +Aliases:
+Methods:
+Allows you to retrieve product attributes and options.
+ +Resource Name: catalog_product_attribute
+ +Aliases:
+Methods:
+Allows you to retrieve product attribute sets.
+ +Resource Name: catalog_product_attribute_set
+ +Aliases:
+Methods:
+Allows you to retrieve product types.
+ +Resource Name: catalog_product_type
+ +Aliases:
+Methods:
+Allows you to manage product images.
+ +Resource Name: catalog_product_attribute_media
+ +Aliases:
+Methods:
+Allows you to retrieve and update product tier prices.
+ +Resource Name: catalog_product_attribute_tier_price
+ +Aliases:
+Methods:
+Allows you to manage links for products, including related, cross-sells, up-sells, and grouped.
+ +Resource Name: catalog_product_link
+ +Aliases:
+Methods:
+Allows you to add, remove, and retrieve a link to a downloadable product.
+ +Resource Name: product_downloadable_link
+ + +Allows you to add, update, remove, and retrieve product tags.
+ +Resource Name: catalog_product_tag
+ +Aliases:
+Allows you to manage product custom options, including adding, updating, removing, and retrieving information.
+ +Resource Name: catalog_product_custom_option
+ +Aliases:
+Allows you to manage product custom option values, including adding, updating, removing, and retrieving information.
+ +Resource Name: catalog_product_custom_option_value
+ +Aliases:
+The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage categories and how products are assigned to categories.
+ +Resource Name: catalog_category
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Requested website not found. | +
| 102 | +Category not exists. | +
| 103 | +Invalid data given. Details in error message. | +
| 104 | +Category not moved. Details in error message. | +
| 105 | +Category not deleted. Details in error message. | +
| 106 | +Requested product is not assigned to category. | +
function getSomeRandomCategory(&$categories, $targetLevel, $currentLevel = 0) {
+ if (count($categories)==0) {
+ return false;
+ }
+ if ($targetLevel == $currentLevel) {
+ return $categories[array_rand($categories)];
+ } else {
+ return getSomeRandomCategory($categories[array_rand($categories)]['children'], $targetLevel + 1);
+ }
+}
+
+$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$allCategories = $proxy->call($sessionId, 'category.tree'); // Get all categories.
+
+// select random category from tree
+while (($selectedCategory = getSomeRandomCategory($allCategories, 3)) === false) {}
+
+// create new category
+$newCategoryId = $proxy->call(
+ $sessionId,
+ 'category.create',
+ array(
+ $selectedCategory['category_id'],
+ array(
+ 'name'=>'Newopenerp',
+ 'is_active'=>1,
+ 'include_in_menu'=>2,
+ 'available_sort_by'=>'position',
+ 'default_sort_by'=>'position'
+ )
+ )
+);
+
+$newData = array('is_active'=>1);
+// update created category on German store view
+$proxy->call($sessionId, 'category.update', array($newCategoryId, $newData, 'german'));
+
+$firstLevel = $proxy->call($sessionId, 'category.level', array(null, 'german', $selectedCategory['category_id']));
+
+var_dump($firstLevel);
+
+// If you wish remove category, uncomment next line
+//$proxy->call($sessionId, 'category.delete', $newCategoryId);
+ $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$categoryId = 5; // Put here your category id
+$storeId = 1; // You can add store level
+
+$assignedProducts = $proxy->call($sessionId, 'category.assignedProducts', array($categoryId, $storeId));
+var_dump($assignedProducts); // Will output assigned products.
+
+// Assign product
+$proxy->call($sessionId, 'category.assignProduct', array($categoryId, 'someProductSku', 5));
+
+// Update product assignment position
+$proxy->call($sessionId, 'category.updateProduct', array($categoryId, 'someProductSku', 25));
+
+// Remove product assignment
+$proxy->call($sessionId, 'category.removeProduct', array($categoryId, 'someProductSku'));
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Assign a product to the required category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category | +
| string | +product/productId | +ID or SKU of the product to be assigned to the category | +
| string | +position | +Position of the assigned product in the category (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' argument | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is assigned to the specified category | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.assignProduct', array('categoryId' => '4', 'product' => '1'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAssignProduct($sessionId, '4', '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryAssignProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '5', 'productId' => '1', 'position' => '5'));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Retrieve the list of products assigned to a required category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the required category | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAssignedProduct | +
The catalogAssignedProduct content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +product_id | +ID of the assigned product | +
| string | +type | +Product type | +
| int | +set | +Attribute set ID | +
| string | +sku | +Product SKU | +
| int | +position | +Position of the assigned product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.assignedProducts', '4');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAssignedProducts($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryAssignedProducts((object)array('sessionId' => $sessionId->result, 'categoryId' => '4'));
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '1' (length=1) + 'type' => string 'simple' (length=6) + 'set' => string '4' (length=1) + 'sku' => string 'n2610' (length=5) + 'position' => string '1' (length=1) + 1 => + array + 'product_id' => string '2' (length=1) + 'type' => string 'simple' (length=6) + 'set' => string '4' (length=1) + 'sku' => string 'b8100' (length=5) + 'position' => string '1' (length=1)+
The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Create a new category and return its ID.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +parentId | +Parent category ID | +
| array | +categoryData | +Array of catalogCategoryEntityCreate | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + attribute_id |
+ID of the created category | +
The categoryData content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +name | +Name of the created category | +
| int | +is_active | +Defines whether the category will be visible in the frontend | +
| int | +position | +Position of the created category (optional) | +
| ArrayOfString | +available_sort_by | +All available options by which products in the category can be sorted | +
| string | +custom_design | +The custom design for the category (optional) | +
| int | + custom_apply_to_products |
+Apply the custom design to all products assigned to the category (optional) | +
| string | +custom_design_from | +Date starting from which the custom design will be applied to the category (optional) | +
| string | +custom_design_to | +Date till which the custom design will be applied to the category (optional) | +
| string | +custom_layout_update | +Custom layout update (optional) | +
| string | +default_sort_by | +The default option by which products in the category are sorted | +
| string | +description | +Category description (optional) | +
| string | +display_mode | +Content that will be displayed on the category view page (optional) | +
| int | +is_anchor | +Defines whether the category will be anchored (optional) | +
| int | +landing_page | +Landing page (optional) | +
| string | +meta_description | +Category meta description (optional) | +
| string | +meta_keywords | +Category meta keywords (optional) | +
| string | +meta_title | +Category meta title (optional) | +
| string | +page_layout | +Type of page layout that the category should use (optional) | +
| string | +url_key | +A relative URL path which can be entered in place of the standard target path (optional) | +
| int | +include_in_menu | +Defines whether the category is visible on the top menu bar | +
| string | +filter_price_range | + Price range of each price level displayed in the layered navigation block (optional) |
+
| int | + custom_use_parent_settings |
+ Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No (optional) |
+
Notes: The position parameter is deprecated, the category will be positioned anyway in the end of the list and you can not set the position directly. You should use the catalog_category.move method instead. You cannot also assign a root category to the specified store.
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session, 'catalog_category.create', array(2, array(
+ 'name' => 'Category name',
+ 'is_active' => 1,
+ 'position' => 1,
+ //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
+ //and you can not set position directly, use catalog_category.move instead -->
+ 'available_sort_by' => 'position',
+ 'custom_design' => null,
+ 'custom_apply_to_products' => null,
+ 'custom_design_from' => null,
+ 'custom_design_to' => null,
+ 'custom_layout_update' => null,
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'display_mode' => null,
+ 'is_anchor' => 0,
+ 'landing_page' => null,
+ 'meta_description' => 'Category meta description',
+ 'meta_keywords' => 'Category meta keywords',
+ 'meta_title' => 'Category meta title',
+ 'page_layout' => 'two_columns_left',
+ 'url_key' => 'url-key',
+ 'include_in_menu' => 1,
+)));
+
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->catalogCategoryCreate($session, 2, array(
+ 'name' => 'Category name 2',
+ 'is_active' => 1,
+ 'position' => 1,
+ //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
+ //and you can not set position directly, use catalog_category.move instead -->
+ 'available_sort_by' => array('position'),
+ 'custom_design' => null,
+ 'custom_apply_to_products' => null,
+ 'custom_design_from' => null,
+ 'custom_design_to' => null,
+ 'custom_layout_update' => null,
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'display_mode' => null,
+ 'is_anchor' => 0,
+ 'landing_page' => null,
+ 'meta_description' => 'Category meta description',
+ 'meta_keywords' => 'Category meta keywords',
+ 'meta_title' => 'Category meta title',
+ 'page_layout' => 'two_columns_left',
+ 'url_key' => 'url-key',
+ 'include_in_menu' => 1,
+));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryCreate((object)array('sessionId' => $sessionId->result, 'parentId' => '5', 'categoryData' => ((object)array(
+ 'name' => 'category',
+ 'is_active' => '1',
+ 'position' => '1',
+ 'available_sort_by' => array('position'),
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'is_anchor' => '1',
+ 'include_in_menu' => '1'
+))));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeView | +Store view ID or code | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'category.currentStore', '1');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryCurrentStore($sessionId, '1');
+var_dump($result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to delete the required category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category to be deleted | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the category is deleted | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.delete', '7');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryDelete($sessionId, '7');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryDelete((object)array('sessionId' => $sessionId->result, 'categoryId' => '7'));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to retrieve information about the required category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +Category ID | +
| string | +storeView | +Store view ID or code (optional) | +
| ArrayOfString | +attributes | +Array of attributes (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +info | +Array of catalogCategoryInfo | +
The catalogCategoryInfo content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + category_id |
+Category ID | +
| int | + is_active |
+Defines whether the category is active | +
| string |
+ position |
+Category position | +
| string |
+ level |
+Category level | +
| string |
+ parent_id |
+Parent category ID | +
| string |
+ all_children |
+All child categories of the current category | +
| string |
+ children |
+Names of direct child categories | +
| string |
+ created_at |
+Date when the category was created | +
| string |
+ updated_at |
+Date when the category was updated | +
| string |
+ name |
+Category name | +
| string |
+ url_key |
+ A relative URL path which can be entered in place of the standard target path (optional) |
+
| string |
+ description |
+Category description | +
| string |
+ meta_title |
+Category meta title | +
| string |
+ meta_keywords |
+Category meta keywords | +
| string |
+ meta_description |
+Category meta description | +
| string |
+ path |
+Path | +
| string |
+ url_path |
+URL path | +
| int | + children_count |
+Number of child categories | +
| string |
+ display_mode |
+ Content that will be displayed on the category view page (optional) |
+
| int | + is_anchor |
+Defines whether the category is anchored | +
| ArrayOfString | + available_sort_by |
+ All available options by which products in the category can be sorted |
+
| string |
+ custom_design |
+ The custom design for the category (optional) |
+
| string |
+ custom_apply_to_products |
+ Apply the custom design to all products assigned to the category (optional) |
+
| string |
+ custom_design_from |
+ Date starting from which the custom design will be applied to the category (optional) |
+
| string |
+ custom_design_to |
+ Date till which the custom design will be applied to the category (optional) |
+
| string |
+ page_layout |
+ Type of page layout that the category should use (optional) |
+
| string |
+ custom_layout_update |
+ Custom layout update (optional) |
+
| string |
+ default_sort_by |
+ The default option by which products in the category are sorted |
+
| int | + landing_page |
+ Landing page (optional) |
+
| int | + include_in_menu |
+ Defines whether the category is available on the Magento top menu bar |
+
| string | + filter_price_range |
+ Price range of each price level displayed in the layered navigation block |
+
| int | + custom_use_parent_settings |
+ Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No |
+
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.info', '5');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryInfo($sessionId, '5');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryInfo((object)array('sessionId' => $sessionId->result, 'categoryId' => '5'));
+var_dump($result->result);
+ array + 'category_id' => string '5' (length=1) + 'is_active' => string '1' (length=1) + 'position' => string '1' (length=1) + 'level' => string '2' (length=1) + 'parent_id' => int 3 + 'increment_id' => null + 'created_at' => string '2012-03-29 12:30:51' (length=19) + 'updated_at' => string '2012-03-29 14:25:08' (length=19) + 'name' => string 'Mobile Phones' (length=13) + 'url_key' => string 'mobile-phones' (length=13) + 'thumbnail' => null + 'description' => string 'Category for cell phones' (length=24) + 'image' => null + 'meta_title' => string 'Cell Phones' (length=11) + 'meta_keywords' => string 'cell, phone' (length=11) + 'meta_description' => null + 'include_in_menu' => string '1' (length=1) + 'path' => string '1/3/4' (length=5) + 'all_children' => string '4' (length=1) + 'path_in_store' => null + 'children' => string '' (length=0) + 'url_path' => string 'mobile-phones.html' (length=18) + 'children_count' => string '0' (length=1) + 'display_mode' => string 'PRODUCTS' (length=8) + 'landing_page' => null + 'is_anchor' => string '1' (length=1) + 'available_sort_by' => null + 'default_sort_by' => null + 'filter_price_range' => null + 'custom_use_parent_settings' => string '1' (length=1) + 'custom_apply_to_products' => null + 'custom_design' => null + 'custom_design_from' => null + 'custom_design_to' => null + 'page_layout' => null + 'custom_layout_update' => null+
The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to retrieve one level of categories by a website, a store view, or a parent category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +website | +Website ID or code (optional) | +
| string | +storeView | +Store view ID or code (optional) | +
| string | +parentCategory | +Parent category ID (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +tree | +Array of CatalogCategoryEntitiesNoChildren | +
The CatalogCategoryEntitityNoChildren content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + category_id |
+Category ID | +
| int | + parent_id |
+Parent category ID | +
| string | + name |
+Category name | +
| int | + is_active |
+Defines whether the category is active | +
| int | + position |
+Category position | +
| int | + level |
+Category level | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.level');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryLevel($sessionId);
+var_dump($result);
+ array + 0 => + array + 'category_id' => string '2' (length=1) + 'parent_id' => int 1 + 'name' => string 'Default Category' (length=16) + 'is_active' => string '1' (length=1) + 'position' => string '1' (length=1) + 'level' => string '1' (length=1) + 1 => + array + 'category_id' => string '3' (length=1) + 'parent_id' => int 1 + 'name' => string 'root_category' (length=13) + 'is_active' => string '1' (length=1) + 'position' => string '2' (length=1) + 'level' => string '1' (length=1)+
The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to move the required category in the category tree.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category to be moved | +
| int | +parentId | +ID of the new parent category | +
| string | +afterId | +ID of the category after which the required category will be moved (optional for V1 and V2) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +id | +True if the category is moved | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.move', array('categoryId' => '4', 'parentId' => '3'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryMove($sessionId, '4', '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryMove((object)array('sessionId' => $sessionId->result, 'categoryId' => '19', 'parentId' => '8', 'afterId' => '4'));
+var_dump($result->result);
+ Note: Please make sure that you are not moving the category to any of its own children. There are no extra checks to prevent doing it through API, and you won’t be able to fix this from the admin interface later.
+ + + diff --git a/guides/v1.8/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html b/guides/v1.8/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html new file mode 100644 index 0000000000..851886603f --- /dev/null +++ b/guides/v1.8/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html @@ -0,0 +1,129 @@ +--- +layout: v1x_soap +title: Remove Product +--- + + + +The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to remove the product assignment from the category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +Category ID | +
| string | +productId | +ID or SKU of the product to be removed from the category | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is removed from the category | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.removeProduct', array('categoryId' => '4', 'product' => '3'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryRemoveProduct($sessionId, '4', '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryRemoveProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '4', 'productId' => '3'));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to retrieve the hierarchical tree of categories.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +parentId | +ID of the parent category (optional) | +
| string | +storeView | +Store view (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +tree | +Array of catalogCategoryTree | +
The catalogCategoryTree content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +category_id | +Category ID | +
| int | + parent_id |
+Parent category ID | +
| string | + name |
+Category name | +
| int | + position |
+Category position | +
| int | + level |
+Category level | +
| array | + children |
+Array of CatalogCategoryEntities | +
The catalogCategoryEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + category_id |
+Category ID | +
| int | + parent_id |
+Parent category ID | +
| string | + name |
+Category name | +
| int | + is_active |
+defines whether the category is active | +
| int | + position |
+Category position | +
| int | + level |
+Category level | +
| array | + children |
+Array of CatalogCategoryEntities | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.tree');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryTree($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryTree((object)array('sessionId' => $sessionId->result, 'parentId' => '15'));
+var_dump($result->result);
+ array + 'category_id' => string '1' (length=1) + 'parent_id' => string '0' (length=1) + 'name' => string 'Root Catalog' (length=12) + 'is_active' => null + 'position' => string '0' (length=1) + 'level' => string '0' (length=1) + 'children' => + array + 0 => + array + 'category_id' => string '2' (length=1) + 'parent_id' => string '1' (length=1) + 'name' => string 'Default Category' (length=16) + 'is_active' => string '1' (length=1) + 'position' => string '1' (length=1) + 'level' => string '1' (length=1) + 'children' => + array + ... + 1 => + array + 'category_id' => string '3' (length=1) + 'parent_id' => string '1' (length=1) + 'name' => string 'root_category' (length=13) + 'is_active' => string '1' (length=1) + 'position' => string '2' (length=1) + 'level' => string '1' (length=1) + 'children' => + array + ...+
The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Update the required category. Note that you should specify only those parameters which you want to be updated.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category to be updated | +
| array | +categoryData | +An array of catalogCategoryEntityCreate | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the category is updated | +
The catalogCategoryEntityCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +name | + Name of the category to be updated |
+
| int | +is_active | + Defines whether the category is visible in the frontend |
+
| int | +position | + Position of the category to be updated |
+
| arrayOfString |
+ available_sort_by |
+ All available options by which products in the category can be sorted |
+
| string |
+ custom_design |
+ The custom design for the category |
+
| int |
+ custom_apply_to_products |
+ Apply the custom design to all products assigned to the category |
+
| string |
+ custom_design_from |
+ Date starting from which the custom design will be applied to the category |
+
| string |
+ custom_design_to |
+ Date till which the custom design will be applied to the category |
+
| string |
+ custom_layout_update |
+ Custom layout update |
+
| string |
+ default_sort_by |
+ The default option by which products in the category are sorted |
+
| string |
+ description |
+ Category description |
+
| string |
+ display_mode |
+ Content that will be displayed on the category view page |
+
| int |
+ is_anchor |
+ Defines whether the category will be anchored |
+
| int |
+ landing_page |
+ Landing page |
+
| string |
+ meta_description |
+ Category meta description |
+
| string |
+ meta_keywords |
+ Category meta keywords |
+
| string |
+ meta_title |
+ Category meta title |
+
| string |
+ page_layout |
+ Type of page layout that the category should use |
+
| string |
+ url_key |
+ A relative URL path which can be entered in place of the standard target path |
+
| int |
+ include_in_menu |
+ Defines whether the category is visible on the top menu bar in the frontend |
+
| string | + filter_price_range |
+ Price range of each price level displayed in the layered navigation block |
+
| int | + custom_use_parent_settings |
+ Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No |
+
Faults:
+No Faults
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session, 'catalog_category.update', array(23, array(
+ 'name' => 'Category name',
+ 'is_active' => 1,
+ 'position' => 1,
+ //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
+ //and you can not set position directly, use catalog_category.move instead -->
+ 'available_sort_by' => 'position',
+ 'custom_design' => null,
+ 'custom_apply_to_products' => null,
+ 'custom_design_from' => null,
+ 'custom_design_to' => null,
+ 'custom_layout_update' => null,
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'display_mode' => null,
+ 'is_anchor' => 0,
+ 'landing_page' => null,
+ 'meta_description' => 'Category meta description',
+ 'meta_keywords' => 'Category meta keywords',
+ 'meta_title' => 'Category meta title',
+ 'page_layout' => 'two_columns_left',
+ 'url_key' => 'url-key',
+ 'include_in_menu' => 1,
+)));
+
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->catalogCategoryUpdate($session, 23, array(
+ 'name' => 'Category name 2',
+ 'is_active' => 1,
+ 'position' => 1,
+ //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
+ //and you can not set position directly, use catalog_category.move instead -->
+ 'available_sort_by' => array('position'),
+ 'custom_design' => null,
+ 'custom_apply_to_products' => null,
+ 'custom_design_from' => null,
+ 'custom_design_to' => null,
+ 'custom_layout_update' => null,
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'display_mode' => null,
+ 'is_anchor' => 0,
+ 'landing_page' => null,
+ 'meta_description' => 'Category meta description',
+ 'meta_keywords' => 'Category meta keywords',
+ 'meta_title' => 'Category meta title',
+ 'page_layout' => 'two_columns_left',
+ 'url_key' => 'url-key',
+ 'include_in_menu' => 1,
+));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryUpdate((object)array('sessionId' => $sessionId->result, 'categoryId' => '23', 'categoryData' => ((object)array(
+ 'name' => 'Category Name Updated',
+ 'is_active' => '1',
+ 'position' => '1',
+ 'available_sort_by' => array('name'),
+ 'default_sort_by' => 'name',
+ 'description' => 'Category description',
+ 'is_anchor' => '1',
+ 'include_in_menu' => '1'
+))));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to update the product assigned to a category. The product position is updated.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category to which the product is assigned | +
| string | +productId | +ID or SKU of the product to be updated | +
| string | +position | +Position of the product in the category (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is updated in the category | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.updateProduct', array('categoryId' => '4', 'product' => '1', 'position' => '3'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryUpdateProduct($sessionId, '4', '1', '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryUpdateProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '4', 'productId' => '1', 'position' => '3'));
+var_dump($result->result);
+ Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeView | +Store view ID or code | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category_attribute.currentStore', 'english');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAttributeCurrentStore($sessionId, 'english');
+var_dump($result);
+ Aliases:
+Allows you to retrieve the list of category attributes.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeEntity | +
The catalogAttributeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + attribute_id |
+Attribute ID | +
| string | + code |
+Attribute code | +
| string |
+ type |
+Attribute type | +
| string |
+ required |
+Defines whether the attribute is required | +
| string |
+ scope |
+Attribute scope: global, website, or store | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category_attribute.list',);
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAttributeList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $client->catalogCategoryAttributeList((object)array('sessionId' => $session->result));
+
+var_dump ($result);
+ array + 0 => + array + 'attribute_id' => null + 'code' => string 'parent_id' (length=9) + 'type' => null + 'required' => null + 'scope' => string 'global' (length=6) + 1 => + array + 'attribute_id' => null + 'code' => string 'increment_id' (length=12) + 'type' => null + 'required' => null + 'scope' => string 'global' (length=6) + 2 => + array + 'attribute_id' => null + 'code' => string 'updated_at' (length=10) + 'type' => null + 'required' => null + 'scope' => string 'global' (length=6)+
Aliases:
+Allows you to retrieve the attribute options.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +attributeId | +Attribute ID or code | +
| string | +storeView | +Store view ID or code | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeOptionEntity | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Option label | +
| string | +value | +Option value | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category_attribute.options', '65');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAttributeOptions($sessionId, '65');
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $client->catalogCategoryAttributeOptions((object)array('sessionId' => $session->result, 'attributeId' => '65'));
+
+var_dump ($result);
+ array + 0 => + array + 'label' => string 'Yes' (length=3) + 'value' => int 1 + 1 => + array + 'label' => string 'No' (length=2) + 'value' => int 0+
The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve the list of category attributes and options.
+ +Resource Name: catalog_category_attribute
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Requested attribute not found. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$attributes = $proxy->call($sessionId, 'category_attribute.list');
+foreach ($attributes as &$attribute) {
+ if (isset($attribute['type'])
+ && ($attribute['type'] == 'select' || $attribute['type'] == 'multiselect')) {
+ $attribute['options'] = $proxy->call($sessionId, 'category_attribute.options', $attribute['code']);
+ }
+}
+var_dump($attributes);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage products.
+ +Resource Name: catalog_product
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Product not exists. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Product not deleted. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$filters = array(
+ 'sku' => array('like'=>'zol%')
+);
+
+$products = $proxy->call($sessionId, 'product.list', array($filters));
+
+var_dump($products);
+ $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeSets = $proxy->call($sessionId, 'product_attribute_set.list');
+$set = current($attributeSets);
+
+
+$newProductData = array(
+ 'name' => 'name of product',
+ // websites - Array of website ids to which you want to assign a new product
+ 'websites' => array(1), // array(1,2,3,...)
+ 'short_description' => 'short description',
+ 'description' => 'description',
+ 'status' => 1,
+ 'weight' => 0,
+ 'tax_class_id' => 1,
+ 'categories' => array(3), //3 is the category id
+ 'price' => 12.05
+);
+
+// Create new product
+$proxy->call($sessionId, 'product.create', array('simple', $set['set_id'], 'sku_of_product', $newProductData));
+$proxy->call($sessionId, 'product_stock.update', array('sku_of_product', array('qty'=>50, 'is_in_stock'=>1)));
+
+// Get info of created product
+var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
+
+// Update product name on german store view
+$proxy->call($sessionId, 'product.update', array('sku_of_product', array('name'=>'new name of product'), 'german'));
+
+// Get info for default values
+var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
+// Get info for german store view
+
+var_dump($proxy->call($sessionId, 'product.info', array('sku_of_product', 'german')));
+
+// Delete product
+$proxy->call($sessionId, 'product.delete', 'sku_of_product');
+
+try {
+ // Ensure that product deleted
+ var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
+} catch (SoapFault $e) {
+ echo "Product already deleted";
+}
+ Aliases:
+Allows you to create a new product and return ID of the created product.
+ +Aliases:
+Note:
+Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ type |
+Product type | +
| string |
+ set |
+ID of the product attribute set | +
| string |
+ sku |
+Product SKU | +
| array | + productData |
+Array of catalogProductCreateEntity | +
| string | +storeView | +Store view ID or code | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created product | +
The catalogProductCreateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString | + categories |
+Array of categories | +
| ArrayOfString |
+ websites |
+Array of websites | +
| string | + name |
+Product name | +
| string |
+ description |
+Product description | +
| string |
+ short_description |
+Product short description | +
| string |
+ weight |
+Product weight | +
| string |
+ status |
+Product status | +
| string |
+ url_key |
+URL key | +
| string |
+ url_path |
+URL path | +
| string |
+ visibility |
+Product visibility on the frontend | +
| ArrayOfString |
+ category_ids |
+Array of category IDs | +
| ArrayOfString |
+ website_ids |
+Array of website IDs | +
| string |
+ has_options |
+Defines whether the product has options | +
| string |
+ gift_message_available |
+Defines whether the gift message is available for the product | +
| string |
+ price |
+Product price | +
| string |
+ special_price |
+Product special price | +
| string |
+ special_from_date |
+Date starting from which the special price will be applied to the product | +
| string |
+ special_to_date |
+Date till which the special price will be applied to the product | +
| string |
+ tax_class_id |
+Tax class ID | +
| array | + tier_price |
+Array of catalogProductTierPriceEntity | +
| string |
+ meta_title |
+Meta title | +
| string |
+ meta_keyword |
+Meta keyword | +
| string |
+ meta_description |
+Meta description | +
| string |
+ custom_design |
+Custom design | +
| string |
+ custom_layout_update |
+Custom layout update | +
| string |
+ options_container |
+Options container | +
| array |
+ additional_attributes |
+Array of catalogProductAdditionalAttributesEntity | +
| array | + stock_data |
+ Array of catalogInventoryStockItemUpdateEntity |
+
Notes: The "websites" and "website_ids" or "categories" and "category_ids" parameters are interchangeable. In other words, you can specify an array of website IDs (int) and then you don't need to specify the array of website codes (string) and vice versa.
+ +The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+Customer group ID | +
| string | + website |
+Website | +
| int | + qty |
+Quantity | +
| double | + price |
+Tier price | +
The catalogInventoryStockItemUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + qty |
+Quantity of items | +
| int | + is_in_stock |
+Defines whether the item is in stock | +
| int |
+ manage_stock |
+Manage stock | +
| int |
+ use_config_manage_stock |
+Use config manage stock | +
| int |
+ min_qty |
+Minimum quantity for items to be in stock | +
| int |
+ use_config_min_qty |
+Use config settings flag (value defined in the Inventory System Configuration) | +
| int |
+ min_sale_qty |
+Minimum quantity allowed in the shopping cart | +
| int |
+ use_config_min_sale_qty |
+Use config settings flag | +
| int |
+ max_sale_qty |
+Maximum quantity allowed in the shopping cart | +
| int |
+ use_config_max_sale_qty |
+Use config settings flag | +
| int |
+ is_qty_decimal |
+Defines whether the quantity is decimal | +
| int |
+ backorders |
+Backorders status | +
| int |
+ use_config_backorders |
+Use config settings flag (for backorders) | +
| int |
+ notify_stock_qty |
+Stock quantity below which a notification will appear | +
| int |
+ use_config_notify_stock_qty |
+Use config settings flag (for stock quantity) | +
The catalogProductAdditionalAttributesEntity content is as follows:
+ + +| Type | +Name | +
|---|---|
| associativeMultiArray | +multi_data | +
| associativeArray | +single_data | +
Single Data: array of attributes with only single value
+Multi Data: array of attributes which could contain several values
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 102 | +Invalid data given. Details in error message. | +
| 104 | +Product type is not in allowed types. | +
| 105 | +Product attribute set is not existed | +
| 106 | +Product attribute set is not belong catalog product entity type | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+// get attribute set
+$attributeSets = $client->call($session, 'product_attribute_set.list');
+$attributeSet = current($attributeSets);
+
+
+$result = $client->call($session, 'catalog_product.create', array('simple', $attributeSet['set_id'], 'product_sku', array(
+ 'categories' => array(2),
+ 'websites' => array(1),
+ 'name' => 'Product name',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'url_key' => 'product-url-key',
+ 'url_path' => 'product-url-path',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+ 'meta_title' => 'Product meta title',
+ 'meta_keyword' => 'Product meta keyword',
+ 'meta_description' => 'Product meta description'
+)));
+
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+// get attribute set
+$attributeSets = $client->catalogProductAttributeSetList($session);
+$attributeSet = current($attributeSets);
+
+$result = $client->catalogProductCreate($session, 'simple', $attributeSet->set_id, 'product_sku', array(
+ 'categories' => array(2),
+ 'websites' => array(1),
+ 'name' => 'Product name',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'url_key' => 'product-url-key',
+ 'url_path' => 'product-url-path',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+ 'meta_title' => 'Product meta title',
+ 'meta_keyword' => 'Product meta keyword',
+ 'meta_description' => 'Product meta description'
+));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCreate((object)array('sessionId' => $sessionId->result, 'type' => 'simple', 'set' => '4', 'sku' => 'simple_sku',
+'productData' => ((object)array(
+ 'name' => 'Product name',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+))));
+
+var_dump($result->result);
+ Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int/string | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.currentStore', 'english');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCurrentStore($sessionId, 'english');
+var_dump($result);
+ Aliases:
+Allows you to delete the required product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + product\productId |
+Product ID or SKU | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean/int | +result | +True (1) if the product is deleted | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.delete', '6');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductDelete($sessionId, '6');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDelete((object)array('sessionId' => $sessionId->result, 'productId' => '21'));
+var_dump($result->result);
+ Aliases:
+Allows you to get the product special price data.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ storeView |
+Store view ID or code | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductReturnEntity | +
The catalogProductReturnEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ special_price |
+Product special price | +
| string |
+ special_from_date |
+Date starting from which the special price is applied to the product | +
| string |
+ special_to_date |
+Date till which the special price is applied to the product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.getSpecialPrice', '1');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductGetSpecialPrice($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductGetSpecialPrice((object)array('sessionId' => $sessionId->result, 'productId' => '1'));
+var_dump($result->result);
+ array + 'special_price' => string '139.9900' (length=8) + 'special_from_date' => string '2012-03-28 00:00:00' (length=19) + 'special_to_date' => string '2012-03-31 00:00:00' (length=19)+
Aliases:
+Allows you to retrieve information about the required product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | + Description |
+
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +productId | +Product ID or SKU | +
| string | +storeView | +Store view ID or code (optional) | +
| array | +attributes | +Array of catalogProductRequestAttributes (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU value is passed in the "productId" parameter. (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +info | +Array of catalogProductReturnEntity | +
The catalogProductRequestAttributes content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString |
+ attributes |
+Array of attributes | +
| ArrayOfString |
+ additional_attributes |
+Array of additional attributes | +
The catalogProductReturnEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ sku |
+Product SKU | +
| string |
+ set |
+Product set | +
| string |
+ type |
+Product type | +
| ArrayOfString | + categories |
+Array of categories | +
| ArrayOfString | + websites |
+Array of websites | +
| string |
+ created_at |
+Date when the product was created | +
| string |
+ updated_at |
+Date when the product was last updated | +
| string |
+ type_id |
+Type ID | +
| string |
+ name |
+Product name | +
| string |
+ description |
+Product description | +
| string |
+ short_description |
+Short description for a product | +
| string |
+ weight |
+Product weight | +
| string |
+ status |
+Status of a product | +
| string |
+ url_key |
+Relative URL path that can be entered in place of a target path | +
| string |
+ url_path |
+URL path | +
| string |
+ visibility |
+Product visibility on the frontend | +
| ArrayOfString |
+ category_ids |
+Array of category IDs | +
| ArrayOfString |
+ website_ids |
+Array of website IDs | +
| string |
+ has_options |
+Defines whether the product has options | +
| string |
+ gift_message_available |
+Defines whether the gift message is available for the product | +
| string |
+ price |
+Product price | +
| string |
+ special_price |
+Product special price | +
| string |
+ special_from_date |
+Date starting from which the special price is applied to the product | +
| string |
+ special_to_date |
+Date till which the special price is applied to the product | +
| string |
+ tax_class_id |
+Tax class ID | +
| array | + tier_price |
+Array of catalogProductTierPriceEntity | +
| string |
+ meta_title |
+Mate title | +
| string |
+ meta_keyword |
+Meta keyword | +
| string |
+ meta_description |
+Meta description | +
| string |
+ custom_design |
+Custom design | +
| string |
+ custom_layout_update |
+Custom layout update | +
| string |
+ options_container |
+Options container | +
| associativeArray | + additional_attributes |
+Array of additional attributes | +
| string |
+ enable_googlecheckout |
+Defines whether Google Checkout is applied to the product | +
The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+ID of the customer group | +
| string | + website |
+Website | +
| int | + qty |
+Quantity to which the price will be applied | +
| double | + price |
+Price that each item will cost | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.info', '4');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductInfo($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductInfo((object)array('sessionId' => $sessionId->result, 'productId' => '4'));
+var_dump($result->result);
+ array + 'product_id' => string '4' (length=1) + 'sku' => string 'canon_powershot' (length=15) + 'set' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'categories' => + array + 0 => string '3' (length=1) + 1 => string '5' (length=1) + 'websites' => + array + 0 => string '2' (length=1) + 'type_id' => string 'simple' (length=6) + 'name' => string 'Canon PowerShot A630 8MP Digital Camera with 4x Optical Zoom' (length=60) + 'description' => string 'Replacing the highly popular PowerShot A620, the PowerShot A630 features a rotating 2.5-inch vari-angle LCD, 4x optical zoom lens, and a vast array of creative shooting modes. + +The PowerShot A630 packs a vast array of advanced features into a remarkably compact space' (length=267) + 'short_description' => string 'Replacing the highly popular PowerShot A620, the PowerShot A630 features a rotating 2.5-inch vari-angle LCD, 4x optical zoom lens, and a vast array of creative shooting modes.' (length=175) + 'weight' => string '1.0000' (length=6) + 'old_id' => null + 'news_from_date' => null + 'news_to_date' => null + 'status' => string '1' (length=1) + 'url_key' => string 'canon-powershot-a630-8mp-digital-camera-with-4x-optical-zoom' (length=60) + 'url_path' => string 'canon-powershot-a630-8mp-digital-camera-with-4x-optical-zoom.html' (length=65) + 'visibility' => string '4' (length=1) + 'category_ids' => + array + 0 => string '3' (length=1) + 1 => string '5' (length=1) + 'required_options' => string '0' (length=1) + 'has_options' => string '0' (length=1) + 'image_label' => null + 'small_image_label' => null + 'thumbnail_label' => null + 'created_at' => string '2012-03-29 12:47:56' (length=19) + 'updated_at' => string '2012-03-29 12:47:56' (length=19) + 'country_of_manufacture' => null + 'price' => string '329.9900' (length=8) + 'group_price' => + array + empty + 'special_price' => null + 'special_from_date' => null + 'special_to_date' => null + 'tier_price' => + array + empty + 'minimal_price' => null + 'msrp_enabled' => string '2' (length=1) + 'msrp_display_actual_price_type' => string '4' (length=1) + 'msrp' => null + 'enable_googlecheckout' => string '1' (length=1) + 'tax_class_id' => string '2' (length=1) + 'meta_title' => null + 'meta_keyword' => null + 'meta_description' => null + 'is_recurring' => string '0' (length=1) + 'recurring_profile' => null + 'custom_design' => null + 'custom_design_from' => null + 'custom_design_to' => null + 'custom_layout_update' => null + 'page_layout' => null + 'options_container' => string 'container2' (length=10) + 'gift_message_available' => null+
Aliases:
+Allows you to retrieve the list of products.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +filters | +Array of filters by attributes (optional) | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +storeView | +Array of catalogProductEntity | +
The catalogProductEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ sku |
+Product SKU | +
| string |
+ name |
+Product name | +
| string |
+ set |
+Product attribute set | +
| string |
+ type |
+Type of the product | +
| ArrayOfString | + category_ids |
+Array of category IDs | +
| ArrayOfString |
+website_ids | +Array of website IDs | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'type',
+ 'value' => array('key' => 'in', 'value' => 'simple,configurable')
+ )
+ )
+);
+$result = $client->catalogProductList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductList((object)array('sessionId' => $sessionId->result, 'filters' => null));
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '1' (length=1) + 'sku' => string 'n2610' (length=5) + 'name' => string 'Nokia 2610 Phone' (length=16) + 'set' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'category_ids' => + array + 0 => string '4' (length=1) + 1 => + array + 'product_id' => string '2' (length=1) + 'sku' => string 'b8100' (length=5) + 'name' => string 'BlackBerry 8100 Pearl' (length=21) + 'set' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'category_ids' => + array + 0 => string '4' (length=1)+
Get the list of additional attributes. Additional attributes are attributes that are not in the default set of attributes.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +productType | +Product type (e.g., simple) | +
| string | +attributeSetId | +Attribute set ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +attribute_id | +Attribute ID | +
| string | +code | +Attribute code | +
| string |
+type | +Attribute type (e.g., text, select, date, etc.) | +
| string |
+required | +Defines whether the attribute is required | +
| string |
+scope | +Attribute scope (global, website, or store) | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 104 | +Product type is not in allowed types. | +
| 105 | +Product attribute set is not existed | +
| 106 | +Product attribute set is not belong catalog product entity type | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$listAttributes = $proxy->call(
+ $sessionId,
+ 'product.listOfAdditionalAttributes',
+ array(
+ 'simple',
+ 13
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductListOfAdditionalAttributes($sessionId, 'simple', '13');
+var_dump($result);
+ array + 0 => + array + 'attribute_id' => string '89' (length=2) + 'code' => string 'old_id' (length=6) + 'type' => string 'text' (length=4) + 'required' => string '0' (length=1) + 'scope' => string 'global' (length=6) + 1 => + array + 'attribute_id' => string '93' (length=2) + 'code' => string 'news_from_date' (length=14) + 'type' => string 'date' (length=4) + 'required' => string '0' (length=1) + 'scope' => string 'website' (length=7) + 2 => + array + ...+
Aliases:
+Allows you to set the product special price.
+ +Aliases:
+Note:
+Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ productId |
+Product ID or SKU | +
| string |
+ specialPrice |
+Product special price | +
| string |
+ fromDate |
+Date starting from which special price will be applied | +
| string |
+ toDate |
+Date till which special price will be applied | +
| string |
+ storeView |
+Store view ID or code (optional) | +
| string | +productIdentifierType | +Defines whether the product ID or SKU is passed in the 'productId' parameter (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean/int | +result | +True (1) if the special price is set for the product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.setSpecialPrice', array('product' => 'testproduct', 'specialPrice' => '77.5', 'fromDate' => '2012-03-29 12:30:51', 'toDate' => '2012-04-29 12:30:51'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductSetSpecialPrice($sessionId, '2', '77.5', '2012-03-29 12:30:51', '2012-04-29 12:30:51');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductSetSpecialPrice((object)array('sessionId' => $sessionId->result, 'productId' => '2', 'specialPrice' => '77.5', 'fromDate' => '2012-03-29 12:30:51', 'toDate' => '2012-04-29 12:30:51'));
+var_dump($result->result);
+ Aliases:
+Allows you to update the required product. Note that you should specify only those parameters which you want to be updated.
+ +Aliases:
+Note:
+Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + product\productId |
+Product ID | +
| array | + productData |
+Array of catalogProductCreateEntity | +
| string | + storeView |
+Store view ID or code (optional) | +
| string | + identifierType |
+Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is updated | +
The catalogProductCreateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString | + categories |
+Array of categories | +
| ArrayOfString |
+ websites |
+Array of websites | +
| string | + name |
+Product name | +
| string |
+ description |
+Product description | +
| string |
+ short_description |
+Product short description | +
| string |
+ weight |
+Product weight | +
| string |
+ status |
+Product status | +
| string |
+ url_key |
+A relative URL path that can be entered in place of the target path | +
| string |
+ url_path |
+URL path | +
| string |
+ visibility |
+Product visibility on the frontend | +
| ArrayOfString |
+ category_ids |
+Array of category IDs | +
| ArrayOfString |
+ website_ids |
+Array of website IDs | +
| string |
+ has_options |
+Defines whether the product has options | +
| string |
+ gift_message_available |
+Defines whether the gift message is available for the product | +
| string |
+ price |
+Product price | +
| string |
+ special_price |
+Product special price | +
| string |
+ special_from_date |
+Date starting from which the special price will be applied to the product | +
| string |
+ special_to_date |
+Date till which the special price will be applied to the product | +
| string |
+ tax_class_id |
+Tax class ID | +
| array | + tier_price |
+Array of catalogProductTierPriceEntity | +
| string |
+ meta_title |
+Meta title | +
| string |
+ meta_keyword |
+Meta keyword | +
| string |
+ meta_description |
+Meta description | +
| string |
+ custom_design |
+Custom design | +
| string |
+ custom_layout_update |
+Custom layout update | +
| string |
+ options_container |
+Options container | +
| associativeArray |
+ additional_attributes |
+Array of catalogProductAdditionalAttributesEntity | +
| array | + stock_data |
+ Array of catalogInventoryStockItemUpdateEntity |
+
Notes: The "websites" and "website_ids" or "categories" and "category_ids" parameters are interchangeable. In other words, you can specify an array of website IDs (int) and then you don't need to specify the array of website codes (string) and vice versa.
+ +The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+Customer group ID | +
| string | + website |
+Website | +
| int | + qty |
+Quantity of items to which the price will be applied | +
| double | + price |
+Price that each item will cost | +
The catalogInventoryStockItemUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + qty |
+Quantity of items | +
| int | + is_in_stock |
+Defines whether the item is in stock | +
| int |
+ manage_stock |
+Manage stock | +
| int |
+ use_config_manage_stock |
+Use config manage stock | +
| int |
+ min_qty |
+Minimum quantity for items to be in stock | +
| int |
+ use_config_min_qty |
+Use config settings flag (value defined in the Inventory System Configuration) | +
| int |
+ min_sale_qty |
+Minimum quantity allowed in the shopping cart | +
| int |
+ use_config_min_sale_qty |
+Use config settings flag | +
| int |
+ max_sale_qty |
+Maximum quantity allowed in the shopping cart | +
| int |
+ use_config_max_sale_qty |
+Use config settings flag | +
| int |
+ is_qty_decimal |
+Defines whether the quantity is decimal | +
| int |
+ backorders |
+Backorders status | +
| int |
+ use_config_backorders |
+Use config settings flag (for backorders) | +
| int |
+ notify_stock_qty |
+Stock quantity below which a notification will appear | +
| int |
+ use_config_notify_stock_qty |
+Use config settings flag (for stock quantity) | +
The catalogProductAdditionalAttributesEntity content is as follows:
+ + +| Type | +Name | +
|---|---|
| associativeMultiArray | +multi_data | +
| associativeArray | +single_data | +
Single Data: array of attributes with only single value
+Multi Data: array of attributes which could contain several values
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Product not exists. | +
| 102 | +Invalid data given. Details in error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session, 'catalog_product.update', array('product_sku', array(
+ 'categories' => array(2),
+ 'websites' => array(1),
+ 'name' => 'Product name new 2',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'url_key' => 'product-url-key',
+ 'url_path' => 'product-url-path',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+ 'meta_title' => 'Product meta title',
+ 'meta_keyword' => 'Product meta keyword',
+ 'meta_description' => 'Product meta description'
+)));
+
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->catalogProductUpdate($session, 'product_sku', array(
+ 'categories' => array(2),
+ 'websites' => array(1),
+ 'name' => 'Product name new',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'url_key' => 'product-url-key',
+ 'url_path' => 'product-url-path',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+ 'meta_title' => 'Product meta title',
+ 'meta_keyword' => 'Product meta keyword',
+ 'meta_description' => 'Product meta description'
+));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1',
+'productData' => ((object)array(
+ 'name' => 'Product name updated',
+ 'status' => '1',
+))));
+
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve product attributes and options.
+ +Resource Name: catalog_product_attribute
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Requested attribute not found. | +
| 102 | +Invalid request parameters. | +
| 103 | +Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, first character should be a letter. | +
| 104 | +Incorrect attribute type. | +
| 105 | +Unable to save attribute. | +
| 106 | +This attribute cannot be deleted. | +
| 107 | +This attribute cannot be edited. | +
| 108 | +Unable to add option. | +
| 109 | +Unable to remove option. | +
<pre>
+<?php
+$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+echo "<pre>";
+// Create new attribute
+$attributeToCreate = array(
+ "attribute_code" => "new_attribute",
+ "scope" => "store",
+ "frontend_input" => "select",
+ "is_unique" => 0,
+ "is_required" => 0,
+ "is_configurable" => 0,
+ "is_searchable" => 0,
+ "is_visible_in_advanced_search" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(
+ "is_filterable" => 1,
+ "is_filterable_in_search" => 1,
+ "position" => 1,
+ "used_for_sort_by" => 1
+ ),
+ "frontend_label" => array(
+ array(
+ "store_id" => 0,
+ "label" => "A new attribute"
+ )
+ )
+);
+
+$attributeId = $proxy->call(
+ $sessionId,
+ "product_attribute.create",
+ array(
+ $attributeToCreate
+ )
+);
+
+// Update attribute
+$attributeToUpdate = array(
+ "scope" => "global",
+ "is_unique" => 1,
+ "is_required" => 1,
+ "is_configurable" => 1,
+ "is_searchable" => 1,
+ "is_visible_in_advanced_search" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(
+ "is_filterable" => 01,
+ "is_filterable_in_search" => 0,
+ "position" => 2,
+ "used_for_sort_by" => 0
+ ),
+ "frontend_label" => array(
+ array(
+ "store_id" => 0,
+ "label" => "A Test Attribute"
+ )
+ )
+);
+$proxy->call(
+ $sessionId,
+ "product_attribute.update",
+ array(
+ "new_attribute",
+ $attributeToUpdate
+ )
+);
+
+// Add option
+$optionToAdd = array(
+ "label" => array(
+ array(
+ "store_id" => 0,
+ "value" => "New Option"
+ )
+ ),
+ "order" => 0,
+ "is_default" => 0
+);
+
+$proxy->call(
+ $sessionId,
+ "product_attribute.addOption",
+ array(
+ $attributeId,
+ $optionToAdd
+ )
+);
+
+// Get info
+$resultInfo = $proxy->call(
+ $sessionId,
+ "product_attribute.info",
+ array(
+ $attributeId
+ )
+);
+echo "info result:\n";
+print_r($resultInfo);
+
+// List options
+$resultListOptions = $proxy->call(
+ $sessionId,
+ "product_attribute.options",
+ array(
+ $attributeId
+ )
+);
+echo "\n options result:\n";
+print_r($resultListOptions);
+
+// Remove option
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.removeOption",
+ array(
+ $attributeId,
+ $resultInfo['options'][0]['value']
+ )
+);
+
+// remove attribute
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.remove",
+ array(
+ $attributeId
+ )
+);
+ Aliases:
+Allows you to retrieve the product attribute options.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ attributeId |
+Attribute ID or code | +
| string |
+ storeView |
+Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeOptionEntity | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Option label | +
| string | +value | +Option value | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeId = 11; // Existing selectable attribute ID
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.options",
+ array(
+ $attributeId
+ )
+);
+echo "<pre>";
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeOptions($sessionId, '11');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeOptions((object)array('sessionId' => $sessionId->result, 'attributeId' => '11'));
+
+var_dump($result->result);
+ array + 1 => + array + 'value' => string '5' (length=1) + 'label' => string 'blue' (length=4) + 2 => + array + 'value' => string '4' (length=1) + 'label' => string 'green' (length=5) + 3 => + array + 'value' => string '3' (length=1) + 'label' => string 'yellow' (length=6)+
Allows you to add a new option for attributes with selectable fields.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + attribute |
+Attribute code or ID | +
| array | +data | +Array of catalogProductAttributeOptionEntityToAdd | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True on success | +
The catalogProductAttributeOptionEntityToAdd content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +label | +Array of catalogProductAttributeOptionLabel | +
| int | +order | +Option order | +
| int | +is_default | +Defines whether the option is a default one | +
The catalogProductAttributeOptionLabel content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString | + store_id |
+Array of store view IDs | +
| string | + value |
+Text label | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
| 104 | +Incorrect attribute type. | +
| 108 | +Unable to add option. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeCode = "new_attribute";
+$optionToAdd = array(
+ "label" => array(
+ array(
+ "store_id" => 0,
+ "value" => "New Option"
+ )
+ ),
+ "order" => 0,
+ "is_default" => 0
+);
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.addOption",
+ array(
+ $attributeCode,
+ $optionToAdd
+ )
+);
+ <?php
+$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+//V2
+$session = $client->login('apiUser', 'apiKey');
+
+// V2 WS-I Mode
+//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+//$session = $response->result;
+
+$attributeCode = "new_attribute";
+
+//v2
+
+$label = array (
+ array(
+ "store_id" => array("0"),
+ "value" => "some random data"
+ )
+ );
+
+$data = array(
+ "label" => $label,
+ "order" => "10",
+ "is_default" => "1"
+ );
+
+$orders = $client->catalogProductAttributeAddOption($session, $attributeCode, $data);
+
+
+
+//V2 WSI
+//WSDL WSI does not describe this method
+//$result = $client->catalogProductAttributeAddOption(...);
+//$orders = $result->result->complexObjectArray;
+
+var_dump ($orders);
+?>
+ Allows you to create a new product attribute.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +data | +Array of catalogProductAttributeEntityToCreate | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created attribute | +
The catalogProductAttributeEntityToCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + attribute_code |
+Attribute code | +
| string |
+ frontend_input |
+ Attribute type |
+
| string |
+ scope |
+ Attribute scope. Possible values are as follows: 'store', 'website', or 'global' |
+
| string |
+ default_value |
+Attribute default value | +
| int | + is_unique |
+Defines whether the attribute is unique | +
| int | + is_required |
+ Defines whether the attribute is required |
+
| ArrayOfString | + apply_to |
+ Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
+
| int | + is_configurable |
+ Defines whether the attribute can be used for configurable products |
+
| int |
+ is_searchable |
+Defines whether the attribute can be used in Quick Search | +
| int |
+ is_visible_in_advanced_search |
+Defines whether the attribute can be used in Advanced Search | +
| int |
+ is_comparable |
+Defines whether the attribute can be compared on the frontend | +
| int |
+ is_used_for_promo_rules |
+Defines whether the attribute can be used for promo rules | +
| int |
+ is_visible_on_front |
+Defines whether the attribute is visible on the frontend | +
| int |
+ used_in_product_listing |
+Defines whether the attribute can be used in product listing | +
| associativeArray | + additional_fields |
+Array of additional fields | +
| array | + frontend_label |
+Array of catalogProductAttributeFrontendLabel | +
The catalogProductAttributeFrontendLabelEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + store_id |
+Store ID | +
| string | + label |
+Text label | +
Notes: The "label" value for the "store_id" value set to 0 must be specified. An attribute cannot be created without specifying the label for store_id=0.
+ +The AdditionaFieldsEntity array of additional fields for the text type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +frontend_class | +Input Validation for Store Owner. Possible values are as follows: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | +
| boolean | +is_html_allowed_on_front | +Defines whether the HTML tags are allowed on the frontend | +
| boolean | +used_for_sort_by | +Defines whether it is used for sorting in product listing | +
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_wysiwyg_enabled | +Enable WYSIWYG flag | +
| boolean | +is_html_allowed_on_front | + Defines whether the HTML tags are allowed on the frontend |
+
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | +Defines whether it is used in layered navigation | +
| boolean | +is_filterable_in_search | +Defines whether it is used in search results layered navigation | +
| int | +position | +Position | +
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | + Defines whether it is used in layered navigation |
+
| boolean | +is_filterable_in_search | + Defines whether it is used in search results layered navigation |
+
| int | +position | +Position | +
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 102 | +Invalid request parameters. | +
| 103 | +Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, first character should be a letter. | +
| 104 | +Incorrect attribute type. | +
| 105 | +Unable to save attribute. | +
<?php
+
+$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$attributeToUpdate = array(
+ "scope" => "global",
+ "default_value" => "100",
+ "frontend_input" => "text",
+ "is_unique" => 0,
+ "is_required" => 0,
+ "is_configurable" => 0,
+ "is_searchable" => 0,
+ "is_visible_in_advanced_search" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(
+ "is_filterable" => 1,
+ "is_filterable_in_search" => 1,
+ "position" => 1,
+ "used_for_sort_by" => 1
+ ),
+ "frontend_label" => array(
+ array(
+ "store_id" => 0,
+ "label" => "Updated attribute"
+ )
+ )
+);
+
+
+$attributeCode = 'code1';
+
+$result = $client->call($session, 'product_attribute.update', array($attributeCode, $attributeToUpdate));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+
+?>
+ <?php
+//ini_set("soap.wsdl_cache_enabled", 0);
+
+$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+//V2
+$session = $client->login('apiUser', 'apiKey');
+
+// V2 WS-I Mode
+//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+//$session = $response->result;
+
+
+//v2
+
+$data = array(
+ "attribute_code" => "test_attribute",
+ "frontend_input" => "text",
+ "scope" => "1",
+ "default_value" => "1",
+ "is_unique" => 0,
+ "is_required" => 0,
+ "apply_to" => array("simple"),
+ "is_configurable" => 0,
+ "is_searchable" => 0,
+ "is_visible_in_advanced_search" => 0,
+ "is_comparable" => 0,
+ "is_used_for_promo_rules" => 0,
+ "is_visible_on_front" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(),
+ "frontend_label" => array(array("store_id" => "0", "label" => "some label"))
+ );
+
+$orders = $client->catalogProductAttributeCreate($session, $data);
+
+
+
+//V2 WSI
+//WSDL WSI Sample is not complete
+//$result = $client->catalogProductAttributeCreate(array("sessionId" => $session, "data" => $data));
+//$orders = $result->result->complexObjectArray;
+
+echo 'Number of results: ' . count($orders) . '<br/>';
+var_dump ($orders);
+?>
+ Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ sessionId |
+Session ID | +
| string |
+ storeView |
+Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute.currentStore', 'english');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeCurrentStore($sessionId, 'english');
+var_dump($result);
+ Allows you to get full information about a required attribute with the list of options.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +attribute | +Attribute code or ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductAttributeEntity | +
The catalogProductAttributeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +attribute_id | +Attribute ID | +
| string |
+ attribute_code |
+Attribute code | +
| string |
+ frontend_input |
+ Attribute type |
+
| string |
+ scope |
+Attribute scope | +
| string |
+ default_value |
+Attribute default value | +
| int | + is_unique |
+Defines whether the attribute is unique | +
| int | + is_required |
+ Defines whether the attribute is required |
+
| ArrayOfString | + apply_to |
+ Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
+
| int | + is_configurable |
+ Defines whether the attribute can be used for configurable products |
+
| int | + is_searchable |
+ Defines whether the attribute can be used in Quick Search |
+
| int | + is_visible_in_advanced_search |
+ Defines whether the attribute can be used in Advanced Search |
+
| int | + is_comparable |
+ Defines whether the attribute can be compared on the frontend |
+
| int | + is_used_for_promo_rules |
+ Defines whether the attribute can be used for promo rules |
+
| int | + is_visible_on_front |
+Defines whether the attribute is visible on the frontend | +
| int | + used_in_product_listing |
+ Defines whether the attribute can be used in product listing |
+
| associativeArray |
+ additional_fields |
+Array of additional fields | +
| array | + options |
+Array of catalogAttributeOptionEntity | +
| array | + frontend_label |
+Array of catalogProductAttributeFrontendLabel | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + label |
+Text label | +
| string | + value |
+Option ID | +
The catalogProductAttributeFrontendLabelEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + store_id |
+Store ID | +
| string | + label |
+Text label | +
The AdditionaFieldsEntity array of additional fields for the text type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +frontend_class | +Input Validation for Store Owner. Possible values: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | +
| boolean | +is_html_allowed_on_front | +Defines whether the HTML tags are allowed on the frontend | +
| boolean | +used_for_sort_by | +Defines whether it is used for sorting in product listing | +
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_wysiwyg_enabled | +Enable WYSIWYG flag | +
| boolean | +is_html_allowed_on_front | + Defines whether the HTML tags are allowed on the frontend |
+
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | +Defines whether it used in layered navigation | +
| boolean | +is_filterable_in_search | +Defines whether it is used in search results layered navigation | +
| int | +position | +Position | +
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | + Defines whether it used in layered navigation |
+
| boolean | +is_filterable_in_search | + Defines whether it is used in search results layered navigation |
+
| int | +position | +Position | +
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_attribute.info', '11');
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeInfo($sessionId, '11');
+var_dump($result);
+ array + 'attribute_id' => string '11' (length=3) + 'attribute_code' => string 'new_special_price' (length=17) + 'frontend_input' => string 'text' (length=4) + 'default_value' => null + 'is_unique' => string '0' (length=1) + 'is_required' => string '0' (length=1) + 'apply_to' => + array + empty + 'is_configurable' => string '0' (length=1) + 'is_searchable' => string '0' (length=1) + 'is_visible_in_advanced_search' => string '0' (length=1) + 'is_comparable' => string '0' (length=1) + 'is_used_for_promo_rules' => string '0' (length=1) + 'is_visible_on_front' => string '0' (length=1) + 'used_in_product_listing' => string '0' (length=1) + 'frontend_label' => + array + 0 => + array + 'store_id' => int 0 + 'label' => string 'special price' (length=13) + 1 => + array + 'store_id' => int 2 + 'label' => string 'special price' (length=13) + 'scope' => string 'store' (length=5) + 'additional_fields' => + array + 'frontend_class' => null + 'is_html_allowed_on_front' => string '1' (length=1) + 'used_for_sort_by' => string '0' (length=1)+
Aliases:
+Allows you to retrieve the list of product attributes.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | + setId |
+ID of the attribute set | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeEntity | +
The catalogAttributeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + attribute_id |
+Attribute ID | +
| string | + code |
+Attribute code | +
| string |
+ type |
+Attribute type | +
| string |
+ required |
+Defines whether the attribute is required | +
| string |
+ scope |
+Attribute scope. Possible values: 'store', 'website', or 'global' | +
Faults:
+ +No faults
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setid = 4; // Existing attribute set id
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.list",
+ array(
+ $setId
+ )
+);
+echo "<pre>";
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeList($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeList((object)array('sessionId' => $sessionId->result, 'setId' => '4'));
+
+var_dump($result->result);
+ array + 0 => + array + 'attribute_id' => string '71' (length=2) + 'code' => string 'name' (length=4) + 'type' => string 'text' (length=4) + 'required' => string '1' (length=1) + 'scope' => string 'store' (length=5) + 1 => + array + 'attribute_id' => string '72' (length=2) + 'code' => string 'description' (length=11) + 'type' => string 'textarea' (length=8) + 'required' => string '1' (length=1) + 'scope' => string 'store' (length=5)+
Aliases:
+Allows you to retrieve the product attribute options.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ attributeId |
+Attribute ID or code | +
| string |
+ storeView |
+Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeOptionEntity | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Option label | +
| string | +value | +Option value | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeId = 11; // Existing selectable attribute ID
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.options",
+ array(
+ $attributeId
+ )
+);
+echo "<pre>";
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeOptions($sessionId, '11');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeOptions((object)array('sessionId' => $sessionId->result, 'attributeId' => '11'));
+
+var_dump($result->result);
+ array + 1 => + array + 'value' => string '5' (length=1) + 'label' => string 'blue' (length=4) + 2 => + array + 'value' => string '4' (length=1) + 'label' => string 'green' (length=5) + 3 => + array + 'value' => string '3' (length=1) + 'label' => string 'yellow' (length=6)+
Allows you to remove the required attribute from a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +attribute | +Attribute code or ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the attribute is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
| 106 | +This attribute cannot be deleted. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeCode = "11";
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.remove",
+ array(
+ $attributeCode
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeRemove($sessionId, '11');
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $client->catalogProductAttributeRemove((object)array('sessionId' => $session->result, 'attribute' => '11'));
+
+var_dump ($result);
+ Allows you to remove the option for an attribute.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +attribute | +Attribute code or ID | +
| string |
+optionId | +Option ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the option is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
| 104 | +Incorrect attribute type. | +
| 109 | +Unable to remove option. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeCode = "2";
+$optionId = 11; // Existing option ID
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.removeOption",
+ array(
+ $attributeCode,
+ $optionId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeRemoveOption($sessionId, '2', '11');
+var_dump($result);
+ Allows you to retrieve the list of possible attribute types.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeOptionEntity | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Option label | +
| string |
+ value |
+Option value | +
Faults:
+ +No Faults.
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.types"
+);
+
+echo "<pre>";
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeTypes($sessionId);
+var_dump($result);
+ array + 0 => + 'value' => 'text' + 'label' => 'Text Field' + 1 => + 'value' => 'textarea' + 'label' => 'Text Area' + 2 => + 'value' => 'date' + 'label' => 'Date' + 3 => + 'value' => 'boolean' + 'label' => 'Yes/No' + 4 => + 'value' => 'multiselect' + 'label' => 'Multiple Select' + 5 => + 'value' => 'select' + 'label' => 'Dropdown' + 6 => + 'value' => 'price' + 'label' => 'Price' + 7 => + 'value' => 'media_image' + 'label' => 'Media Image'+
Allows you to update the required attribute.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + attribute |
+Attribute code or ID | +
| array | +data | +Array of catalogProductAttributeEntityToUpdate | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the attribute is updated | +
The catalogProductAttributeEntityToUpdate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + scope |
+ Attribute scope. Possible values are as follows: 'store', 'website', or 'global' |
+
| string | + default_value |
+Attribute default value | +
| int | + is_unique |
+Defines whether the attribute is unique | +
| int | + is_required |
+Defines whether the attribute is required | +
| ArrayOfString | + apply_to |
+ Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
+
| int | + is_configurable |
+Defines whether the attribute can be used for configurable products | +
| int |
+ is_searchable |
+ Defines whether the attribute can be used in Quick Search |
+
| int |
+ is_visible_in_advanced_search |
+ Defines whether the attribute can be used in Advanced Search |
+
| int |
+ is_comparable |
+ Defines whether the attribute can be compared on the frontend |
+
| int |
+ is_used_for_promo_rules |
+ Defines whether the attribute can be used for promo rules |
+
| int |
+ is_visible_on_front |
+ Defines whether the attribute can be visible on the frontend |
+
| int |
+ used_in_product_listing |
+ Defines whether the attribute can be used in product listing |
+
| associativeArray | + additional_fields |
+Array of additional fields | +
| array | + frontend_label |
+Array of catalogProductAttributeFrontendLabel | +
The AdditionaFieldsEntity array of additional fields for the text type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +frontend_class | +Input Validation for Store Owner. Possible values: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | +
| boolean | +is_html_allowed_on_front | + Defines whether the HTML tags are allowed on the frontend |
+
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_wysiwyg_enabled | +Enable WYSIWYG flag | +
| boolean | +is_html_allowed_on_front | + Defines whether the HTML tags are allowed on the frontend |
+
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | + Defines whether it used in layered navigation |
+
| boolean | +is_filterable_in_search | + Defines whether it is used in search results layered navigation |
+
| integer | +position | +Position | +
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | + Defines whether it used in layered navigation |
+
| boolean | +is_filterable_in_search | + Defines whether it is used in search results layered navigation |
+
| integer | +position | +Position | +
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The catalogProductAttributeFrontendLabel content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +store_id | +Store ID | +
| string | +label | +Text label | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
| 105 | +Unable to save attribute. | +
| 107 | +This attribute cannot be edited. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeToUpdate = array(
+ "scope" => "global",
+ "is_unique" => 1,
+ "is_required" => 1,
+ "is_configurable" => 1,
+ "is_searchable" => 1,
+ "is_visible_in_advanced_search" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(
+ "is_filterable" => 1,
+ "is_filterable_in_search" => 0,
+ "position" => 2,
+ "used_for_sort_by" => 0
+ ),
+ "frontend_label" => array(
+ array(
+ "store_id" => 0,
+ "label" => "A Test Attribute"
+ )
+ )
+);
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.update",
+ array(
+ $attributeToUpdate
+ )
+);
+ <?php
+//ini_set("soap.wsdl_cache_enabled", 0);
+
+$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+//V2
+$session = $client->login('apiUser', 'apiKey');
+
+// V2 WS-I Mode
+//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+//$session = $response->result;
+
+
+//v2
+$attributeCode = "code1";
+$data = array(
+ "frontend_input" => "text",
+ "scope" => "1",
+ "default_value" => "1",
+ "is_unique" => 0,
+ "is_required" => 0,
+ "apply_to" => array("simple"),
+ "is_configurable" => 0,
+ "is_searchable" => 0,
+ "is_visible_in_advanced_search" => 0,
+ "is_comparable" => 0,
+ "is_used_for_promo_rules" => 0,
+ "is_visible_on_front" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(),
+ "frontend_label" => array(array("store_id" => "0", "label" => "some random label updated"))
+ );
+
+$orders = $client->catalogProductAttributeUpdate($session, $attributeCode, $data);
+
+
+
+//V2 WSI
+//WSDL WSI Sample is not complete
+//$result = $client->catalogProductAttributeCreate(array("sessionId" => $session, "data" => $data));
+//$orders = $result->result->complexObjectArray;
+
+echo 'Number of results: ' . count($orders) . '<br/>';
+var_dump ($orders);
+?>
+ Aliases:
+Allows you to upload a new product image.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ product |
+Product ID or code | +
| array | + data |
+Array of catalogProductAttributeMediaCreateEntity | +
| string | + storeView |
+Store view ID or code (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +result | +Image file name (e.g., "/i/m/image.png") | +
The catalogProductAttributeMediaCreateEntity content is as follows:
+ +| Type | +Name | + Description |
+
|---|---|---|
| array | + file |
+ Array of catalogProductImageFileEntity |
+
| string | + label |
+Image label | +
| string | + position |
+Image position | +
| ArrayOfString | + types |
+Array of types | +
| string | + exclude |
+Defines whether the image will associate only to one of three image types | +
| string | + remove |
+Remove image flag | +
The catalogProductImageFileEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +content | +Image content (base_64 encoded) | +
| string | +mime | +Image mime type (e.g., image/jpeg) | +
| string | +name | +Image name | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 2;
+$file = array(
+ 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+ 'mime' => 'image/jpeg'
+);
+
+$result = $proxy->call(
+ $session,
+ 'catalog_product_attribute_media.create',
+ array(
+ $productId,
+ array('file'=>$file, 'label'=>'Label', 'position'=>'100', 'types'=>array('thumbnail'), 'exclude'=>0)
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 2;
+$file = array(
+ 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+ 'mime' => 'image/jpeg'
+);
+
+$result = $proxy->catalogProductAttributeMediaCreate(
+ $session,
+ $productId,
+ array('file' => $file, 'label' => 'Label', 'position' => '100', 'types' => array('thumbnail'), 'exclude' => 0)
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaCreate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'data' => ((object)array(
+'label' => 'image_label',
+'position' => '1',
+'types' => array('thumbnail'),
+'exclude' => '0',
+'file' => ((object)array(
+'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+'mime' => 'image/png',
+'name' => 'image'
+))))));
+
+var_dump($result->result);
+ Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.currentStore', 'english');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaCurrentStore($sessionId, 'english');
+var_dump($result);
+ Aliases:
+Allows you to retrieve information about the specified product image.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ file |
+Name of the image file (e.g., /b/l/blackberry8100_2.jpg) | +
| string |
+ storeView |
+Store view ID or code (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductImageEntity | +
The catalogProductImageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + file |
+Image file name | +
| string |
+ label |
+Image file label | +
| string |
+ position |
+Image file position | +
| string |
+ exclude |
+Defines whether the image will associate only to one of three image types | +
| string |
+ url |
+Image URL | +
| ArrayOfString | + types |
+Array of types | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.info', array('product' => '2', 'file' => '/b/l/blackberry8100_2.jpg'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaInfo($sessionId, '2', '/b/l/blackberry8100_2.jpg');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaInfo((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'file' => '/i/m/image.png'));
+
+var_dump($result->result);
+ array + 'file' => string '/b/l/blackberry8100_2.jpg' (length=25) + 'label' => string '' (length=0) + 'position' => string '1' (length=1) + 'exclude' => string '0' (length=1) + 'url' => string 'http://magentohost/media/catalog/product/b/l/blackberry8100_2.jpg' (length=71) + 'types' => + array + 0 => string 'image' (length=5) + 1 => string 'small_image' (length=11) + 2 => string 'thumbnail' (length=9)+
Aliases:
+Allows you to retrieve the list of product images.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ storeView |
+Store view ID or code (optional) | +
| string | +identifierType | +Defines whether the product ID or sku is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductImageEntity | +
The catalogProductImageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + file |
+Image file name | +
| string |
+ label |
+Image label | +
| string |
+ position |
+Image position | +
| string |
+ exclude |
+Defines whether the image will associate only to one of three image types | +
| string |
+ url |
+Image URL | +
| ArrayOfString | + types |
+Array of types | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.list', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaList($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaList((object)array('sessionId' => $sessionId->result, 'productId' => '2'));
+
+var_dump($result->result);
+ array + 0 => + array + 'file' => string '/b/l/blackberry8100_2.jpg' (length=25) + 'label' => string '' (length=0) + 'position' => string '1' (length=1) + 'exclude' => string '0' (length=1) + 'url' => string 'http://magentopath/blackberry8100_2.jpg' (length=71) + 'types' => + array + 0 => string 'image' (length=5) + 1 => string 'small_image' (length=11) + 2 => string 'thumbnail' (length=9)+
Aliases:
+Allows you to remove the image from a product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ file |
+Image file name (e.g., /b/l/blackberry8100_2.jpg) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the image is removed from a product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.remove', array('product' => '3', 'file' => '/b/l/blackberry8100_2.jpg'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaRemove($sessionId, '3', '/b/l/blackberry8100_2.jpg');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaRemove((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'file' => '/b/l/blackberry8100_2.jpg'));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve product image types including standard image, small_image, thumbnail, etc. Note that if the product attribute set contains attributes of the Media Image type (Catalog Input Type for Store Owner > Media Image), it will also be returned in the response.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +setId | +ID of the product attribute set | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductAttributeMediaTypeEntity | +
The catalogProductAttributeMediaTypeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +code | +Image type code | +
| string | +scope | +Image scope (store, website, or global) | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.types', '4');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaTypes($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaTypes((object)array('sessionId' => $sessionId->result, 'setId' => '4'));
+
+var_dump($result->result);
+ array + 0 => + array + 'code' => string 'image' (length=5) + 'scope' => string 'store' (length=5) + 1 => + array + 'code' => string 'small_image' (length=11) + 'scope' => string 'store' (length=5) + 2 => + array + 'code' => string 'thumbnail' (length=9) + 'scope' => string 'store' (length=5)+
Aliases:
+Allows you to update the product image.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+ product\productId |
+Product ID or code | +
| string |
+ file |
+Image file name (e.g., /i/m/image.jpeg) | +
| array | + data |
+Array of catalogProductAttributeMediaCreateEntity | +
| string |
+ storeView |
+Store view ID or code | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Notes: You should specify only those parameters which you want to be updated. Parameters that were not specified in the request, will preserve the previous values.
+ +Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +Result of product image updating | +
The catalogProductAttributeMediaCreateEntity content is as follows:
+ +| Type | +Name | + Description |
+
|---|---|---|
| array | + file |
+ Array of catalogProductImageFileEntity |
+
| string | + label |
+Product image label | +
| string | + position |
+Product image position | +
| ArrayOfString | + types |
+Array of types | +
| string | + exclude |
+Defines whether the image will associate only to one of three image types | +
| string | + remove |
+Image remove flag | +
The catalogProductImageFileEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +content | +Product image content (base_64 encoded) | +
| string | +mime | +Image mime type (e.g., image/jpeg) | +
| string | +name | +Image name | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 1;
+$file = '/i/m/image.jpg';
+
+$newFile = array(
+ 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+ 'mime' => 'image/jpeg'
+);
+
+$result = $client->call(
+ $session,
+ 'catalog_product_attribute_media.update',
+ array(
+ $productId,
+ $file,
+ array('file' => $newFile, 'label' => 'New label', 'position' => '50', 'types' => array('image'), 'exclude' => 1)
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 1;
+$file = '/i/m/image.jpg';
+
+$newFile = array(
+'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+'mime' => 'image/jpeg'
+);
+
+$result = $client->catalogProductAttributeMediaUpdate(
+$session,
+$productId,
+$file,
+array('file' => $newFile, 'label' => 'New label', 'position' => '50', 'types' => array('image'), 'exclude' => 1)
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'file' => '/t/u/tulips.jpg', 'data' => ((object)array(
+'label' => 'tulips',
+'position' => '1',
+'remove' => '0',
+'types' => array('small_image')
+))));
+
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage product images.
+ +Resource Name: catalog_product_attribute_media
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Product not exists. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested image not exists in product images’ gallery. | +
| 104 | +Image creation failed. Details in error message. | +
| 105 | +Image not updated. Details in error message. | +
| 106 | +Image not removed. Details in error message. | +
| 107 | +Requested product doesn’t support images | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$newImage = array(
+ 'file' => array(
+ 'name' => 'file_name',
+ 'content' => base64_encode(file_get_contents('product.jpg')),
+ 'mime' => 'image/jpeg'
+ ),
+ 'label' => 'Cool Image Through Soap',
+ 'position' => 2,
+ 'types' => array('small_image'),
+ 'exclude' => 0
+);
+
+$imageFilename = $proxy->call($sessionId, 'product_media.create', array('Sku', $newImage));
+
+
+var_dump($imageFilename);
+
+// Newly created image file
+var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
+
+$proxy->call($sessionId, 'product_media.update', array(
+ 'Sku',
+ $imageFilename,
+ array('position' => 2, 'types' => array('image') /* Lets do it main image for product */)
+));
+
+// Updated image file
+var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
+
+// Remove image file
+$proxy->call($sessionId, 'product_media.remove', array('Sku', $imageFilename));
+
+// Images without our file
+var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve product attribute sets.
+ +Resource Name: catalog_product_attribute_set
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Attribute set with requested id does not exist. | +
| 101 | +Invalid data given. | +
| 102 | +Error while creating attribute set. Details in error message. | +
| 103 | +Error while removing attribute set. Details in error message. | +
| 104 | +Attribute set with requested id does not exist. | +
| 105 | +Unable to remove attribute set as it has related goods. Use forceProductsRemove parameter to remove attribute set with all goods. | +
| 106 | +Attribute with requested id does not exist. | +
| 107 | +Error while adding attribute to attribute set. Details in error message. | +
| 108 | +Attribute group with requested id does not exist. | +
| 109 | +Requested attribute is already in requested attribute set. | +
| 110 | +Error while removing attribute from attribute set. Details in error message. | +
| 111 | +Requested attribute is not in requested attribute set. | +
| 112 | +Requested group exist already in requested attribute set. | +
| 113 | +Error while adding group to attribute set. Details in error message. | +
| 114 | +Error while renaming group. Details in error message. | +
| 115 | +Error while removing group from attribute set. Details in error message. | +
| 116 | +Group can not be removed as it contains system attributes. | +
| 117 | +Group can not be removed as it contains attributes, used in configurable products. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+echo "<pre>";
+// create new set
+$setName = "New Test Set";
+$skeletonId = 4;
+
+$setId = $proxy->call(
+ $sessionId,
+ "product_attribute_set.create",
+ array(
+ $setName,
+ $skeletonId
+ )
+);
+
+// Get list
+$setList = $proxy->call(
+ $sessionId,
+ "product_attribute_set.list"
+);
+echo "Set list:\n";
+print_r($setList);
+
+// create group
+$groupName = "Test Group";
+$groupId = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupAdd",
+ array(
+ $setId,
+ $groupName
+ )
+);
+
+// rename group
+$newGroupName = "New Test Group";
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupRename",
+ array(
+ $groupId,
+ $newGroupName
+ )
+);
+
+// add attribute
+$attributeId = 83;
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.attributeAdd",
+ array(
+ $attributeId,
+ $setId
+ )
+);
+
+//remove attribute
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.attributeRemove",
+ array(
+ $attributeId,
+ $setId
+ )
+);
+
+// remove group
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupRemove",
+ array(
+ $groupId
+ )
+);
+
+// remove set
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.remove",
+ array(
+ $setId
+ )
+);
+ Allows you to add an existing attribute to an attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeId | +Attribute ID | +
| string |
+attributeSetId | +Attribute set ID | +
| string |
+attributeGroupId | +Group ID (optional) | +
| string |
+sortOrder | +Sort order (optional) | +
Note: If the attributeGroupId parameter is not passed, the attribute is added to the General group by default.
+ +Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +isAdded | +True if the attribute is added to an attribute set | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 104 | +Attribute set with requested id does not exist. | +
| 106 | +Attribute with requested id does not exist. | +
| 107 | +Error while adding attribute to attribute set. Details in error message. | +
| 108 | +Attribute group with requested id does not exist. | +
| 109 | +Requested attribute is already in requested attribute set. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setId = 5;
+$attributeId = 83;
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.attributeAdd",
+ array(
+ $attributeId,
+ $setId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setId = 5;
+$attributeId = 83;
+
+$result = $proxy->catalogProductAttributeSetAttributeAdd(
+ $sessionId,
+ $attributeId,
+ $setId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetAttributeAdd((object)array('sessionId' => $sessionId->result, 'attributeId' => '5', 'attributeSetId' => '83'));
+var_dump($result->result);
+ Allows you to remove an existing attribute from an attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeId | +Attribute ID | +
| string |
+attributeSetId | +Attribute set ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +isRemoved | +True if the attribute is removed from an attribute set | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 104 | +Attribute set with requested id does not exist. | +
| 106 | +Attribute with requested id does not exist. | +
| 110 | +Error while removing attribute from attribute set. Details in error message. | +
| 111 | +Requested attribute is not in requested attribute set. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setId = 5;
+$attributeId = 83;
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.attributeRemove",
+ array(
+ $attributeId,
+ $setId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetAttributeRemove($sessionId, '5', '83');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetAttributeRemove((object)array('sessionId' => $sessionId->result, 'attributeId' => '5', 'attributeSetId' => '83'));
+var_dump($result->result);
+ Allows you to create a new attribute set based on another attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +attributeSetName | +Attribute set name | +
| string |
+skeletonSetId | +Attribute set ID basing on which the new attribute set will be created | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +setId | +ID of the created attribute set | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Attribute set with requested id does not exist. | +
| 101 | +Invalid data given. | +
| 102 | +Error while creating attribute set. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setName = "New Attribute Set";
+$skeletonId = 4;
+
+$newSetId = $proxy->call(
+ $sessionId,
+ "product_attribute_set.create",
+ array(
+ $setName,
+ $skeletonId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeSetName = 'New Attribute Set';
+$skeletonId = 4;
+
+$result = $client->catalogProductAttributeSetCreate(
+ $sessionId,
+ $attributeSetName,
+ $skeletonId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetCreate((object)array('sessionId' => $sessionId->result, 'attributeSetName' => 'New Attribute Set', 'skeletonSetId' => '4'));
+var_dump($result->result);
+ Allows you to add a new group for attributes to the attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeSetId | +Attribute set ID | +
| string | +groupName | +Group name | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created group | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 112 | +Requested group exist already in requested attribute set. | +
| 113 | +Error while adding group to attribute set. Details in error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_attribute_set.groupAdd', array('attributeSetId' => '9', 'groupName' => 'new_group'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetGroupAdd($sessionId, '9', 'new_group');
+var_dump($result);
+ $proxy = new SoapClient('http://maentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetGroupAdd((object)array('sessionId' => $sessionId->result, 'attributeSetId' => '9', 'groupName' => 'new_group'));
+var_dump($result->result);
+ Allows you to remove a group from an attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeGroupId | +Group ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the group is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 108 | +Attribute group with requested id does not exist. | +
| 115 | +Error while removing group from attribute set. Details in error message. | +
| 116 | +Group can not be removed as it contains system attributes. | +
| 117 | +Group can not be removed as it contains attributes, used in configurable products. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$groupId = 70;
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupRemove",
+ array(
+ $groupId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetGroupRemove($sessionId, '70');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetGroupRemove((object)array('sessionId' => $sessionId->result, 'attributeGroupId' => '70'));
+var_dump($result->result);
+ Allows you to rename a group in the attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+groupId | +ID of the group that will be renamed | +
| string | +groupName | +New name for the group | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the group is renamed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 108 | +Attribute group with requested id does not exist. | +
| 114 | +Error while renaming group. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$groupId = 100;
+$groupName = "New Group";
+
+echo "Renaming group...";
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupRename",
+ array(
+ $groupId,
+ $groupName
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetGroupRename($sessionId, '100', 'New Group');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetGroupRename((object)array('sessionId' => $sessionId->result, 'groupId' => '100', 'groupName' => 'New Group'));
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of product attribute sets.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductAttributeSetEntity | +
The catalogProductAttributeSetEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +set_id | +ID of the attribute set | +
| string | +name | +Attribute set name | +
Faults:
+ +No faults.
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_set.list');
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'set_id' => string '4' (length=1) + 'name' => string 'Default' (length=7) + 1 => + array + 'set_id' => string '9' (length=1) + 'name' => string 'products_set' (length=12)+
Allows you to remove an existing attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeSetId | +Attribute set ID | +
| string |
+forceProductsRemove | +Force product remove flag (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean\int | +isRemoved | +True (1) if the attribute set is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 103 | +Error while removing attribute set. Details in error message. | +
| 104 | +Attribute set with requested id does not exist. | +
| 105 | +Unable to remove attribute set as it has related goods. Use forceProductsRemove parameter to remove attribute set with all goods. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setId = 5;
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.remove",
+ array(
+ $setId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetRemove($sessionId, '5');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetRemove((object)array('sessionId' => $sessionId->result, 'attributeSetId' => '5'));
+var_dump($result->result);
+ Aliases: product_custom_option
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 102 | +Provided data is invalid. | +
| 103 | +Error while saving an option. Details are in the error message. | +
| 104 | +Store with requested code/id does not exist. | +
| 105 | +Option with requested id does not exist. | +
| 106 | +Invalid option type provided. Call 'types' to get list of allowed option types. | +
| 107 | +Error while deleting an option. Details are in the error message. | +
Allows you to add a new custom option for a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+productId | +Product ID | +
| array | +data | +Array of catalogProductCustomOptionToAdd | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the custom option is added | +
The catalogProductCustomOptionToAdd content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Option title | +
| string |
+ type |
+Option type | +
| string |
+ sort_order |
+Option sort order | +
| int | + is_require |
+Defines whether the option is required | +
| array | + additional_fields |
+Array of catalogProductCustomOptionAdditionalFields | +
The catalogProductCustomOptionAdditionalFieldsEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option title | +
| string |
+ price |
+Custom option price | +
| string |
+ price_type |
+ Price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option SKU |
+
| string |
+ max_characters |
+ Maximum number of characters for the customer input on the frontend (optional) |
+
| string |
+ sort_order |
+Custom option sort order | +
| string |
+ file_extension |
+ List of file extensions allowed to upload by the user on the frontend (optional) |
+
| string |
+ image_size_x |
+ Width limit for uploaded images (optional) |
+
| string |
+ image_size_y |
+ Height limit for uploaded images (optional) |
+
| string |
+ value_id |
+Value ID | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 102 | +Provided data is invalid. | +
| 103 | +Error while saving an option. Details are in the error message. | +
| 104 | +Store with requested code/id does not exist. | +
| 106 | +Invalid option type provided. Call 'types' to get list of allowed option types. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$productId = 1;// Existing product ID
+
+// Add custom option of Text Field type
+$customTextFieldOption = array(
+ "title" => "Custom Text Field Option Title",
+ "type" => "field",
+ "is_require" => 1,
+ "sort_order" => 0,
+ "additional_fields" => array(
+ array(
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_text_option_sku",
+ "max_characters" => 255
+ )
+ )
+);
+$resultCustomTextFieldOptionAdd = $proxy->call(
+ $sessionId,
+ "product_custom_option.add",
+ array(
+ $productId,
+ $customTextFieldOption
+ )
+);
+
+// Add custom option of File type
+$customFileOption = array(
+ "title" => "Custom File Option Title",
+ "type" => "file",
+ "is_require" => 1,
+ "sort_order" => 5,
+ "additional_fields" => array(
+ array(
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_file_option_sku",
+ "file_extension" => "jpg",
+ "image_size_x" => 800,
+ "image_size_y" => 600
+ )
+ )
+);
+$resultCustomFileOptionAdd = $proxy->call(
+ $sessionId,
+ "product_custom_option.add",
+ array(
+ $productId,
+ $customFileOption
+ )
+);
+
+// Add custom option of Dropdown type
+$customDropdownOption = array(
+ "title" => "Custom Dropdown Option Title",
+ "type" => "drop_down",
+ "is_require" => 1,
+ "sort_order" => 10,
+ "additional_fields" => array(
+ array(
+ "title" => "Dropdown row #1",
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_select_option_sku_1",
+ "sort_order" => 0
+ ),
+ array(
+ "title" => "Dropdown row #2",
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_select_option_sku_2",
+ "sort_order" => 5
+ )
+ )
+);
+$resultCustomDropdownOptionAdd = $proxy->call(
+ $sessionId,
+ "product_custom_option.add",
+ array(
+ $productId,
+ $customDropdownOption
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductCustomOptionAdd($sessionId, '1', array('title' => 'title',
+'type' => 'field',
+'sort_order' => '1',
+'is_require' => 1,
+'additional_fields' => array(array(
+'price' => '15',
+'price_type' => 'fixed',
+'sku' => 'sku',
+'max_characters' => '100'
+))));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionAdd((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'store' => '1', 'data' => ((object)array(
+'title' => 'title',
+'type' => 'field',
+'sort_order' => '1',
+'is_require' => 1,
+'additional_fields' => array(array(
+'price' => '15',
+'price_type' => 'fixed',
+'sku' => 'sku',
+'max_characters' => '100'
+))))));
+var_dump($result->result);
+ Allows you to retrieve full information about the custom option in a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +optionId | +Option ID | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductCustomOptionInfoEntity | +
The catalogProductCustomOptionInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option title | +
| string |
+ type |
+ Custom option type. Can have one of the following values: "fixed" or "percent" |
+
| string |
+ sort_order |
+Custom option sort order | +
| int | + is_require |
+Defines whether the custom option is required | +
| array | + additional_fields |
+Array of catalogProductCustomOptionAdditionalFields | +
The catalogProductCustomOptionAdditionalFields content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option title | +
| string |
+ price |
+Custom option price | +
| string |
+ price_type |
+ Price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option SKU |
+
| string |
+ max_characters |
+ Maximum number of characters for the customer input on the frontend (optional) |
+
| string |
+ sort_order |
+Custom option sort order | +
| string |
+ file_extension |
+ List of file extensions allowed to upload by the user on the frontend (optional; for the File input type) |
+
| string |
+ image_size_x |
+ Width limit for uploaded images (optional; for the File input type) |
+
| string |
+ image_size_y |
+ Height limit for uploaded images (optional; for the File input type) |
+
| string |
+ value_id |
+Value ID | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 104 | +Store with requested code/id does not exist. | +
| 105 | +Option with requested id does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option.info', '1');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionInfo($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionInfo((object)array('sessionId' => $sessionId->result, 'optionId' => '1'));
+var_dump($result->result);
+ array + 'title' => string 'model' (length=5) + 'type' => string 'drop_down' (length=9) + 'is_require' => string '1' (length=1) + 'sort_order' => string '0' (length=1) + 'additional_fields' => + array + 0 => + array + 'value_id' => string '1' (length=1) + 'title' => string 'monoblock' (length=9) + 'price' => string '139.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'sku' => string 'monoblock' (length=9) + 'sort_order' => string '0' (length=1) + 1 => + array + 'value_id' => string '2' (length=1) + 'title' => string 'slider' (length=6) + 'price' => string '239.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'sku' => string 'slider' (length=6) + 'sort_order' => string '0' (length=1)+
Allows you to retrieve the list of custom options for a specific product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+productId | +Product ID | +
| string | +store | +Store view ID or code (optional but required for WS-I mode) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | + Array of catalogProductCustomOptionList |
+
The catalogProductCustomOptionList content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +option_id | +Custom option ID | +
| string |
+ title |
+Custom option title | +
| string |
+ type |
+Custom option type | +
| string |
+ sort_order |
+Custom option sort order | +
| int | + is_require |
+Defines whether the custom option is required | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 104 | +Store with requested code/id does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option.list', '1');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionList($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionList((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'store' => '1'));
+var_dump($result->result);
+ array + 0 => + array + 'option_id' => string '1' (length=1) + 'title' => string 'model' (length=5) + 'type' => string 'drop_down' (length=9) + 'is_require' => string '1' (length=1) + 'sort_order' => string '0' (length=1)+
Allows you to remove a custom option from the product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +optionId | +Custom option ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the custom option is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 105 | +Option with requested id does not exist. | +
| 107 | +Error while deleting an option. Details are in the error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$optionId = 1;// Existing option ID
+
+$result = $proxy->call(
+ $sessionId,
+ "product_custom_option.remove",
+ array(
+ $optionId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionRemove($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionRemove((object)array('sessionId' => $sessionId->result, 'optionId' => '1'));
+var_dump($result->result);
+ Allows you to retrieve the list of available custom option types.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductCustomOptionTypes | +
The catalogProductCustomOptionTypesEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Custom option label | +
| string | + value |
+Custom option value | +
Faults:
+ +No faults
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option.types');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionTypes($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionTypes((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'label' => string 'Field' (length=5) + 'value' => string 'field' (length=5) + 1 => + array + 'label' => string 'Area' (length=4) + 'value' => string 'area' (length=4) + 2 => + array + 'label' => string 'File' (length=4) + 'value' => string 'file' (length=4) + 3 => + array + 'label' => string 'Drop-down' (length=9) + 'value' => string 'drop_down' (length=9) + 4 => + array + 'label' => string 'Radio Buttons' (length=13) + 'value' => string 'radio' (length=5) + 5 => + array + 'label' => string 'Checkbox' (length=8) + 'value' => string 'checkbox' (length=8) + 6 => + array + 'label' => string 'Multiple Select' (length=15) + 'value' => string 'multiple' (length=8) + 7 => + array + 'label' => string 'Date' (length=4) + 'value' => string 'date' (length=4) + 8 => + array + 'label' => string 'Date & Time' (length=11) + 'value' => string 'date_time' (length=9) + 9 => + array + 'label' => string 'Time' (length=4) + 'value' => string 'time' (length=4)+
Allows you to update the required product custom option.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +optionId | +Option ID | +
| array | +data | +Array of catalogProductCustomOptionToUpdate | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the custom option is updated | +
The catalogProductCustomOptionToUpdate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Title of the custom option to be updated | +
| string |
+ type |
+Custom option type | +
| string |
+ sort_order |
+Custom option sort order | +
| int | + is_require |
+Defines whether the custom option is required | +
| array | + additional_fields |
+Array of catalogProductCustomOptionAdditionalFields | +
The catalogProductCustomOptionAdditionalFields content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option title | +
| string |
+ price |
+Custom option price | +
| string |
+ price_type |
+ Price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option SKU |
+
| string |
+ max_characters |
+ Maximum number of characters for the customer input on the frontend (optional) |
+
| string |
+ sort_order |
+Custom option sort order | +
| string |
+ file_extension |
+ List of file extensions allowed to upload by the user on the frontend (optional; for the File input type) |
+
| string |
+ image_size_x |
+ Width limit for uploaded images (optional; for the File input type) |
+
| string |
+ image_size_y |
+ Height limit for uploaded images (optional; for the File input type) |
+
| string |
+ value_id |
+Value ID | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 102 | +Provided data is invalid. | +
| 103 | +Error while saving an option. Details are in the error message. | +
| 104 | +Store with requested code/id does not exist. | +
| 105 | +Option with requested id does not exist. | +
| 106 | +Invalid option type provided. Call 'types' to get list of allowed option types. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$selectOptionId = 1379;
+$selectOptionValueId = 794;
+$textOptionId = 1380;
+$fileOptionId = 1381;
+
+// Update custom option of Text Field type
+$customTextFieldOption = array(
+ "title" => "Custom Text Field Option Title Updated",
+ "type" => "field",
+ "is_require" => 1,
+ "sort_order" => 20,
+ "additional_fields" => array(
+ array(
+ "price" => 13.00,
+ "price_type" => "fixed",
+ "sku" => "custom_text_option_sku_updated",
+ "max_characters" => 127
+ )
+ )
+);
+$resultCustomTextFieldOptionUpdate = $proxy->call(
+ $sessionId,
+ "product_custom_option.update",
+ array(
+ $textOptionId,
+ $customTextFieldOption
+ )
+);
+
+// Update custom option of File type
+$customFileOption = array(
+ "title" => "Custom File Option Title Updated",
+ "additional_fields" => array(
+ array(
+ "image_size_x" => 800,
+ "image_size_y" => 999
+ )
+ )
+);
+$resultCustomFileOptionUpdate = $proxy->call(
+ $sessionId,
+ "product_custom_option.update",
+ array(
+ $fileOptionId,
+ $customFileOption
+ )
+);
+
+
+// Update custom option of Dropdown type
+$customDropdownOption = array(
+ "title" => "Custom Dropdown Option Title Updated to Multiselect",
+ "type" => "multiple",
+ "additional_fields" => array(
+ array(
+ "value_id" => $selectOptionValueId,
+ "price" => 14.00,
+ "price_type" => 'percent',
+ "sku" => "custom_select_option_sku_1 updated",
+ "sort_order" => 26
+ )
+ )
+);
+$resultCustomDropdownOptionUpdate = $proxy->call(
+ $sessionId,
+ "product_custom_option.update",
+ array(
+ $selectOptionId,
+ $customDropdownOption
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductCustomOptionUpdate($sessionId, '1', array(
+'title' => 'title_updated',
+'is_require' => 0,
+'sort_order' => '2'
+));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionUpdate((object)array('sessionId' => $sessionId->result, 'optionId' => '1', 'data' => ((object)array(
+'title' => 'title_updated',
+'is_require' => 0,
+'sort_order' => '2'
+))));
+var_dump($result->result);
+ Aliases: product_custom_option_value
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Option value with requested id does not exist. | +
| 102 | +Error while adding an option value. Details are in the error message. | +
| 103 | +Option with requested id does not exist. | +
| 104 | +Invalid option type. | +
| 105 | +Store with requested code/id does not exist. | +
| 106 | +Can not delete option. | +
| 107 | +Error while updating an option value. Details are in the error message. | +
| 108 | +Title field is required. | +
| 109 | +Option should have at least one value. Can not delete last value. | +
Allows you to add a new custom option value to a custom option. Note that the custom option value can be added only to the option with the Select Input Type.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + optionId |
+Option ID | +
| array | +data | +Array of catalogProductCustomOptionValueAdd | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the custom option value is added | +
The catalogProductCustomOptionValueAdd content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option value title | +
| string |
+ price |
+Custom option value price | +
| string |
+ price_type |
+Type of the custom option value price. Can have one of the following values: "fixed" or "percent" | +
| string |
+ sku |
+Custom option value row SKU | +
| string |
+ sort_order |
+Custom option value sort order | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Option value with requested id does not exist. | +
| 102 | +Error while adding an option value. Details are in the error message. | +
| 104 | +Invalid option type. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$productOptionId = 1;// Existing product option ID
+
+// Add custom option value
+$customOptionValue = array(
+ "title" => "Some value text 1",
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_text_option_sku",
+ "sort_order" => 0
+);
+$resultCustomOptionValueAdd = $proxy->call(
+ $sessionId,
+ "product_custom_option_value.add",
+ array(
+ $productOptionId,
+ array($customOptionValue)
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductCustomOptionValueAdd($sessionId, '10', array(array(
+'title' => 'value',
+'price' => '99.99',
+'price_type' => 'fixed',
+'sku' => 'sku',
+'sort_order' => '1'
+)));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueAdd((object)array('sessionId' => $sessionId->result, 'optionId' => '10', 'data' => array(array(
+'title' => 'value',
+'price' => '99.99',
+'price_type' => 'fixed',
+'sku' => 'sku',
+'sort_order' => '1'
+))));
+var_dump($result->result);
+ Allows you to retrieve full information about the specified product custom option value.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +valueId | +Value ID | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array |
+result | +Array of catalogProductCustomOptionValueInfoEntity | +
The catalogProductCustomOptionValueInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + value_id |
+ Option value ID |
+
| string |
+ option_id |
+Option ID | +
| string |
+ sku |
+ Custom option value row SKU |
+
| string |
+ sort_order |
+Option value sort order | +
| string |
+ default_price |
+ Option value default price |
+
| string |
+ default_price_type |
+ Default price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ store_price |
+ Option value store price |
+
| string |
+ store_price_type |
+ Store price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ price |
+Option value price | +
| string |
+ price_type |
+Price type. Possible values are as follows: "fixed" or "percent" | +
| string |
+ default_title |
+Option value default title | +
| string |
+ store_title |
+Option value store title | +
| string |
+ title |
+Option value title | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | + Option value with requested id does not exist. |
+
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option_value.info', '5');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionValueInfo($sessionId, '5');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueInfo((object)array('sessionId' => $sessionId->result, 'valueId' => '5'));
+
+var_dump($result->result);
+ array + 'option_id' => string '5' (length=1) + 'sku' => string 'slider' (length=6) + 'sort_order' => string '0' (length=1) + 'default_title' => string 'slider' (length=6) + 'store_title' => string 'slider' (length=6) + 'title' => string 'slider' (length=6) + 'default_price' => string '239.9900' (length=8) + 'default_price_type' => string 'fixed' (length=5) + 'store_price' => string '239.9900' (length=8) + 'store_price_type' => string 'fixed' (length=5) + 'price' => string '239.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'value_id' => string '2' (length=1)+
Allows you to retrieve the list of product custom option values. Note that the method is available only for the option Select Input Type.
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+optionId | +Option ID | +
| string | +store | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array |
+result | +Array of catalogProductCustomOptionValueList | +
The catalogProductCustomOptionValueListEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +value_id | +Custom option value ID | +
| string |
+ title |
+Custom option value title | +
| string |
+ price |
+ Option value price |
+
| string |
+ price_type |
+ Price type. Possible values: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option value SKU |
+
| string |
+ sort_order |
+ Option value sort order (optional) |
+
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Provided data is invalid. | +
| 102 | +Error while adding an option value. Details are in the error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option_value.list', '3');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionValueList($sessionId, '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueList((object)array('sessionId' => $sessionId->result, 'optionId' => '3'));
+
+var_dump($result->result);
+ array + 0 => + array + 'value_id' => string '1' (length=1) + 'title' => string 'monoblock' (length=9) + 'price' => string '139.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'sku' => string 'monoblock' (length=9) + 'sort_order' => string '0' (length=1) + 1 => + array + 'value_id' => string '2' (length=1) + 'title' => string 'slider' (length=6) + 'price' => string '239.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'sku' => string 'slider' (length=6) + 'sort_order' => string '0' (length=1)+
Allows you to remove the custom option value from a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+valueId | +Custom option value ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the custom option value is removed | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 103 | +Option with requested id does not exist. | +
| 106 | +Can not delete option. | +
| 109 | +Option should have at least one value. Can not delete last value. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productOptionId = 4;// Existing option ID
+// Get last value from option values list
+$optionValues = $proxy->call($sessionId, "product_custom_option_value.list", array($productOptionId));
+$optionValue = reset($optionValues);
+$valueId = $optionValue['value_id'];
+
+$result = $proxy->call(
+ $sessionId,
+ "product_custom_option_value.remove",
+ array(
+ $valueId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionValueRemove($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueRemove((object)array('sessionId' => $sessionId->result, 'valueId' => '4'));
+var_dump($result->result);
+ Allows you to update the product custom option value.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+valueId | +Value ID | +
| array | +data | +Array of catalogProductCustomOptionValueUpdateEntity | +
| string | +storeId | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the custom option value is updated | +
The catalogProductCustomOptionValueUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Option value title | +
| string |
+ price |
+Option value price | +
| string |
+ price_type |
+ Price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option value row SKU |
+
| string |
+ sort_order |
+Custom option value sort order | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Option value with requested id does not exist. | +
| 103 | +Option with requested id does not exist. | +
| 104 | +Invalid option type. | +
| 107 | +Error while updating an option value. Details are in the error message. | +
| 108 | +Title field is required. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productOptionId = 1;// Existing option ID
+
+// Get last value from option values list
+$optionValues = $proxy->call($sessionId, "product_custom_option_value.list", array($productOptionId));
+$optionValue = reset($optionValues);
+$valueId = $optionValue['value_id'];
+// Update custom option value
+$customOptionValue = array(
+ "title" => "new title",
+ "price" => 12.00,
+ "price_type" => "percent",
+ "sku" => "custom_text_option_2",
+ "sort_order" => 2
+);
+$resultCustomOptionValueUpdate = $proxy->call(
+ $sessionId,
+ "product_custom_option_value.update",
+ array(
+ $valueId,
+ $customOptionValue
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductCustomOptionValueUpdate($sessionId, '2', array(
+'title' => 'value',
+'price' => '20',
+'price_type' => 'fixed',
+'sku' => 'sku'
+));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueUpdate((object)array('sessionId' => $sessionId->result, 'valueId' => '2', 'data' => ((object)array(
+'title' => 'value',
+'sku' => 'sku',
+'price' => '199',
+'price_type' => 'percent'
+))));
+
+var_dump($result->result);
+ Allows you to add a new link to a downloadable product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + productId |
+Product ID | +
| array | + resource |
+Array of catalogProductDownloadableLinkAddEntity | +
| string | + resourceType |
+Resource type. Can have one of the following values: "sample" or "link". | +
| string | + store |
+Store view ID or code (optional) | +
| string | + identifierType |
+Type of the product identifier. Can have one of the following values: "sku" or "id". | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +Result of adding a link to the downloadable product | +
The catalogProductDownloadableLinkAddEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Link title | +
| string | + price |
+Custom option value row price | +
| int | + is_unlimited |
+Defines whether the number of downloads is unlimited | +
| int | + number_of_downloads |
+Maximum number of possible downloads | +
| int | + is_shareable |
+Defines whether the link is shareable | +
| array | + sample |
+Array of catalogProductDownloadableLinkAddSampleEntity | +
| string | + type |
+Type of the data source. Can have one of the following values: "file" or "url" | +
| array | + file |
+Array of catalogProductDownloadableLinkFileEntity | +
| string | + link_url |
+Link URL address | +
| string | + sample_url |
+Sample URL address | +
| int | + sort_order |
+Link sort order | +
The catalogProductDownloadableLinkAddSampleEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +type | + Type of the data source. Can have one of the following values: "file" or "url" |
+
| array | + file |
+Array of catalogProductDownloadableLinkFileEntity | +
| string | + url |
+URL to upload | +
The catalogProductDownloadableLinkFileEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + name |
+File name | +
| string | + base64_content |
+ BASE64 encoded file |
+
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 414 | + Unable to save action. Details in error message. |
+
| 415 | + Validation error has occurred. |
+
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$filesPath = '/var/www/ws/tests/WebService/etc/Modules/Downloadable/Product/Link';
+$downloadableProductId = 'downloadable_demo_product';
+
+$items = array(
+ 'small' => array(
+ 'link' => array(
+ 'title' => 'Test file',
+ 'price' => '123',
+ 'is_unlimited' => '1',
+ 'number_of_downloads' => '111',
+ 'is_shareable' => '0',
+ 'sample' => array(
+ 'type' => 'file',
+ 'file' =>
+ array(
+ 'filename' => 'files/test.txt',
+ ),
+ 'url' => 'http://www.magentocommerce.com/img/logo.gif',
+ ),
+ 'type' => 'file',
+ 'file' =>
+ array(
+ 'filename' => 'files/test.txt',
+ ),
+ 'link_url' => 'http://www.magentocommerce.com/img/logo.gif',
+ ),
+ 'sample' => array(
+ 'title' => 'Test sample file',
+ 'type' => 'file',
+ 'file' => array(
+ 'filename' => 'files/image.jpg',
+ ),
+ 'sample_url' => 'http://www.magentocommerce.com/img/logo.gif',
+ 'sort_order' => '3',
+ )
+ ),
+ 'big' => array(
+ 'link' => array(
+ 'title' => 'Test url',
+ 'price' => '123',
+ 'is_unlimited' => '0',
+ 'number_of_downloads' => '111',
+ 'is_shareable' => '1',
+ 'sample' => array(
+ 'type' => 'url',
+ 'file' => array(
+ 'filename' => 'files/book.pdf',
+ ),
+ 'url' => 'http://www.magentocommerce.com/img/logo.gif',
+ ),
+ 'type' => 'url',
+ 'file' => array(
+ 'filename' => 'files/song.mp3',
+ ),
+ 'link_url' => 'http://www.magentocommerce.com/img/logo.gif',
+ ),
+ 'sample' => array(
+ 'title' => 'Test sample url',
+ 'type' => 'url',
+ 'file' => array(
+ 'filename' => 'files/image.jpg',
+ ),
+ 'sample_url' => 'http://www.magentocommerce.com/img/logo.gif',
+ 'sort_order' => '3',
+ )
+ )
+);
+
+$result = true;
+foreach ($items as $item) {
+ foreach ($item as $key => $value) {
+ if ($value['type'] == 'file') {
+ $filePath = $filesPath . '/' . $value['file']['filename'];
+ $value['file'] = array('name' => str_replace('/', '_', $value['file']['filename']), 'base64_content' => base64_encode(file_get_contents($filePath)), 'type' => $value['type']);
+ }
+ if ($value['sample']['type'] == 'file') {
+ $filePath = $filesPath . '/' . $value['sample']['file']['filename'];
+ $value['sample']['file'] = array('name' => str_replace('/', '_', $value['sample']['file']['filename']), 'base64_content' => base64_encode(file_get_contents($filePath)));
+ }
+ if (!$proxy->call(
+ $sessionId,
+ 'product_downloadable_link.add',
+ array($downloadableProductId, $value, $key)
+ )
+ ) {
+ $result = false;
+ }
+ }
+}
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDownloadableLinkAdd((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'resourceType' => 'link', 'resource' => ((object)array(
+'title' => 'link',
+'price' => '10.99',
+'sample' => array(
+'type' => 'url',
+'url' => 'http://sometesturl.com')
+))));
+
+var_dump($result->result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDownloadableLinkAdd((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'resourceType' => 'link', 'resource' => ((object)array(
+'title' => 'link_2',
+'price' => '11.99',
+'type' => 'file',
+'file' => array(
+'name' => 'file_test',
+'base64_content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z'
+)
+))));
+
+var_dump($result->result);
+ Allows you to retrieve a list of links of a downloadable product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +productId | +Product ID or SKU | +
| string | +store | +Store view ID or code (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the request | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductDownloadableLinkListEntity | +
The catalogProductDownloadableLinkListEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +links | +Array of catalogProductDownloadableLinkEntity | +
| array | +samples | +Array of catalogProductDownloadableLinkSampleEntity | +
The catalogProductDownloadableLinkEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + link_id |
+Link ID | +
| string | + title |
+Link title | +
| string | + price |
+ Downloadable link price value |
+
| int | + number_of_downloads |
+Maximum number of possible downloads | +
| int | + is_unlimited |
+Defines whether the number of downloads is unlimited | +
| int | + is_shareable |
+Defines whether the link is shareable | +
| string | + link_url |
+Link URL address | +
| string | + link_type |
+ Type of the link data source. Can have one of the following values: "file" or "url" |
+
| string | + sample_file |
+Sample file name | +
| string | + sample_url |
+Sample URL | +
| string | + sample_type |
+ Type of sample data source. Can have one of the following values: "file" or "url" |
+
| int | + sort_order |
+Link sort order | +
| array | + file_save |
+Array of catalogProductDownloadableLinkFileInfoEntity | +
| array | + sample_file_save |
+Array of catalogProductDownloadableLinkFileInfoEntity | +
The catalogProductDownloadableLinkSampleEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sample_id |
+Sample ID | +
| string |
+ product_id |
+Product ID | +
| string |
+ sample_file |
+Sample file name | +
| string |
+ sample_url |
+Sample URL | +
| string |
+ sample_type |
+Sample type. Can have one of the following values: "file" or "url" | +
| string |
+ sort_order |
+Sort order | +
| string |
+ default_title |
+Default title | +
| string |
+ store_title |
+Store title | +
| string |
+ title |
+Sample title | +
The catalogProductDownloadableLinkFileInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + file |
+File | +
| string | + name |
+File name | +
| int | + size |
+File size | +
| string | + status |
+Status | +
Faults:
+No Faults
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$downloadableProductId = '5';
+
+$resultList = $proxy->call(
+ $sessionId,
+ 'product_downloadable_link.list',
+ array($downloadableProductId)
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductDownloadableLinkList($sessionId, '5', null, 'sku');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDownloadableLinkList((object)array('sessionId' => $sessionId->result, 'productId' => '5'));
+
+var_dump($result->result);
+ array + 'links' => + array + 0 => + array + 'link_id' => string '1' (length=1) + 'title' => string 'link 1' (length=11) + 'price' => string '30.0000' (length=7) + 'number_of_downloads' => string '0' (length=1) + 'is_shareable' => string '1' (length=1) + 'link_url' => null + 'link_type' => string 'file' (length=4) + 'sample_file' => string '/s/o/software.jpg' (length=17) + 'sample_url' => null + 'sample_type' => string 'file' (length=4) + 'sort_order' => string '1' (length=1) + 'file_save' => + array + ... + 'sample_file_save' => + array + ... + 'is_unlimited' => int 1 + 'samples' => + array + 0 => + array + 'sample_id' => string '1' (length=1) + 'product_id' => string '5' (length=1) + 'sample_url' => null + 'sample_file' => string '/s/o/software.jpg' (length=17) + 'sample_type' => string 'file' (length=4) + 'sort_order' => string '2' (length=1) + 'default_title' => string 'Sample 1' (length=8) + 'store_title' => string 'Sample 1' (length=8) + 'title' => string 'Sample 1' (length=8)+
Allows you to remove a link/sample from a downloadable product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +linkId/sampleId | +Link/sample ID | +
| string | +resourceType | +Resource type. Can have one of the following values: 'sample' or 'link' | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the link/sample is removed from a downloadable product | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 412 | + Link or sample with specified ID was not found. |
+
| 415 | + Validation error has occurred. |
+
| 416 | + Unable to remove link. Details in error message. |
+
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$sampleId = 7;
+$linkId = 9;
+
+$resultSample = $proxy->call(
+Â Â $sessionId,
+Â Â 'product_downloadable_link.remove',
+Â Â array($sampleId, 'sample')
+);
+
+$resultLink = $proxy->call(
+Â Â $sessionId,
+Â Â 'product_downloadable_link.remove',
+Â Â array($linkId, 'link')
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductDownloadableLinkRemove($sessionId, '7', 'sample');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDownloadableLinkRemove((object)array('sessionId' => $sessionId->result, 'linkId' => '7', 'resourceType' => 'sample'));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage links for products, including related, cross-sells, up-sells, and grouped.
+ +Resource Name: catalog_product_link
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Given invalid link type. | +
| 101 | +Product not exists. | +
| 102 | +Invalid data given. Details in error message. | +
| 104 | +Product link not removed. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Get list of related products
+var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
+
+// Assign related product
+$proxy->call($sessionId, 'product_link.assign', array('related', 'Sku', 'Sku2', array('position'=>0, 'qty'=>56)));
+
+var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
+
+// Update related product
+$proxy->call($sessionId, 'product_link.update', array('related', 'Sku', 'Sku2', array('position'=>2)));
+
+var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
+
+// Remove related product
+$proxy->call($sessionId, 'product_link.remove', array('related', 'Sku', 'Sku2'));
+
+var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
+ Aliases:
+Allows you to assign a product link (cross_sell, grouped, related, or up_sell) to another product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+ type |
+Type of the link (cross_sell, grouped, related, or up_sell) | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ linkedProduct\linkedProductId |
+Product ID or SKU for the link | +
| array | + data |
+Array of catalogProductLinkEntity | +
| string |
+ identifierType |
+Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the link is assigned to the product | +
The catalogProductLinkEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ type |
+Type of the link (cross_sell, grouped, related, or up_sell) | +
| string |
+ set |
+Product attribute set | +
| string |
+ sku |
+Product SKU | +
| string |
+ position |
+Position of the product | +
| string |
+ qty |
+Quantity of products | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apikey');
+
+$result = $client->call($session, 'catalog_product_link.assign', array('type' => 'related', 'product' => '1', 'linkedProduct' => '4'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkAssign($sessionId, 'related', '1', '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkAssign((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1', 'linkedProductId' => '4'));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the product link type attributes.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + type |
+Type of the link (cross_sell, up_sell, related, or grouped) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductLinkAttributeEntity | +
The catalogProductLinkAttributeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +code | +Attribute code | +
| string | +type | +Attribute type | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_link.attributes', 'related');
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkAttributes($sessionId, 'related');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkAttributes((object)array('sessionId' => $sessionId->result, 'type' => 'related'));
+
+var_dump($result->result);
+ array + 0 => + array + 'code' => string 'position' (length=8) + 'type' => string 'int' (length=3)+
Aliases:
+Allows you to retrieve the list of linked products for a specific product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + type |
+Type of the link (cross_sell, up_sell, related, or grouped) | +
| string | + product\productId |
+Product ID or SKU | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductLinkEntity | +
The catalogProductLinkEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ type |
+Type of the link | +
| string |
+ set |
+Product attribute set | +
| string |
+ sku |
+Product SKU | +
| string |
+ position |
+Position | +
| string |
+ qty |
+Quantity | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_link.list', array('type' => 'related', 'product' => '1'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkList($sessionId, 'related', '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkList((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1'));
+
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '3' (length=1) + 'type' => string 'simple' (length=6) + 'set' => string '4' (length=1) + 'sku' => string 'canonxt' (length=7) + 'position' => string '1' (length=1) + 1 => + array + 'product_id' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'set' => string '4' (length=1) + 'sku' => string 'canon_powershot' (length=15) + 'position' => string '0' (length=1)+
Aliases:
+Allows you to remove the product link from a specific product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ type |
+Type of the link (cross_sell, up_sell, related, or grouped) | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ linkedProduct\linkedProductId |
+Product ID or SKU for the link | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the link is removed from a product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_link.remove', array('type' => 'related', 'product' => '1', 'linkedProduct' => '4'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkRemove($sessionId, 'related', '1', '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkRemove((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1', 'linkedProductId' => '4'));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of product link types.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString | +result | +Array of link types | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_link.types');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkTypes($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkTypes((object)array('sessionId' => $sessionId->result));
+
+var_dump($result->result);
+ array + 0 => string 'related' (length=7) + 1 => string 'up_sell' (length=7) + 2 => string 'cross_sell' (length=10) + 3 => string 'grouped' (length=7)+
Aliases:
+Allows you to update the product link.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+ type |
+Type of the link (cross_sell, grouped, related, or up_sell) | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ linkedProduct\linkedProductId |
+Product ID or SKU for the link | +
| array | + data |
+Array of catalogProductLinkEntity | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean\int | +result | +True (1) if the link is updated | +
The catalogProductLinkEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ type |
+Type of the link | +
| string |
+ set |
+Product attribute set | +
| string |
+ sku |
+Product SKU | +
| string |
+ position |
+Position | +
| string |
+ qty |
+Quantity | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = '1';
+$linkedProductId = '2';
+$data = array(
+ 'position' => '50'
+);
+
+$result = $proxy->call(
+ $session,
+ 'catalog_product_link.update',
+ array(
+ 'cross_sell',
+ $productId,
+ $linkedProductId,
+ $data
+ )
+);
+ <?php
+
+$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$session = $client->login('apiUser', 'apiKey');
+
+$data = array(
+ "position" => 15
+ );
+
+$identifierType = "product_id";
+$type = "related";
+$product = "1";
+$linkedProduct = "3";
+
+$orders = $client->catalogProductLinkUpdate($session, $type, $product, $linkedProduct, $data, $identifierType);
+
+echo 'Number of results: ' . count($orders) . '<br/>';
+var_dump ($orders);
+?>
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkUpdate((object)array('sessionId' => $sessionId->result, 'type' => 'cross_sell', 'productId' => '1', 'linkedProductId' => '2', 'data' => ((object)array(
+'position' => '1'
+))));
+
+var_dump($result->result);
+ Allows you to operate with product tags.
+ + +Aliases: product_tag
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 102 | +Requested product does not exist. | +
| 103 | +Requested customer does not exist. | +
| 104 | +Requested tag does not exist. | +
| 105 | +Provided data is invalid. | +
| 106 | +Error while saving tag. Details in error message. | +
| 107 | +Error while removing tag. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$productId = 2;
+$customerId = 10002;
+$store = 'default';
+
+// Add tags
+$data = array('product_id' => $productId, 'store' => $store, 'customer_id' => $customerId, 'tag' => "First 'Second tag' Third");
+echo "Adding Tag... ";
+$addResult = $proxy->call(
+ $sessionId,
+ "product_tag.add",
+ array($data)
+);
+echo ((count($addResult) == 3) ? "Done!" : "Fail!");
+echo "<br />";
+print_r($addResult);
+$tagId = reset($addResult);
+
+// Get tag info
+echo "<br />Get Tag Info (id = $tagId)... ";
+$infoResult = $proxy->call(
+ $sessionId,
+ "product_tag.info",
+ array($tagId, $store)
+);
+echo "Done!<br />";
+print_r($infoResult);
+
+// Update tag data
+$data = array('status' => -1, 'base_popularity' => 12, 'name' => 'Changed name');
+echo "<br />Update Tag (id = $tagId)... ";
+$updateResult = $proxy->call(
+ $sessionId,
+ "product_tag.update",
+ array($tagId, $data, $store)
+);
+echo ($updateResult ? "Done!" : "Fail!");
+
+// Retrieve list of tags by product
+echo "<br />Tag list for product with id = $productId... ";
+$listResult = $proxy->call(
+ $sessionId,
+ "product_tag.list",
+ array($productId, $store)
+);
+echo (count($listResult) ? "Done!" : "Fail!");
+echo "<br />";
+print_r($listResult);
+
+// Remove existing tag
+echo "<br />Remove Tag (id = $tagId)... ";
+$removeResult = $proxy->call(
+ $sessionId,
+ "product_tag.remove",
+ array($tagId)
+);
+echo ($removeResult ? "Done!" : "Fail!");
+ Aliases: product_tag
+ + +Allows you to add one or more tags to a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +data | +Array of catalogProductTagAddEntity | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Associative array of added tags with the tag name as a key and the tag ID as a value | +
The catalogProductTagAddEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + tag |
+ Tag to be added (can contain several tags separated with white spaces). A tag that contains several words should be enclosed in single quotes. |
+
| string |
+ product_id |
+Product ID | +
| string |
+ customer_id |
+Customer ID | +
| string |
+ store |
+Store ID | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 102 | +Requested product does not exist. | +
| 103 | +Requested customer does not exist. | +
| 105 | +Provided data is invalid. | +
| 106 | +Error while saving tag. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$data = array('product_id' => 2, 'store' => 'default', 'customer_id' => 10002, 'tag' => "First 'Second tag' Third");
+echo "Adding Tag... ";
+$addResult = $proxy->call(
+ $sessionId,
+ "product_tag.add",
+ array($data)
+);
+echo ((count($addResult) == 3) ? "Done!" : "Fail!");
+echo "<br />";
+print_r($addResult);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductTagAdd($sessionId, array(
+'tag' => 'album',
+'product_id' => '3',
+'customer_id' => '1',
+'store' => '0'
+));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagAdd((object)array('sessionId' => $sessionId->result, 'data' => ((object)array(
+'tag' => 'album',
+'product_id' => '3',
+'customer_id' => '1',
+'store' => '0'
+))));
+var_dump($result->result);
+ Aliases: product_tag
+ + +Allows you to retrieve information about the required product tag.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +tagId | +Tag ID | +
| string | +store | +Store view code or ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductTagInfoEntity | +
The catalogProductTagInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +name | +Tag name | +
| string | +status | +Tag status | +
| string | +base_popularity | +Tag base popularity for a specific store | +
| associativeArray | +products | +Associative array of tagged products with related product ID as a key and popularity as a value | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 104 | +Requested tag does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_tag.info', array('tagId' => '4', 'store' => '2'));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductTagInfo($sessionId, '4', '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagInfo((object)array('sessionId' => $sessionId->result, 'tagId' => '4', 'store' => '2'));
+var_dump($result->result);
+ array + 'status' => string '1' (length=1) + 'name' => string 'digital' (length=7) + 'base_popularity' => int 0 + 'products' => + array + 1 => string '1' (length=1) + 3 => string '1' (length=1) + 4 => string '1' (length=1)+
Aliases: product_tag
+ + +Allows you to retrieve the list of tags for a specific product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +productId | +Product ID | +
| string | +store | +Store view code or ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductTagListEntity | +
The catalogProductTagListEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + tag_id |
+Tag ID | +
| string | + name |
+Tag name | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 102 | +Requested product does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_tag.list', array('productId' => '4', 'store' => '2'));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductTagList($sessionId, '4', '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagList((object)array('sessionId' => $sessionId->result, 'productId' => '4', 'store' => '2'));
+var_dump($result->result);
+ array + 3 => + array + 'tag_id' => string '3' (length=1) + 'name' => string 'canon' (length=5) + 4 => + array + 'tag_id' => string '4' (length=1) + 'name' => string 'digital' (length=7)+
Aliases: product_tag
+ + +Allows you to remove an existing product tag.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +tagId | +Tag ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the product tag is removed | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 104 | +Requested tag does not exist. | +
| 107 | +Error while removing tag. Details in error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_tag.remove', '3');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductTagRemove($sessionId, '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagRemove((object)array('sessionId' => $sessionId->result, 'tagId' => '3'));
+var_dump($result->result);
+ Aliases: product_tag
+ + +Allows you to update information about an existing product tag.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +tagId | +ID of the tag to be updated | +
| array | +data | +Array of catalogProductTagUpdateEntity | +
| string | +store | +Store view code or ID (optional; required for WS-I compliance mode) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product tag is updated | +
The catalogProductTagUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + name |
+Tag name | +
| string |
+ status |
+Tag status. Can have the following values: -1 - Disabled, 0 - Pending, 1- Approved | +
| string |
+ base_popularity |
+Tag base popularity | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 104 | +Requested tag does not exist. | +
| 105 | +Provided data is invalid. | +
| 106 | +Error while saving tag. Details in error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_tag.update', array('tagId' => '4', 'data' => array('name' => 'digital_1')));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+
+$sessionId = $proxy->login('apiUser', 'apiKey');Â
+Â
+$result = $proxy->catalogProductTagUpdate($sessionId, '1', array(
+'name' => 'tag',
+'status' => '1'
+)); Â Â
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagUpdate((object)array('sessionId' => $sessionId->result, 'tagId' => '1', 'store' => '0', 'data' => ((object)array(
+'name' => 'tag',
+'status' => '1',
+'base_popularity' => null
+))));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve and update product tier prices.
+ +Resource Name: catalog_product_attribute_tier_price
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Product not exists. | +
| 101 | +Invalid data given. Details in error message. | +
| 102 | +Tier prices not updated. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Get tier prices
+$tierPrices = $proxy->call($sessionId, 'product_tier_price.info', 'Sku');
+
+var_dump($tierPrices);
+
+// Add new
+$tierPrices[] = array(
+ 'website' => 'all',
+ 'customer_group_id' => 'all',
+ 'qty' => 68,
+ 'price' => 18.20
+);
+
+// Update tier prices
+$proxy->call($sessionId, 'product_tier_price.update', array('Sku', $tierPrices));
+
+// Compare values
+var_dump($proxy->call($sessionId, 'product_tier_price.info', 'Sku'));
+
+var_dump($tierPrices);
+ Aliases:
+Allows you to retrieve information about product tier prices.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + product\productId |
+Product ID or SKU | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductTierPriceEntity | +
The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+Customer group ID | +
| string | + website |
+Website | +
| int | + qty |
+Quantity of items to which the price will be applied | +
| double | + price |
+Price that each item will cost | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_tier_price.info', 'productId');
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$productId = 1;
+
+$result = $client->catalogProductAttributeTierPriceInfo(
+ $session,
+ $productId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeTierPriceInfo((object)array('sessionId' => $sessionId->result, 'productId' => '1'));
+
+var_dump($result->result);
+ array + 0 => + array + 'customer_group_id' => string '1' (length=1) + 'website' => string 'all' (length=3) + 'qty' => string '2.0000' (length=6) + 'price' => string '129.9900' (length=8)+
array + 0 => + object(stdClass)[2] + public 'customer_group_id' => string '0' (length=1) + public 'website' => string 'all' (length=3) + public 'qty' => int 5 + public 'price' => float 99 + 1 => + object(stdClass)[3] + public 'customer_group_id' => string '0' (length=1) + public 'website' => string 'all' (length=3) + public 'qty' => int 10 + public 'price' => float 98+
Aliases:
+Allows you to update the product tier prices.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + product\productId |
+Product ID or SKU | +
| array | + tierPrices |
+Array of catalogProductTierPriceEntity | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean\int | +result | +True (1) if the product tier price is updated | +
The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+Customer group ID | +
| string | + website |
+Website | +
| int | + qty |
+Quantity of items to which the price will be applied | +
| double | + price |
+Price that each item will cost | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 1;
+$tierPrices = array(
+ array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
+);
+
+$result = $proxy->call(
+ $sessionId,
+ 'product_attribute_tier_price.update',
+ array(
+ $productId,
+ $tierPrices
+ )
+);
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+
+$productId = 1;
+$tierPrices = array(
+ array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
+);
+
+$result = $proxy->catalogProductAttributeTierPriceUpdate(
+ $sessionId,
+ $productId,
+ $tierPrices
+);
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+
+$productId = 1;
+$tierPrices = array(
+ array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
+);
+
+$result = $proxy->catalogProductAttributeTierPriceUpdate((object)array(
+'sessionId' => $sessionId->result,
+'productId' => $productId,
+'tierPrices' => $tierPrices
+));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of product types.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductTypeEntity | +
The catalogProductTypeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +type | +Product type | +
| string | +label | +Product label in the Admin Panel | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_type.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductTypeList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTypeList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'type' => string 'simple' (length=6) + 'label' => string 'Simple Product' (length=14) + 1 => + array + 'type' => string 'grouped' (length=7) + 'label' => string 'Grouped Product' (length=15) + 2 => + array + 'type' => string 'configurable' (length=12) + 'label' => string 'Configurable Product' (length=20) + 3 => + array + 'type' => string 'virtual' (length=7) + 'label' => string 'Virtual Product' (length=15) + 4 => + array + 'type' => string 'bundle' (length=6) + 'label' => string 'Bundle Product' (length=14) + 5 => + array + 'type' => string 'downloadable' (length=12) + 'label' => string 'Downloadable Product' (length=20)+
The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve product types.
+ +Resource Name: catalog_product_type
+ +Aliases:
+Methods:
+$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$types = $proxy->call($sessionId, 'product_type.list');
+
+var_dump($types);
+ The Mage_CatalogInventory module allows you to retrieve and update stock attributes, such as status and quantity.
+ +Allows you to retrieve and update the stock data.
+ +Resource Name: cataloginventory_stock_item
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product not exists. | +
| 102 | +Product inventory not updated. Details in error message. | +
Change manage_stock setting to ‘off’ in the inventory area.
+ +$attributeSets = $client->call($session, ‘product_stock.update’, array(’SKU’,array(’manage_stock’=>'0’,’use_config_manage_stock’=>'0’)));
+ +The use_config_manage_stock unchecks the ‘Use Config Settings’ box which allows you to make changes to this product and not to use the global settings that are set by default.
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Get stock info
+var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
+
+// Update stock info
+$proxy->call($sessionId, 'product_stock.update', array('Sku', array('qty'=>50, 'is_in_stock'=>1)));
+
+var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
+ $client = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sid = $client->login('apiUser', 'apiKey');
+
+print_r(
+ $client->call(
+ $sid,
+ 'product_stock.list',
+ array(
+ array( // Notice the nested array
+ 'sku1',
+ 'sku2',
+ 'sku3',
+ ...
+ 'skuN'
+ )
+ )
+ )
+);
+ Aliases:
+Allows you to retrieve the list of stock data by product IDs.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| ArrayOfString |
+ products/productIds (for WS-I mode) |
+List of product IDs or SKUs | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogInventoryStockItemEntity | +
The catalogInventoryStockItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string | + sku |
+Product SKU | +
| string | + qty |
+Product quantity | +
| string | + is_in_stock |
+Defines whether the product is in stock | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cataloginventory_stock_item.list', '1');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogInventoryStockItemList($sessionId, array('1', '2'));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogInventoryStockItemList((object)array('sessionId' => $sessionId->result, 'productIds' => array(1,2)));
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '1' (length=1) + 'sku' => string 'n2610' (length=5) + 'qty' => string '98.0000' (length=7) + 'is_in_stock' => string '1' (length=1)+
Aliases:
+Allows you to update the required product stock data.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + product\productId |
+Product ID or SKU | +
| array | + data |
+Array of catalogInventoryStockItemUpdateEntity | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +Result of stock item updating | +
The catalogInventoryStockItemUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + qty |
+Quantity of items to be updated | +
| int | + is_in_stock |
+Defines whether the item is in stock | +
| int |
+ manage_stock |
+Manage stock flag | +
| int |
+ use_config_manage_stock |
+Use config manage stock | +
| int |
+ min_qty |
+Minimum quantity for items to be in stock | +
| int |
+ use_config_min_qty |
+Use config settings flag (value defined in the Inventory System Configuration) | +
| int |
+ min_sale_qty |
+Minimum quantity allowed in the shopping cart | +
| int |
+ use_config_min_sale_qty |
+Use config settings flag | +
| int |
+ max_sale_qty |
+Maximum quantity allowed in the shopping cart | +
| int |
+ use_config_max_sale_qty |
+Use config settings flag | +
| int |
+ is_qty_decimal |
+Defines whether the quantity is decimal | +
| int |
+ backorders |
+Backorders status | +
| int |
+ use_config_backorders |
+Use config settings flag (for backorders) | +
| int |
+ notify_stock_qty |
+Stock quantity below which a notification will appear | +
| int |
+ use_config_notify_stock_qty |
+Use config settings flag (for stock quantity) | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$productId = '1';
+$stockItemData = array(
+ 'qty' => '100',
+ 'is_in_stock ' => 1,
+ 'manage_stock ' => 1,
+ 'use_config_manage_stock' => 0,
+ 'min_qty' => 2,
+ 'use_config_min_qty ' => 0,
+ 'min_sale_qty' => 1,
+ 'use_config_min_sale_qty' => 0,
+ 'max_sale_qty' => 10,
+ 'use_config_max_sale_qty' => 0,
+ 'is_qty_decimal' => 0,
+ 'backorders' => 1,
+ 'use_config_backorders' => 0,
+ 'notify_stock_qty' => 10,
+ 'use_config_notify_stock_qty' => 0
+);
+
+$result = $client->call(
+ $session,
+ 'product_stock.update',
+ array(
+ $productId,
+ $stockItemData
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+Â
+$result = $proxy->catalogInventoryStockItemUpdate($sessionId, 1, array(
+'qty' => '49',
+'is_in_stock' => 1
+));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogInventoryStockItemUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'data' => array(
+'qty' => '49',
+'is_in_stock' => 1
+)));
+
+var_dump($result->result);
+ Allows you to create an empty shopping cart.
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + storeId |
+Store view ID or code (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| int | +ID of the created empty shopping cart | +
Faults:
+No Faults
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCreate($sessionId, '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCreate((object)array('sessionId' => $sessionId->result, 'store' => '3'));
+
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to manage shopping carts.
+ +Resource Name: cart
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1003 | +Can not create a quote. | +
| 1004 | +Can not create a quote because quote with such identifier is already exists | +
| 1005 | +You did not set all required agreements | +
| 1006 | +The checkout type is not valid. Select single checkout type. | +
| 1007 | +Checkout is not available for guest | +
| 1008 | +Can not create an order. | +
The following example illustrates the work with shopping cart (creation of a shopping cart, setting customer and customer addresses, adding products to the shopping cart, updating products in the shopping cart, removing products from the shopping cart, getting the list of products/shipping methods/payment methods, setting payment/shipping methods, adding/removing coupon, getting total prices/full information about shopping cart/list of licenses, and creating an order.
+$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Create a quote, get quote identifier
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+// Set customer, for example guest
+$customerAsGuest = array(
+ "firstname" => "testFirstname",
+ "lastname" => "testLastName",
+ "email" => "testEmail",
+ "website_id" => "0",
+ "store_id" => "0",
+ "mode" => "guest"
+);
+$resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customerAsGuest) );
+
+// Set customer addresses, for example guest's addresses
+$arrAddresses = array(
+ array(
+ "mode" => "shipping",
+ "firstname" => "testFirstname",
+ "lastname" => "testLastname",
+ "company" => "testCompany",
+ "street" => "testStreet",
+ "city" => "testCity",
+ "region" => "testRegion",
+ "postcode" => "testPostcode",
+ "country_id" => "id",
+ "telephone" => "0123456789",
+ "fax" => "0123456789",
+ "is_default_shipping" => 0,
+ "is_default_billing" => 0
+ ),
+ array(
+ "mode" => "billing",
+ "firstname" => "testFirstname",
+ "lastname" => "testLastname",
+ "company" => "testCompany",
+ "street" => "testStreet",
+ "city" => "testCity",
+ "region" => "testRegion",
+ "postcode" => "testPostcode",
+ "country_id" => "id",
+ "telephone" => "0123456789",
+ "fax" => "0123456789",
+ "is_default_shipping" => 0,
+ "is_default_billing" => 0
+ )
+);
+$resultCustomerAddresses = $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses));
+
+// add products into shopping cart
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts));
+
+// update product in shopping cart
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 5
+ ),
+);
+$resultCartProductUpdate = $proxy->call($sessionId, "cart_product.update", array($shoppingCartId, $arrProducts));
+
+// remove products from shopping cart, for example by SKU
+$arrProducts = array(
+ array(
+ "sku" => "testSKU"
+ ),
+);
+$resultCartProductRemove = $proxy->call($sessionId, "cart_product.remove", array($shoppingCartId, $arrProducts));
+
+// get list of products
+$shoppingCartProducts = $proxy->call($sessionId, "cart_product.list", array($shoppingCartId));
+print_r( $shoppingCartProducts );
+
+// get list of shipping methods
+$resultShippingMethods = $proxy->call($sessionId, "cart_shipping.list", array($shoppingCartId));
+print_r( $resultShippingMethods );
+
+// set shipping method
+$randShippingMethodIndex = rand(1, count($resultShippingMethods) );
+$shippingMethod = $resultShippingMethods[$randShippingMethodIndex]["code"];
+
+$resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod));
+
+// get list of payment methods
+$resultPaymentMethods = $proxy->call($sessionId, "cart_payment.list", array($shoppingCartId));
+print_r($resultPaymentMethods);
+
+// set payment method
+$paymentMethod = array(
+ "method" => "checkmo"
+);
+$resultPaymentMethod = $proxy->call($sessionId, "cart_payment.method", array($shoppingCartId, $paymentMethod));
+
+// add coupon
+$couponCode = "aCouponCode";
+$resultCartCouponRemove = $proxy->call($sessionId, "cart_coupon.add", array($shoppingCartId, $couponCode));
+
+// remove coupon
+$resultCartCouponRemove = $proxy->call($sessionId, "cart_coupon.remove", array($shoppingCartId));
+
+// get total prices
+$shoppingCartTotals = $proxy->call($sessionId, "cart.totals", array($shoppingCartId));
+print_r( $shoppingCartTotals );
+
+// get full information about shopping cart
+$shoppingCartInfo = $proxy->call($sessionId, "cart.info", array($shoppingCartId));
+print_r( $shoppingCartInfo );
+
+// get list of licenses
+$shoppingCartLicenses = $proxy->call($sessionId, "cart.licenseAgreement", array($shoppingCartId));
+print_r( $shoppingCartLicences );
+
+// check if license is existed
+$licenseForOrderCreation = null;
+if (count($shoppingCartLicenses)) {
+ $licenseForOrderCreation = array();
+ foreach ($shoppingCartLicenses as $license) {
+ $licenseForOrderCreation[] = $license['agreement_id'];
+ }
+}
+
+// create order
+$resultOrderCreation = $proxy->call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation));
+ Allows you to retrieve full information about the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | +quoteId | +Shopping cart ID (quote ID) | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartInfoEntity | +
The shoppingCartInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + store_id |
+Store ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ converted_at |
+Date of conversion | +
| int | + quote_id |
+Quote ID | +
| int | + is_active |
+Active flag | +
| int | + is_virtual |
+Defines whether the product is a virtual one | +
| int | + is_multi_shipping |
+Defines whether multi shipping is available | +
| double | + items_count |
+Items quantity | +
| double | + items_qty |
+Total items quantity | +
| string |
+ orig_order_id |
+Original order ID | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ store_to_quote_rate |
+Store to quote rate | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ quote_currency_code |
+Quote currency code | +
| string |
+ grand_total |
+Grand total | +
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ checkout_method |
+Checkout method | +
| string |
+ customer_id |
+Customer ID | +
| string |
+ customer_tax_class_id |
+Customer tax class ID | +
| int | + customer_group_id |
+Customer group ID | +
| string |
+ customer_email |
+Customer email address | +
| string |
+ customer_prefix |
+Customer prefix | +
| string |
+ customer_firstname |
+Customer first name | +
| string |
+ customer_middlename |
+Customer middle name | +
| string |
+ customer_lastname |
+Customer last name | +
| string |
+ customer_suffix |
+Customer suffix | +
| string |
+ customer_note |
+Customer note | +
| string |
+ customer_note_notify |
+Customer notification flag | +
| string |
+ customer_is_guest |
+Defines whether the customer is a guest | +
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ reserved_order_id |
+Reserved order ID | +
| string |
+ password_hash |
+Password hash | +
| string |
+ coupon_code |
+Coupon code | +
| string |
+ global_currency_code |
+Global currency code | +
| double | + base_to_global_rate |
+Base to global rate | +
| double | + base_to_quote_rate |
+Base to quote rate | +
| string |
+ customer_taxvat |
+Customer taxvat value | +
| string |
+ customer_gender |
+Customer gender | +
| double | + subtotal |
+Subtotal | +
| double | + base_subtotal |
+Base subtotal | +
| double | + subtotal_with_discount |
+Subtotal with discount | +
| double | + base_subtotal_with_discount |
+Base subtotal with discount | +
| string |
+ ext_shipping_info |
++ |
| string |
+ gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
| double | + customer_balance_amount_used |
+Used customer balance amount | +
| double | + base_customer_balance_amount_used |
+Used base customer balance amount | +
| string |
+ use_customer_balance |
+Defines whether to use the customer balance | +
| string |
+ gift_cards_amount |
+Gift cards amount | +
| string |
+ base_gift_cards_amount |
+Base gift cards amount | +
| string |
+ gift_cards_amount_used |
+Used gift cards amount | +
| string |
+ use_reward_points |
+Defines whether to use reward points | +
| string |
+ reward_points_balance |
+Reward points balance | +
| string |
+ base_reward_currency_amount |
+Base reward currency amount | +
| string |
+ reward_currency_amount |
+Reward currency amount | +
| array | + shipping_address |
+Array of shoppingCartAddressEntity | +
| array | + billing_address |
+Array of shoppingCartAddressEntity | +
| array | + items |
+Array of shoppingCartItemEntity | +
| array | + payment |
+Array of shoppingCartPaymentEntity | +
The shoppingCartAddressEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + address_id |
+Shopping cart address ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ customer_id |
+Customer ID | +
| int | + save_in_address_book |
+Defines whether to save the address in the address book | +
| string |
+ customer_address_id |
+Customer address ID | +
| string |
+ address_type |
+Address type | +
| string |
+ email |
+Email address | +
| string |
+ prefix |
+Customer prefix | +
| string |
+ firstname |
+Customer first name | +
| string |
+ middlename |
+Customer middle name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ suffix |
+Customer suffix | +
| string |
+ company |
+Company name | +
| string |
+ street |
+Street | +
| string |
+ city |
+City | +
| string |
+ region |
+Region | +
| string |
+ region_id |
+Region ID | +
| string |
+ postcode |
+Postcode | +
| string |
+ country_id |
+Country ID | +
| string |
+ telephone |
+Telephone number | +
| string |
+ fax |
+Fax | +
| int | + same_as_billing |
+Defines whether the address is the same as the billing one | +
| int | + free_shipping |
+Defines whether free shipping is used | +
| string |
+ shipping_method |
+Shipping method | +
| string |
+ shipping_description |
+Shipping description | +
| double | + weight |
+Weight | +
The shoppingCartItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + item_id |
+Cart item ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ product_id |
+Product ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ parent_item_id |
+Parent item ID | +
| int | + is_virtual |
+Defines whether the product is a virtual one | +
| string |
+ sku |
+Product SKU | +
| string |
+ name |
+Product name | +
| string |
+ description |
+Description | +
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ additional_data |
+Additional data | +
| string |
+ free_shipping |
+Free shipping | +
| string |
+ is_qty_decimal |
+Defines whether the quantity is decimal | +
| string |
+ no_discount |
+Defines whether no discount is applied | +
| double | + weight |
+Weight | +
| double |
+ qty |
+Quantity | +
| double |
+ price |
+Price | +
| double |
+ base_price |
+Base price | +
| double |
+ custom_price |
+Custom price | +
| double |
+ discount_percent |
+Discount percent | +
| double |
+ discount_amount |
+Discount amount | +
| double |
+ base_discount_amount |
+Base discount amount | +
| double |
+ tax_percent |
+Tax percent | +
| double |
+ tax_amount |
+Tax amount | +
| double |
+ base_tax_amount |
+Base tax amount | +
| double |
+ row_total |
+Row total | +
| double |
+ base_row_total |
+Base row total | +
| double |
+ row_total_with_discount |
+Row total with discount | +
| double |
+ row_weight |
+Row weight | +
| string | + product_type |
+Product type | +
| double |
+ base_tax_before_discount |
+Base tax before discount | +
| double |
+ tax_before_discount |
+Tax before discount | +
| double |
+ original_custom_price |
+Original custom price | +
| double |
+ base_cost |
+Base cost | +
| double |
+ price_incl_tax |
+Price including tax | +
| double |
+ base_price_incl_tax |
+Base price including tax | +
| double |
+ row_total_incl_tax |
+Row total including tax | +
| double | + base_row_total_incl_tax |
+Base row total including tax | +
| string | + gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
| string |
+ gift_message_available |
+Defines whether the gift message is available | +
| double |
+ weee_tax_applied |
+Applied fix product tax | +
| double |
+ weee_tax_applied_amount |
+ Applied fix product tax amount |
+
| double |
+ weee_tax_applied_row_amount |
+ Applied fix product tax row amount |
+
| double |
+ base_weee_tax_applied_amount |
+ Applied fix product tax amount (in base currency) |
+
| double |
+ base_weee_tax_applied_row_amount |
+ Applied fix product tax row amount (in base currency) |
+
| double |
+ weee_tax_disposition |
+Fixed product tax disposition | +
| double |
+ weee_tax_row_disposition |
+ Fixed product tax row disposition |
+
| double |
+ base_weee_tax_disposition |
+ Fixed product tax disposition (in base currency) |
+
| double | + base_weee_tax_row_disposition |
+ Fixed product tax row disposition (in base currency) |
+
| string |
+ tax_class_id |
+Tax class ID | +
The shoppingCartPaymentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + payment_id |
+Payment ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ method |
+Payment method | +
| string |
+ cc_type |
+Credit card type | +
| string |
+ cc_number_enc |
+Credit card number | +
| string |
+ cc_last4 |
+Last four digits on the credit card | +
| string |
+ cc_cid_enc |
+Credit card CID | +
| string |
+ cc_owner |
+Credit card owner | +
| string |
+ cc_exp_month |
+Credit card expiration month | +
| string |
+ cc_exp_year |
+Credit card expiration year | +
| string |
+ cc_ss_owner |
+Credit card owner (Switch/Solo) | +
| string |
+ cc_ss_start_month |
+ Credit card start month (Switch/Solo) |
+
| string |
+ cc_ss_start_year |
+ Credit card start year (Switch/Solo) |
+
| string |
+ cc_ss_issue |
+ Credit card issue number (Switch/Solo) |
+
| string |
+ po_number |
+Purchase order number | +
| string |
+ additional_data |
+Additional data | +
| string |
+ additional_information |
+Additional information | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart.info', '15');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartInfo($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartInfo((object)array('sessionId' => $sessionId->result, 'quoteId' => '15'));
+
+var_dump($result->result);
+ Allows you to retrieve the website license agreement for the quote according to the website (store).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID (quote identifier) | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartLicenseEntity | +
The shoppingCartLicenseEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + agreement_id |
+License agreement ID | +
| string |
+ name |
+License name | +
| string |
+ content |
+License content | +
| int | + is_active |
+Defines whether the license is active | +
| int | + is_html |
+Defines whether the license is HTML | +
Faults:
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart.license', '15');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartLicense($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartLicense((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
+var_dump($result->result);
+ array + 0 => + array + 'agreement_id' => string '1' (length=1) + 'name' => string 'license' (length=4) + 'content' => string 'terms and conditions' (length=20) + 'content_height' => null + 'checkbox_text' => string 'terms' (length=5) + 'is_active' => string '1' (length=1) + 'is_html' => string '0' (length=1)+
Allows you to create an order from a shopping cart (quote).
+Before placing the order, you need to add the customer, customer address, shipping and payment methods.
Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping Cart ID (quote ID) | +
| string | +storeId | +Store view ID or code (optional) | +
| ArrayOfString | + licenses |
+Website license ID (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +result | +Result of creating an order | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+$resultOrderCreation = $proxy->call(
+ $sessionId,
+ "cart.order",
+ array(
+ $shoppingCartId
+ )
+);
+ /**
+ * Example of order creation
+ * Preconditions are as follows:
+ * 1. Create a customer
+ * 2. Create a simple product */
+
+$user = 'apiUser';
+$password = 'apiKey';
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+ $sessionId = $proxy->login($user, $password);
+ $cartId = $proxy->shoppingCartCreate($sessionId, 1);
+ // load the customer list and select the first customer from the list
+ $customerList = $proxy->customerCustomerList($sessionId, array());
+ $customer = (array) $customerList[0];
+ $customer['mode'] = 'customer';
+ $proxy->shoppingCartCustomerSet($sessionId, $cartId, $customer);
+ // load the product list and select the first product from the list
+ $productList = $proxy->catalogProductList($sessionId);
+ $product = (array) $productList[0];
+ $product['qty'] = 1;
+ $proxy->shoppingCartProductAdd($sessionId, $cartId, array($product));
+
+ $address = array(
+ array(
+ 'mode' => 'shipping',
+ 'firstname' => $customer['firstname'],
+ 'lastname' => $customer['lastname'],
+ 'street' => 'street address',
+ 'city' => 'city',
+ 'region' => 'region',
+ 'telephone' => 'phone number',
+ 'postcode' => 'postcode',
+ 'country_id' => 'country ID',
+ 'is_default_shipping' => 0,
+ 'is_default_billing' => 0
+ ),
+ array(
+ 'mode' => 'billing',
+ 'firstname' => $customer['firstname'],
+ 'lastname' => $customer['lastname'],
+ 'street' => 'street address',
+ 'city' => 'city',
+ 'region' => 'region',
+ 'telephone' => 'phone number',
+ 'postcode' => 'postcode',
+ 'country_id' => 'country ID',
+ 'is_default_shipping' => 0,
+ 'is_default_billing' => 0
+ ),
+ );
+ // add customer address
+ $proxy->shoppingCartCustomerAddresses($sessionId, $cartId, $address);
+ // add shipping method
+ $proxy->shoppingCartShippingMethod($sessionId, $cartId, 'flatrate_flatrate');
+
+ $paymentMethod = array(
+ 'po_number' => null,
+ 'method' => 'checkmo',
+ 'cc_cid' => null,
+ 'cc_owner' => null,
+ 'cc_number' => null,
+ 'cc_type' => null,
+ 'cc_exp_year' => null,
+ 'cc_exp_month' => null
+ );
+ // add payment method
+ $proxy->shoppingCartPaymentMethod($sessionId, $cartId, $paymentMethod);
+ // place the order
+ $orderId = $proxy->shoppingCartOrder($sessionId, $cartId, null, null);
+ Allows you to retrieve total prices for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID (quote identifier) | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartTotalsEntity | +
The shoppingCartTotalsEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Title | +
| float | + amount |
+Total amount | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart.totals', '15');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartTotals($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartTotals((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
+var_dump($result->result);
+ array + 0 => + array + 'title' => string 'Subtotal' (length=8) + 'amount' => float 388.69 + 1 => + array + 'title' => string '0 Reward points' (length=15) + 'amount' => float 0 + 2 => + array + 'title' => string 'Gift Cards' (length=10) + 'amount' => float 0 + 3 => + array + 'title' => string 'Store Credit' (length=12) + 'amount' => float 0 + 4 => + array + 'title' => string 'Grand Total' (length=11) + 'amount' => float 388.69 + 5 => + array + 'title' => null + 'amount' => null+
The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to add and remove coupon codes for a shopping cart.
+ +Resource Name: cart_coupon
+ +Methods:
+Note: In Magento, quotes and shopping carts are logically related, but technically different. The shopping cart is a wrapper for a quote, and it is used primarily by the frontend logic. The cart is represented by the Mage_Checkout_Model_Cart class and the quote is represented by the Mage_Sales_Model_Quote class.
+ +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1081 | +Coupon could not be applied because quote is empty. | +
| 1082 | +Coupon could not be applied. | +
| 1083 | +Coupon is not valid. | +
Allows you to add a coupon code for a shopping cart (quote). The shopping cart must not be empty.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +couponCode | +Coupon code | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the coupon code is added | +
Faults:
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$couponCode = "aCouponCode";
+$resultCartCouponRemove = $proxy->call(
+ $sessionId,
+ "cart_coupon.add",
+ array(
+ $shoppingCartId,
+ $couponCode
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCouponAdd($sessionId, '15', 'aCouponCode');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCouponAdd((object)array('sessionId' => $sessionId->result, 'quoteId' => 15, 'couponCode' => 'aCouponCode', 'store' => '3'));
+var_dump($result->result);
+ Allows you to remove a coupon code from a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the coupon code is removed | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$resultCartCouponRemove = $proxy->call(
+ $sessionId,
+ "cart_coupon.remove",
+ array(
+ $shoppingCartId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCouponRemove($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCouponRemove((object)array('sessionId' => $sessionId->result, 'quoteId' => 15, 'store' => '3'));
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to add customer information and addresses into a shopping cart.
+ +Resource Name: cart_customer
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1041 | +Customer is not set. | +
| 1042 | +The customer’s identifier is not valid or customer is not existed | +
| 1043 | +Customer could not be created. | +
| 1044 | +Customer data is not valid. | +
| 1045 | +Customer’s mode is unknown | +
| 1051 | +Customer address data is empty. | +
| 1052 | +Customer’s address data is not valid. | +
| 1053 | +The customer’s address identifier is not valid | +
| 1054 | +Customer address is not set. | +
| 1055 | +Customer address identifier do not belong customer, which set in quote | +
Allows you to set the customer addresses in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +customerAddressData | +Array of shoppingCartCustomerAddressEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True if the address is set | +
The shoppingCartCustomerAddressEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + mode |
+Mode: billing or shipping | +
| string |
+ address_id |
+Address ID | +
| string |
+ firstname |
+Customer first name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ company |
+Company name | +
| string |
+ street |
+Street | +
| string |
+ city |
+City | +
| string |
+ region |
+Region | +
| string |
+ region_id |
+Region ID | +
| string |
+ postcode |
+Post code | +
| string |
+ country_id |
+Country ID | +
| string |
+ telephone |
+Telephone number | +
| string |
+ fax |
+Fax number | +
| int | + is_default_billing |
+Defines whether the address is a default billing address | +
| int | + is_default_shipping |
+ Defines whether the address is a default shipping address |
+
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+$arrAddresses = array(
+ array(
+ "mode" => "shipping",
+ "firstname" => "testFirstname",
+ "lastname" => "testLastname",
+ "company" => "testCompany",
+ "street" => "testStreet",
+ "city" => "testCity",
+ "region" => "testRegion",
+ "postcode" => "testPostcode",
+ "country_id" => "id",
+ "telephone" => "0123456789",
+ "fax" => "0123456789",
+ "is_default_shipping" => 0,
+ "is_default_billing" => 0
+ ),
+ array(
+ "mode" => "billing",
+ "address_id" => "customer_address_id"
+ )
+);
+
+$resultCustomerAddresses = $proxy->call(
+ $sessionId,
+ "cart_customer.addresses",
+ array(
+ $shoppingCartId,
+ $arrAddresses,
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+Â
+$sessionId = $proxy->login('apiUser', 'apiKey');Â
+Â Â
+$result = $proxy->shoppingCartCustomerAddresses($sessionId, 10, array(array(
+'mode' => 'billing',
+'firstname' => 'first name',
+'lastname' => 'last name',
+'street' => 'street address',
+'city' => 'city',
+'region' => 'region',
+'postcode' => 'postcode',
+'country_id' => 'US',
+'telephone' => '123456789',
+'is_default_billing' => 1
+))); Â Â
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCustomerAddresses((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'customerAddressData' => array(array(
+'mode' => 'billing',
+'firstname' => 'first name',
+'lastname' => 'last name',
+'street' => 'street address',
+'city' => 'city',
+'region' => 'region',
+'postcode' => 'postcode',
+'country_id' => 'US',
+'telephone' => '123456789',
+'is_default_billing' => 1
+))));
+var_dump($result->result);
+ Allows you to add information about the customer to a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +customerData | +Array of shoppingCartCustomerEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True if information is added | +
The shoppingCartCustomerEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + mode |
+Customer mode | +
| int | + customer_id |
+Customer ID | +
| string | + email |
+Customer email address | +
| string |
+ firstname |
+Customer first name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ password |
+Customer password | +
| string |
+ confirmation |
+Confirmation flag | +
| int | + website_id |
+Website ID | +
| int | + store_id |
+Store ID | +
| int | + group_id |
+Group ID | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$customerAsGuest = array(
+ "firstname" => "testFirstname",
+ "lastname" => "testLastName",
+ "email" => "testEmail",
+ "website_id" => "0",
+ "store_id" => "0",
+ "mode" => "guest"
+);
+$resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customerAsGuest) );
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$session = $client->login('apiUser', 'apiKey');
+
+$quoteId = $client->shoppingCartCreate($session);
+
+$customerData = array(
+ "firstname" => "testFirstname",
+ "lastname" => "testLastName",
+ "email" => "testEmail@mail.com",
+ "mode" => "guest",
+ "website_id" => "0"
+ );
+
+$resultCustomerSet = $client->shoppingCartCustomerSet($session, $quoteId, $customerData);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to retrieve and set payment methods for a shopping cart.
+ +Resource Name: cart_payment
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1071 | +Payment method data is empty. | +
| 1072 | +Customer’s billing address is not set. Required for payment method data. | +
| 1073 | +Customer’s shipping address is not set. Required for payment method data. | +
| 1074 | +Payment method is not allowed | +
| 1075 | +Payment method is not set. | +
Allows you to retrieve a list of available payment methods for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | + quoteId |
+Shopping cart ID | +
| string | + store |
+Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartPaymentMethodResponseEntity | +
The shoppingCartPaymentMethodResponseEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + code |
+Payment method code | +
| string | + title |
+Payment method title | +
| associativeArray | + cc_types |
+Array of credit card types | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart_payment.list', 'quoteId');
+var_dump($result);
+ array + 0 => + array + 'code' => string 'checkmo' (length=7) + 'title' => string 'Check / Money order' (length=19) + 'ccTypes' => null + 1 => + array + 'code' => string 'ccsave' (length=6) + 'title' => string 'Credit Card (saved)' (length=19) + 'ccTypes' => + array + 'AE' => string 'American Express' (length=16) + 'VI' => string 'Visa' (length=4) + 'MC' => string 'MasterCard' (length=10) + 'DI' => string 'Discover' (length=8)+
Allows you to set a payment method for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +method | +Array of shoppingCartPaymentMethodEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True on success | +
The shoppingCartPaymentMethodEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + po_number |
+Purchase order number | +
| string |
+ method |
+Payment method | +
| string |
+ cc_cid |
+Credit card CID | +
| string |
+ cc_owner |
+Credit card owner | +
| string |
+ cc_number |
+Credit card number | +
| string |
+ cc_type |
+Credit card type | +
| string |
+ cc_exp_year |
+Credit card expiration year | +
| string |
+ cc_exp_month |
+Credit card expiration month | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+$paymentMethod = array(
+ "method" => "checkmo"
+);
+
+$resultPaymentMethod = $proxy->call(
+ $sessionId,
+ "cart_payment.method",
+ array(
+ $shoppingCartId,
+ $paymentMethod
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartPaymentMethod($sessionId, 10, array(
+'po_number' => null,
+'method' => 'checkmo',
+'cc_cid' => null,
+'cc_owner' => null,
+'cc_number' => null,
+'cc_type' => null,
+'cc_exp_year' => null,
+'cc_exp_month' => null
+));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartPaymentMethod((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'method' => array(
+'po_number' => null,
+'method' => 'checkmo',
+'cc_cid' => null,
+'cc_owner' => null,
+'cc_number' => null,
+'cc_type' => null,
+'cc_exp_year' => null,
+'cc_exp_month' => null
+)));
+
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to manage products in a shopping cart.
+ +Resource Name: cart_product
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1021 | +Product’s data is not valid. | +
| 1022 | +Product(s) could not be added. | +
| 1023 | +Quote could not be saved during adding product(s) operation. | +
| 1024 | +Product(s) could not be updated. | +
| 1025 | +Quote could not be saved during updating product(s) operation. | +
| 1026 | +Product(s) could not be removed. | +
| 1027 | +Quote could not be saved during removing product(s) operation. | +
| 1028 | +Customer is not set for quote. | +
| 1029 | +Customer’s quote is not existed. | +
| 1030 | +Quotes are identical. | +
| 1031 | +Product(s) could not be moved. | +
| 1032 | +One of quote could not be saved during moving product(s) operation. | +
Allows you to create/modify shopping cart and create an order after complete filling the shopping cart. Consists of two main parts: Shopping Cart and Checkout processes.
+ +Module: Mage_Checkout
+ +Resource: cart_product
+ +Allows you to add one or more products to the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | + Shopping cart ID (quote ID) |
+
| array |
+ products\productsData |
+ An array with the list of shoppingCartProductEntity |
+
| string |
+ storeId |
+ Store view ID or code (optional) |
+
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True on success (if the product is added to the shopping cart) | +
The shoppingCartProductEntity array attributes are as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +ID of the product to be added to the shopping cart (quote) (optional) | +
| string |
+ sku |
+ SKU of the product to be added to the shopping cart (quote) (optional) |
+
| double |
+ qty |
+ Number of products to be added to the shopping cart (quote) (optional) |
+
| associativeArray |
+ options |
+ An array in the form of option_id => content (optional) |
+
| associativeArray |
+ bundle_option |
+An array of bundle item options (optional) | +
| associativeArray |
+ bundle_option_qty |
+An array of bundle items quantity (optional) | +
| ArrayOfString |
+ links |
+An array of links (optional) | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$quoteId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ "options" => array( Â
+ optionId_1 => optionValue_1,
+ ...,
+ optionId_n => optionValue_n
+ )
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call(
+ $sessionId,
+ "cart_product.add",
+ array(
+ $quoteId,
+ $arrProducts
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartProductAdd($sessionId, 10, array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '5',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+)));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartProductAdd((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '1',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+))));
+
+
+var_dump($result->result);
+ Allows you to retrieve the list of products in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartProductResponseEntity | +
The shoppingCartProductResponseEntity (catalogProductEntity) content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +Product ID | +
| string |
+ sku |
+Product SKU | +
| string |
+ name |
+Product name | +
| string |
+ set |
+Product attribute set | +
| string |
+ type |
+Product type | +
| ArrayOfString |
+ category_ids |
+Array of category IDs | +
| ArrayOfString |
+ website_ids |
+Array of website IDs | +
Faults:
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart_product.list', '15');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartProductList($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartProductList((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '3' (length=1) + 'sku' => string 'canonxt' (length=7) + 'name' => string 'Canon Digital Rebel XT 8MP Digital SLR Camera' (length=45) + 'set' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'category_ids' => + array + 0 => string '5' (length=1) + 'website_ids' => + array + 0 => string '2' (length=1)+
Allows you to move products from the current quote to a customer quote.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +productsData | +Array of shoppingCartProductEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True if the product is moved to customer quote | +
The shoppingCartProductEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +Product ID | +
| string | + sku |
+Product SKU | +
| double | + qty |
+Product quantity | +
| associativeArray |
+ options |
+Product custom options | +
| associativeArray |
+ bundle_option |
+An array of bundle item options (optional) | +
| associativeArray | + bundle_option_qty |
+An array of bundle items quantity (optional) | +
| ArrayOfString | + links |
+An array of links (optional) | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call(
+ $sessionId,
+ "cart_product.add",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+$arrProducts = array(
+ array(
+ "product_id" => "1"
+ ),
+);
+$resultCartProductMove = $proxy->call(
+ $sessionId,
+ "cart_product.moveToCustomerQuote",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+ Allows you to remove one or several products from a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +productsData | +Array of shoppingCartProductEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is removed | +
The shoppingCartProductEntity content is as follows:
+ + +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +Product ID | +
| string | + sku |
+Product SKU | +
| double | + qty |
+Product quantity | +
| associativeArray |
+ options |
+Product custom options | +
| associativeArray |
+ bundle_option |
+An array of bundle item options (optional) | +
| associativeArray | + bundle_option_qty |
+An array of bundle items quantity (optional) | +
| ArrayOfString | + links |
+An array of links (optional) | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call(
+ $sessionId,
+ "cart_product.add",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+$arrProducts = array(
+ array(
+ "product_id" => "1"
+ ),
+);
+$resultCartProductUpdate = $proxy->call(
+ $sessionId,
+ "cart_product.remove",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartProductRemove($sessionId, 10, array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '1',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+)));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartProductRemove((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '1',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+))));
+
+
+var_dump($result->result);
+ Allows you to update one or several products in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +productsData | +Array of shoppingCartProductEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is updated | +
The shoppingCartProductEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +Product ID | +
| string | + sku |
+Product SKU | +
| double | + qty |
+Product quantity | +
| associativeArray |
+ options |
+Product custom options | +
| associativeArray |
+ bundle_option |
+An array of bundle item options (optional) | +
| associativeArray | + bundle_option_qty |
+An array of bundle items quantity (optional) | +
| ArrayOfString | + links |
+An array of links (optional) | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call(
+ $sessionId,
+ "cart_product.add",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 5
+ ),
+);
+$resultCartProductUpdate = $proxy->call(
+ $sessionId,
+ "cart_product.update",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartProductUpdate($sessionId, 10, array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '2',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+)));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartProductUpdate((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '5',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+))));
+
+
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to retrieve and set shipping methods for a shopping cart.
+ +Resource Name: cart_shipping
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1061 | +Can not make operation because of customer shipping address is not set | +
| 1062 | +Shipping method is not available | +
| 1063 | +Can not set shipping method. | +
| 1064 | +Can not receive list of shipping methods. | +
Allows you to retrieve the list of available shipping methods for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +storeId | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartShippingMethodEntity | +
The shoppingCartShippingMethodEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + code |
+Code | +
| string |
+ carrier |
+Carrier | +
| string |
+ carrier_title |
+Carrier title | +
| string |
+ method |
+Shipping method | +
| string |
+ method_title |
+Shipping method title | +
| string |
+ method_description |
+Shipping method description | +
| double | + price |
+Shipping price | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->call($sessionId, 'cart_shipping.list', 10);
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartShippingList($sessionId, 10);
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartShippingList((object)array('sessionId' => $sessionId->result, 'quoteId' => 10));
+var_dump($result->result);
+ Allows you to set a shipping method for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +method | +Shipping method code | +
| string | +storeId | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True if the shipping method is set | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->call($sessionId, 'cart_shipping.method', array(10, 'freeshipping_freeshipping'));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartShippingMethod($sessionId, 10, 'freeshipping_freeshipping');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartShippingMethod((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'shippingMethod' => 'freeshipping_freeshipping'));
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to add and remove coupon codes for a shopping cart.
+ +Resource Name: cart_coupon
+ +Methods:
+Allows you to add customer information and addresses into a shopping cart.
+ +Resource Name: cart_customer
+ +Methods:
+Allows you to retrieve and set payment methods for a shopping cart.
+ +Resource Name: cart_payment
+ +Methods:
+Allows you to manage products in a shopping cart.
+ +Resource Name: cart_product
+ +Methods:
+Allows you to retrieve and set shipping methods for a shopping cart.
+ +Resource Name: cart_shipping
+ +Methods:
+Allows you to manage shopping carts.
+ +Resource Name: cart
+ +Methods:
+The Core API allows you to manage a set of common resources used in Magento. However, you may choose to have your own set of resources to manage, or you may wish to extend the Core API to handle additional resources.
+ +This tutorial leads you through the process of creating a custom API for a customer module that handles basic customer information.
+ +Note: This tutorial applies to v1 of the API.
+ +To learn more about the Core API, to read Magento Core API calls.
+ +For general information about the Magento API, go to the Introduction.
+ +Create a file named api.xml in the /etc folder in the customer module. Start with the empty structure, as follows:
+<config> + <api> + <resources> + </resources> + <acl> + <resources> + <all> + </all> + </resources> + </acl> + </api> +</config>+
Add an element named customer in the <resources> element. Add a <methods> element, with elements for list, create, info, update and remove methods for customer resource.
+ +Note that:
+<config> + <api> +.... + <resources> + <customer translate="title" module="customer"> + <title>Customer Resource</title> + <methods> + <list translate="title" module="customer"> + <title>Retrieve customers</title> + </list> + <create translate="title" module="customer"> + <title>Create customer</title> + </create> + <info translate="title" module="customer"> + <title>Retrieve customer data</title> + </info> + <update translate="title" module="customer"> + <title>Update customer data</title> + </update> + <delete> + <title>Delete customer</title> + </delete> + </methods> + <faults module="customer"> + </faults> + </customer> + </resources> +.... + </api> +</config>+
The resource can return some faults, so add a <faults> element in the customer element, and list the various faults.
+<config> + <api> +.... + <resources> + <customer translate="title" module="customer"> +.... + <faults module="customer"> <!-- module="customer" specifies the module which will be used for translation. --> + <data_invalid> <!-- if we get invalid input data for customers --> + <code>100</code > + <!-- we cannot know all the errors that can appear, their details can be found in error message for call --> + <message>Invalid customer data. Details in error message.</message> + </data_invalid> + <filters_invalid> + <code>101</code > + <message>Invalid filters specified. Details in error message.</message> + </filters_invalid> + <not_exists> + <code>102</code > + <message>Customer doesn't exist.</message> + </not_exists> + <not_deleted> + <code>103</code > + <message>Customer was not deleted. Details in error message.</message> + </not_deleted> + </faults> + </customer> + </resources> +.... + </api> +</config>+
In order to prevent unauthorized access to our custom API, you must first list the resources that are restricted within the <acl> element.
+<config> + <api> +.... + <acl> + <resources> + <customer translate="title" module="customer"> + <title>Customers</title> + <list translate="title" module="customer"> + <title>View All</title> + </list> + <create translate="title" module="customer"> + <title>Create</title> + </create> + <info translate="title" module="customer"> + <title>Get Info</title> + </info> + <update translate="title" module="customer"> + <title>Update</title> + </update> + <delete translate="title" module="customer"> + <title>Delete</title> + </delete> + </customer> + </resources> + </acl> + </api> +</config>+
Then, map ACL resources to API resource methods by adding an <acl> element to each part of the resource that needs restricting:
+<config> + <api> + <resources> + <customer translate="title" module="customer"> + <title>Customer Resource</title> + <acl>customer</acl> + <methods> + <list translate="title" module="customer"> + <title>Retrieve customers</title> + <acl>customer/list</acl> + </list> + <create translate="title" module="customer"> + <title>Create customer</title> + <acl>customer/create</acl> + </create> + <info translate="title" module="customer"> + <title>Retrieve customer data</title> + <acl>customer/info</acl> + </info> + <update translate="title" module="customer"> + <title>Update customer data</title> + <acl>customer/update</acl> + </update> + <delete> + <title>Delete customer</title> + <acl>customer/delete</acl> + </delete> + </methods> + .... + </customer> + </resources> +.... + </api> +</config>+
Next, write some PHP code to access the resources. Start by creating a class called Mage_Customer_Model_Customer_Api that extends Mage_Api_Model_Resource_Abstract. Save it into a file called api.php.
+class Mage_Customer_Model_Customer_Api extends Mage_Api_Model_Resource_Abstract
+{
+
+ public function create($customerData)
+ {
+ }
+
+ public function info($customerId)
+ {
+ }
+
+ public function items($filters)
+ {
+ }
+
+ public function update($customerId, $customerData)
+ {
+ }
+
+ public function delete($customerId)
+ {
+ }
+}
+ Note that you cannot create method "list" because it’s a PHP keyword, so instead the method is named items. In order to make this work, add a <method> element into the <list> element in api.xml, as shown below.
+<config> + <api> + <resources> + <customer translate="title" module="customer"> + <model>customer/api</model> <!-- our model --> + <title>Customer Resource</title> + <acl>customer</acl> + <methods> + <list translate="title" module="customer"> + <title>Retrieve customers</title> + <method>items</method> <!-- we have another method name inside our resource --> + <acl>customer/list</acl> + </list> +.... + </methods> +.... + </resources> +.... + </api> +</config>+
Now add some simple functionality to the Mage_Customer_Model_Api methods you created.
+ +Create a customer:
+public function create($customerData)
+ {
+ try {
+ $customer = Mage::getModel('customer/customer')
+ ->setData($customerData)
+ ->save();
+ } catch (Mage_Core_Exception $e) {
+ $this->_fault('data_invalid', $e->getMessage());
+ // We cannot know all the possible exceptions,
+ // so let's try to catch the ones that extend Mage_Core_Exception
+ } catch (Exception $e) {
+ $this->_fault('data_invalid', $e->getMessage());
+ }
+ return $customer->getId();
+ }
+ Retrieve customer info:
+public function info($customerId)
+ {
+ $customer = Mage::getModel('customer/customer')->load($customerId);
+ if (!$customer->getId()) {
+ $this->_fault('not_exists');
+ // If customer not found.
+ }
+ return $customer->toArray();
+ // We can use only simple PHP data types in webservices.
+ }
+ Retrieve list of customers using filtering:
+public function items($filters)
+ {
+ $collection = Mage::getModel('customer/customer')->getCollection()
+ ->addAttributeToSelect('*');
+
+ if (is_array($filters)) {
+ try {
+ foreach ($filters as $field => $value) {
+ $collection->addFieldToFilter($field, $value);
+ }
+ } catch (Mage_Core_Exception $e) {
+ $this->_fault('filters_invalid', $e->getMessage());
+ // If we are adding filter on non-existent attribute
+ }
+ }
+
+ $result = array();
+ foreach ($collection as $customer) {
+ $result[] = $customer->toArray();
+ }
+
+ return $result;
+ }
+ Update a customer:
+public function update($customerId, $customerData)
+ {
+ $customer = Mage::getModel('customer/customer')->load($customerId);
+
+ if (!$customer->getId()) {
+ $this->_fault('not_exists');
+ // No customer found
+ }
+
+ $customer->addData($customerData)->save();
+ return true;
+ }
+ Delete a customer:
+public function delete($customerId)
+ {
+ $customer = Mage::getModel('customer/customer')->load($customerId);
+
+ if (!$customer->getId()) {
+ $this->_fault('not_exists');
+ // No customer found
+ }
+
+ try {
+ $customer->delete();
+ } catch (Mage_Core_Exception $e) {
+ $this->_fault('not_deleted', $e->getMessage());
+ // Some errors while deleting.
+ }
+
+ return true;
+ }
+ In order to create custom webservice adapter, implement the Mage_Api_Model_Server_Adapter_Interface, which is shown below.
+interface Mage_Api_Model_Server_Adapter_Interface
+{
+ /**
+ * Set handler class name for webservice
+ *
+ * @param string $handler
+ * @return Mage_Api_Model_Server_Adapter_Interface
+ */
+ function setHandler($handler);
+
+ /**
+ * Retrieve handler class name for webservice
+ *
+ * @return string [basc]
+ */
+ function getHandler();
+
+ /**
+ * Set webservice API controller
+ *
+ * @param Mage_Api_Controller_Action $controller
+ * @return Mage_Api_Model_Server_Adapter_Interface
+ */
+ function setController(Mage_Api_Controller_Action $controller);
+
+ /**
+ * Retrieve webservice API controller
+ *
+ * @return Mage_Api_Controller_Action
+ */
+ function getController();
+
+ /**
+ * Run webservice
+ *
+ * @return Mage_Api_Model_Server_Adapter_Interface
+ */
+ function run();
+
+ /**
+ * Dispatch webservice fault
+ *
+ * @param int $code
+ * @param string $message
+ */
+ function fault($code, $message);
+
+} // Class Mage_Api_Model_Server_Adapter_Interface End
+ Here is an example implementation for XML-RPC:
+class Mage_Api_Model_Server_Adapter_Customxmlrpc
+ extends Varien_Object
+ implements Mage_Api_Model_Server_Adapter_Interface
+{
+ /**
+ * XmlRpc Server
+ *
+ * @var Zend_XmlRpc_Server
+ */
+ protected $_xmlRpc = null;
+
+ /**
+ * Set handler class name for webservice
+ *
+ * @param string $handler
+ * @return Mage_Api_Model_Server_Adapter_Xmlrpc
+ */
+ public function setHandler($handler)
+ {
+ $this->setData('handler', $handler);
+ return $this;
+ }
+
+ /**
+ * Retrieve handler class name for webservice
+ *
+ * @return string
+ */
+ public function getHandler()
+ {
+ return $this->getData('handler');
+ }
+
+ /**
+ * Set webservice API controller
+ *
+ * @param Mage_Api_Controller_Action $controller
+ * @return Mage_Api_Model_Server_Adapter_Xmlrpc
+ */
+ public function setController(Mage_Api_Controller_Action $controller)
+ {
+ $this->setData('controller', $controller);
+ return $this;
+ }
+
+ /**
+ * Retrieve webservice API controller
+ *
+ * @return Mage_Api_Controller_Action
+ */
+ public function getController()
+ {
+ return $this->getData('controller');
+ }
+
+ /**
+ * Run webservice
+ *
+ * @param Mage_Api_Controller_Action $controller
+ * @return Mage_Api_Model_Server_Adapter_Xmlrpc
+ */
+ public function run()
+ {
+ $this->_xmlRpc = new Zend_XmlRpc_Server();
+ $this->_xmlRpc->setClass($this->getHandler());
+ $this->getController()->getResponse()
+ ->setHeader('Content-Type', 'text/xml')
+ ->setBody($this->_xmlRpc->handle());
+ return $this;
+ }
+
+ /**
+ * Dispatch webservice fault
+ *
+ * @param int $code
+ * @param string $message
+ */
+ public function fault($code, $message)
+ {
+ throw new Zend_XmlRpc_Server_Exception($message, $code);
+ }
+} // Class Mage_Api_Model_Server_Adapter_Customxmlrpc End
+ Notes: The setHandler, getHandler, setController and getController methods have a simple implementation that uses the Varien_Object getData and setData methods.
+ +The run and fault methods are a native implementation for an XML-RPC webservice. The run method defines webservice logic in this adapter for creating an XML-RPC server to handle XML-RPC requests.
+public function run()
+Â Â {
+Â Â Â Â $this->_xmlRpc = new Zend_XmlRpc_Server();
+Â Â Â Â $this->_xmlRpc->setClass($this->getHandler());
+Â Â Â Â $this->getController()->getResponse()
+Â Â Â Â Â Â ->setHeader('Content-Type', 'text/xml')
+Â Â Â Â Â Â ->setBody($this->_xmlRpc->handle());
+Â Â Â Â return $this;
+Â Â }
+ The "fault" method allows you to send fault exceptions for XML-RPC service when handling requests.
+public function fault($code, $message)
+Â Â {
+Â Â Â Â throw new Zend_XmlRpc_Server_Exception($message, $code);
+Â Â }
+ The following are common error messages that you might receive when creating your own custom API.
+ +Invalid API path
+ +This error occurs when the methods listed in the api.xml file do not correspond exactly with those used in your PHP file.
+ +For example, in your api.xml file, you might have this:
+<config> + <api> + <resources> + <checkout_cart translate="title" module="checkout"> + <model>checkout/cart_api</model> + <title>Cart API</title> + <methods> + <list translate="title" module="checkout"> + <title>Retrieve cart data</title> + <method>info</method> + </list> + </methods> + </checkout_cart> + </resources> + ... + </api> +</config>+
You should have a corresponding info method in your PHP file.
+class Mage_Checkout_Model_Cart_Api extends Mage_Cart_Model_Api_Resource
+{
+ public function info()
+ {
+ ...
+ }
+}
+ If you are missing this method, the error "Invalid API path" will be returned.
+ diff --git a/guides/v1.8/api/soap/customer/customer.create.html b/guides/v1.8/api/soap/customer/customer.create.html new file mode 100644 index 0000000000..8438b74918 --- /dev/null +++ b/guides/v1.8/api/soap/customer/customer.create.html @@ -0,0 +1,193 @@ +--- +layout: v1x_soap +title: Customer Create +--- + + +Allows you to export/import customers from/to Magento.
+ +Create a new customer.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +customerData | + Array of customerCustomerEntityToCreate |
+
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created customer | +
The customerCustomerEntityToCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +Customer email | +|
| string | +firstname | +Customer first name | +
| string | +lastname | +Customer last name | +
| string | +password | +Customer password | +
| int | +website_id | +Website ID | +
| int | +store_id | +Store ID | +
| int | +group_id | +Group ID | +
| string | +prefix | +Customer prefix (optional) | +
| string | +suffix | +Customer suffix (optional) | +
| string | +dob | +Customer date of birth (optional) | +
| string | +taxvat | +Customer tax/VAT number (optional) | +
| int | +gender | +Customer gender: 1 - Male, 2 - Female (optional) | +
| string | +middlename | +Customer middle name/initial (optional) | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session,'customer.create',array(array('email' => 'mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1)));
+
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->customerCustomerCreate($session, array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerCreate((object)array('sessionId' => $sessionId->result, 'customerData' => ((object)array(
+'email' => 'customer-mail@example.org',
+'firstname' => 'John',
+'lastname' => 'Dou',
+'password' => '123123',
+'website_id' => '0',
+'group_id' => '1'
+))));
+var_dump($result->result);
+ Allows you to export/import customers from/to Magento
+ +Delete the required customer.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +Customer ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the customer is deleted | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer.delete', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerCustomerDelete($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerDelete((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
+var_dump($result->result);
+ The Mage_Customer module allows you to create, retrieve, update, and delete customers and customer addresses.
+ +Allows you to create, retrieve, update, and delete data about customers.
+ +Resource Name: customer
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Invalid customer data. Details in error message. | +
| 101 | +Invalid filters specified. Details in error message. | +
| 102 | +Customer does not exist. | +
| 103 | +Customer not deleted. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+$newCustomer = array(
+ 'firstname' => 'First',
+ 'lastname' => 'Last',
+ 'email' => 'test@example.com',
+ //for my version of magento (1.3.2.4) you SHOULD NOT
+ // hash the password, as in:
+ // 'password_hash' => 'password'
+ 'password_hash' => md5('password'),
+ // password hash can be either regular or salted md5:
+ // $hash = md5($password);
+ // $hash = md5($salt.$password).':'.$salt;
+ // both variants are valid
+ 'store_id' => 0,
+ 'website_id' => 0
+);
+
+$newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
+
+// Get new customer info
+var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));
+
+
+// Update customer
+$update = array('firstname'=>'Changed Firstname');
+$proxy->call($sessionId, 'customer.update', array($newCustomerId, $update));
+
+var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));
+
+// Delete customer
+$proxy->call($sessionId, 'customer.delete', $newCustomerId);
+ Allows you to retrieve the customer groups.
+ +Resource Name: customer_group
+ +Methods:
+Allows you to export/import customers from/to Magento.
+ +Retrieve information about the specified customer.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +ID of the required customer | +
| ArrayOfString | +attributes | +Array of attributes | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +customerInfo | +Array of customerCustomerEntity | +
The customerCustomerEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +customer_id | +ID of the customer | +
| string | +created_at | +Date when the customer was created | +
| string | +updated_at | +Date when the customer was updated | +
| string | +increment_id | +Increment ID | +
| int | +store_id | +Store ID | +
| int | +website_id | +Website ID | +
| string | +created_in | +Store view the customer was created in | +
| string | +Customer email | +|
| string | +firstname | +Customer first name | +
| string | +middlename | +Customer middle name | +
| string | +lastname | +Customer last name | +
| int | +group_id | +Customer group ID | +
| string | +prefix | +Customer prefix | +
| string | +suffix | +Customer suffix | +
| string | +dob | +Customer date of birth | +
| string | +taxvat | +Tax/VAT number | +
| boolean | +confirmation | +Confirmation flag | +
| string | +password_hash | +Password hash | +
| string | +rp_token | +Reset password token | +
| string | +rp_token_created_at | +Date when the password was reset | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer.info', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerCustomerInfo($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerInfo((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
+var_dump($result->result);
+ array + 'customer_id' => string '2' (length=1) + 'created_at' => string '2012-03-29 12:37:23' (length=19) + 'updated_at' => string '2012-03-30 12:59:21' (length=19) + 'increment_id' => null + 'store_id' => string '2' (length=1) + 'website_id' => string '2' (length=1) + 'confirmation' => null + 'created_in' => string 'English' (length=7) + 'default_billing' => null + 'default_shipping' => string '2' (length=1) + 'disable_auto_group_change' => string '0' (length=1) + 'dob' => null + 'email' => string 'john@example.com' (length=16) + 'firstname' => string 'johny' (length=5) + 'gender' => null + 'group_id' => string '1' (length=1) + 'lastname' => string 'doe' (length=3) + 'middlename' => null + 'password_hash' => string 'cccfb3ecf54c9644a34106783148eff2:sp' (length=35) + 'prefix' => null + 'rp_token' => string '15433dd072f1f4e5aae83231b93f72d0' (length=32) + 'rp_token_created_at' => string '2012-03-30 15:10:31' (length=19) + 'suffix' => null + 'taxvat' => null+
Allows you to retrieve the list of customers.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +filters | +Array of filters by customer attributes (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +storeView | +Array of customerCustomerEntity | +
The customerCustomerEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +customer_id | +ID of the customer | +
| string | +created_at | +Date when the customer was created | +
| string | +updated_at | +Date of when the customer was updated | +
| string | +increment_id | +Increment ID | +
| int | +store_id | +Store ID | +
| int | +website_id | +Website ID | +
| string | +created_in | +Created in | +
| string | +Customer email | +|
| string | +firstname | +Customer first name | +
| string | +middlename | +Customer middle name | +
| string | +lastname | +Customer last name | +
| int | +group_id | +Group ID | +
| string | +prefix | +Customer prefix | +
| string | +suffix | +Customer suffix | +
| string | +dob | +Customer date of birth | +
| string | +taxvat | +Taxvat value | +
| boolean | +confirmation | +Confirmation flag | +
| string | +password_hash | +Password hash | +
Note: The password_hash parameter will only match exactly with the same MD5 and salt as was used when Magento stored the value. If you try to match with an unsalted MD5 hash, or any salt other than what Magento used, it will not match. This is just a straight string comparison.
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer.list');
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerCustomerList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'group_id',
+ 'value' => array('key' => 'in', 'value' => '1,3')
+ )
+ )
+);
+$result = $client->customerCustomerList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerList((object)array('sessionId' => $sessionId->result, 'filters' => null));
+var_dump($result->result);
+ array + 0 => + array + 'customer_id' => string '2' (length=1) + 'created_at' => string '2012-03-29 12:37:23' (length=19) + 'updated_at' => string '2012-04-03 11:20:18' (length=19) + 'store_id' => string '2' (length=1) + 'website_id' => string '2' (length=1) + 'created_in' => string 'English' (length=7) + 'default_billing' => string '3' (length=1) + 'default_shipping' => string '3' (length=1) + 'disable_auto_group_change' => string '0' (length=1) + 'email' => string 'test@example.com' (length=16) + 'firstname' => string 'John' (length=4) + 'group_id' => string '1' (length=1) + 'lastname' => string 'Doe' (length=3) + 'password_hash' => string 'cccfb3ecf54c9644a34106783148eff2:sp' (length=35) + 'rp_token' => string '15433dd072f1f4e5aae83231b93f72d0' (length=32) + 'rp_token_created_at' => string '2012-03-30 15:10:31' (length=19) + 1 => + array + 'customer_id' => string '4' (length=1) + 'created_at' => string '2012-04-03 11:21:15' (length=19) + 'updated_at' => string '2012-04-03 11:22:57' (length=19) + 'store_id' => string '0' (length=1) + 'website_id' => string '2' (length=1) + 'created_in' => string 'Admin' (length=5) + 'default_billing' => string '8' (length=1) + 'default_shipping' => string '8' (length=1) + 'disable_auto_group_change' => string '0' (length=1) + 'email' => string 'shon@example.com' (length=16) + 'firstname' => string 'Shon' (length=4) + 'group_id' => string '1' (length=1) + 'lastname' => string 'McMiland' (length=8) + 'password_hash' => string '5670581cabba4e2189e5edee99ed0c86:5q' (length=35)+
Update information about the required customer. Note that you need to pass only those arguments which you want to be updated.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +Customer ID | +
| array | +customerData | +Array of customerCustomerEntityToCreate | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the customer is updated | +
The customerCustomerEntityToCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +customer_id | +Customer ID | +
| string | +Customer email | +|
| string | +firstname | +Customer first name | +
| string | +lastname | +Customer last name | +
| string | +password | +Customer password | +
| int | +group_id | +Group ID | +
| string | +prefix | +Customer prefix | +
| string | +suffix | +Customer suffix | +
| string | +dob | +Customer date of birth | +
| string | +taxvat | +Customer tax/VAT number | +
| int | +gender | +Customer gender: 1 - Male, 2 - Female | +
| string | +middlename | +Customer middle name/initial | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer.update', array('customerId' => '2', 'customerData' => array('firstname' => 'John', 'lastname' => 'Doe', 'email' => 'test@example.com', 'password' => 'john22')));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->customerCustomerUpdate($session, '2', array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deekson', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerUpdate((object)array('sessionId' => $sessionId->result, 'customerId' => '2', 'customerData' => ((object)array(
+'email' => 'customer-mail@example.org',
+'firstname' => 'Dough',
+'lastname' => 'Deekson'
+))));
+var_dump($result->result);
+ Allows you to create, retrieve, update, and delete address data for a required customer.
+ +Resource Name: customer_address
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Invalid address data. Details in error message. | +
| 101 | +Customer not exists. | +
| 102 | +Address not exists. | +
| 103 | +Address not deleted. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+
+// Create new customer
+$newCustomer = array(
+ 'firstname' => 'First',
+ 'lastname' => 'Last',
+ 'email' => 'test@example.com',
+ 'password' => 'password',
+ 'store_id' => 0,
+ 'website_id' => 0
+);
+
+$newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
+
+//Create new customer address
+$newCustomerAddress = array(
+ 'firstname' => 'First',
+ 'lastname' => 'Last',
+ 'country_id' => 'USA',
+ 'region_id' => '43',
+ 'region' => 'New York',
+ 'city' => 'New York',
+ 'street' => array('street1','street2'),
+ 'telephone' => '5555-555',
+ 'postcode' => 10021,
+
+ 'is_default_billing' => true,
+ 'is_default_shipping' => true
+);
+
+$newAddressId = $proxy->call($sessionId, 'customer_address.create', array($newCustomerId, $newCustomerAddress));
+
+var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
+
+//Update customer address
+$proxy->call($sessionId, 'customer_address.update', array($newAddressId, array('firstname'=>'Changed Firstname')));
+
+var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
+
+// Delete customer address
+$proxy->call($sessionId, 'customer_address.delete', $newAddressId);
+
+var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
+ Create a new address for the customer
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +Customer ID | +
| array | +addressdata | +Array of customerAddressEntityCreate | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created customer address | +
The customerAddressEntityCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + city |
+Name of the city | +
| string |
+ company |
+Name of the company | +
| string |
+ country_id |
+Country ID | +
| string |
+ fax |
+Fax | +
| string |
+ firstname |
+Customer first name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ middlename |
+Customer middle name | +
| string |
+ postcode |
+Postcode | +
| string |
+ prefix |
+Customer prefix | +
| int | + region_id |
+ID of the region | +
| string |
+ region |
+Name of the region | +
| ArrayOfString | + street |
+Array of street addresses | +
| string |
+ suffix |
+Customer suffix | +
| string |
+ telephone |
+Telephone number | +
| boolean | + is_default_billing |
+True if the address is the default one for billing | +
| boolean | + is_default_shipping |
+True if the address is the default one for shipping | +
Note: If you want to leave any address fields empty, specify them as empty ones in the request body.
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call(
+$session,
+'customer_address.create',
+array('customerId' => 2, 'addressdata' => array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE)));
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->customerAddressCreate($session, '2', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressCreate((object)array('sessionId' => $sessionId->result, 'customerId' => '2', 'addressData' => ((object)array(
+'city' => 'Weaverville',
+'country_id' => 'US',
+'postcode' => '96093',
+'region' => 'Texas',
+'street' => array('Street line 1', 'Streer line 2'),
+'telephone' => '847-431-7700',
+'lastname' => 'Doe',
+'firstname' => 'John',
+'is_default_billing' => true
+))));
+var_dump($result->result);
+ Delete the required customer address.
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +addressId | +Address ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the customer address is deleted | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer_address.delete', '4');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerAddressDelete($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressDelete((object)array('sessionId' => $sessionId->result, 'addressId' => '4'));
+var_dump($result->result);
+ Retrieve information about the required customer address.
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +addressId | +Address ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +info | +Array of customerAddressEntityItem | +
The customerAddressEntityItem content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + customer_address_id |
+ID of the customer address | +
| string | + created_at |
+Date when the address was created | +
| string | + updated_at |
+Date when the address was updated | +
| string | + increment_id |
+Increment ID | +
| string | + city |
+name of the city | +
| string | + company |
+Name of the company | +
| string | + country_id |
+ID of the country | +
| string | + fax |
+Fax | +
| string | + firstname |
+Customer first name | +
| string | + lastname |
+Customer last name | +
| string | + middlename |
+Customer middle name | +
| string | + postcode |
+Customer postcode | +
| string | + prefix |
+Customer prefix | +
| string | + region |
+Name of the region | +
| int | + region_id |
+Region ID | +
| string | + street |
+Name of the street | +
| string | + suffix |
+Customer suffix | +
| string | + telephone |
+Telephone number | +
| boolean | + is_default_billing |
+True if the address is the default one for billing | +
| boolean | + is_default_shipping |
+True if the address is the default one for shipping | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer_address.info', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerAddressInfo($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressInfo((object)array('sessionId' => $sessionId->result, 'addressId' => '2'));
+var_dump($result->result);
+ array + 'customer_address_id' => string '2' (length=1) + 'created_at' => string '2012-03-29 13:20:08' (length=19) + 'updated_at' => string '2012-03-29 13:20:08' (length=19) + 'increment_id' => null + 'city' => string 'Las Vegas' (length=9) + 'company' => null + 'country_id' => string 'US' (length=2) + 'fax' => null + 'firstname' => string 'johny' (length=5) + 'lastname' => string 'doe' (length=3) + 'middlename' => null + 'postcode' => string '89032' (length=5) + 'prefix' => null + 'region' => string 'Nevada' (length=6) + 'region_id' => string '39' (length=2) + 'street' => string '3406 Hiney Road' (length=15) + 'suffix' => null + 'telephone' => string '702-283-9556' (length=12) + 'vat_id' => null + 'vat_is_valid' => null + 'vat_request_date' => null + 'vat_request_id' => null + 'vat_request_success' => null + 'is_default_billing' => boolean false + 'is_default_shipping' => boolean true+
Retrieve the list of customer addresses.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +Customer ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of customerAddressEntity | +
The customerAddressEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + customer_address_id |
+ID of the customer address | +
| string | + created_at |
+Date when the address was created | +
| string | + updated_at |
+Date when the address was updated | +
| string | + increment_id |
+Increment ID | +
| string | + city |
+City | +
| string | + company |
+Name of the company | +
| string | + country_id |
+ID of the country | +
| string | + fax |
+Fax | +
| string | + firstname |
+Customer first name | +
| string | + lastname |
+Customer last name | +
| string | + middlename |
+Customer middle name | +
| string | + postcode |
+Customer postcode | +
| string | + prefix |
+Customer prefix | +
| string | + region |
+Name of the region | +
| int | + region_id |
+Region ID | +
| string | + street |
+Name of the street | +
| string | + suffix |
+Customer suffix | +
| string | + telephone |
+Telephone number | +
| boolean | + is_default_billing |
+True if the address is the default one for billing | +
| boolean | + is_default_shipping |
+True if the address is the default one for shipping | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer_address.list', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerAddressList($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressList((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
+var_dump($result->result);
+ array + 0 => + array + 'customer_address_id' => string '2' (length=1) + 'created_at' => string '2012-03-29 13:20:08' (length=19) + 'updated_at' => string '2012-03-29 13:39:29' (length=19) + 'city' => string 'Las Vegas' (length=9) + 'country_id' => string 'US' (length=2) + 'firstname' => string 'johny' (length=5) + 'lastname' => string 'doe' (length=3) + 'postcode' => string '89032' (length=5) + 'region' => string 'Nevada' (length=6) + 'region_id' => string '39' (length=2) + 'street' => string '3406 Hiney Road' (length=15) + 'telephone' => string '702-283-9556' (length=12) + 'is_default_billing' => boolean false + 'is_default_shipping' => boolean true + 1 => + array + 'customer_address_id' => string '3' (length=1) + 'created_at' => string '2012-03-29 13:39:29' (length=19) + 'updated_at' => string '2012-03-29 13:39:29' (length=19) + 'city' => string 'Corpus Christi' (length=14) + 'country_id' => string 'US' (length=2) + 'firstname' => string 'johny' (length=5) + 'lastname' => string 'doe' (length=3) + 'postcode' => string '78476' (length=5) + 'region' => string 'Texas' (length=5) + 'region_id' => string '57' (length=2) + 'street' => string '3672 Boone Street' (length=17) + 'telephone' => string '361-280-8488' (length=12) + 'vat_id' => string 'GB999 9999 73' (length=13) + 'is_default_billing' => boolean false + 'is_default_shipping' => boolean false+
Update address data of the required customer
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +addressId | +Address ID | +
| array | +addressdata | +Array of customerAddressEntityCreate | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the customer address is updated | +
The customerAddressEntityCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + city |
+Name of the city | +
| string |
+ company |
+Name of the company | +
| string |
+ country_id |
+Country ID | +
| string |
+ fax |
+Fax | +
| string |
+ firstname |
+Customer first name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ middlename |
+Customer middle name | +
| string |
+ postcode |
+Postcode | +
| string |
+ prefix |
+Customer prefix | +
| int | + region_id |
+ID of the region | +
| string |
+ region |
+Name of the region | +
| ArrayOfString | + street |
+Array of streets | +
| string |
+ suffix |
+Customer suffix | +
| string |
+ telephone |
+Telephone number | +
| boolean | + is_default_billing |
+True if the address is the default one for billing | +
| boolean | + is_default_shipping |
+True if the address is the default one for shipping | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call(
+$session,
+'customer_address.update',
+array('addressId' => 8, 'addressdata' => array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => TRUE, 'is_default_shipping' => FALSE)));
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->customerAddressUpdate($session, '8', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressUpdate((object)array('sessionId' => $sessionId->result, 'addressId' => '8', 'addressData' => ((object)array(
+'firstname' => 'John',
+'lastname' => 'Doe',
+'street' => array('Street line 1', 'Streer line 2'),
+'city' => 'Weaverville',
+'country_id' => 'US',
+'region' => 'Texas',
+'region_id' => 3,
+'postcode' => '96093',
+'telephone' => '530-623-2513',
+'is_default_billing' => TRUE,
+'is_default_shipping' => TRUE
+))));
+var_dump($result->result);
+ Allows you to export customer groups from Magento
+ +Retrieve the list of customer groups
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +An array of customerGroupEntity | +
The customerGroupEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + customer_group_id |
+ID of the customer group | +
| string | + customer_group_code |
+Customer group code | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer_group.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerGroupList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerGroupList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'customer_group_id' => string '0' (length=1) + 'customer_group_code' => string 'NOT LOGGED IN' (length=13) + 1 => + array + 'customer_group_id' => string '1' (length=1) + 'customer_group_code' => string 'General' (length=7) + 2 => + array + 'customer_group_id' => string '2' (length=1) + 'customer_group_code' => string 'Wholesale' (length=9) + 3 => + array + 'customer_group_id' => string '3' (length=1) + 'customer_group_code' => string 'Retailer' (length=8)+
The Mage_Directory module allows you to retrieve country and region data.
+ +Allows you to retrieve a list of countries.
+ +Resource Name: directory_country
+ +Aliases:
+Methods:
+Allows you to retrieve a list of regions within a country.
+ +Resource Name: directory_region
+ +Aliases:
+Methods:
+Allows you to retrieve the list of countries from Magento.
+ +Module: Mage_Directory
+ +Resource: directory_country
+ +Aliases:
+Retrieve the list of countries from Magento.
+ +Aliases:
+| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| Type | +Name | +Description | +
|---|---|---|
| array | +countries | +An array of directoryCountryEntity | +
The directoryCountryEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +country_id | +ID of the retrieved country | +
| string | +iso2_code | +ISO 2-alpha code | +
| string | +iso3_code | +ISO 3-alpha code | +
| string | +name | +Name of the retrieved country | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$countries = $proxy->call($sessionId, 'country.list');
+var_dump($countries); // Countries list.
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->directoryCountryList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->directoryCountryList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'country_id' => string 'AD' (length=2) + 'iso2_code' => string 'AD' (length=2) + 'iso3_code' => string 'AND' (length=3) + 'name' => string 'Andorra' (length=7) + 1 => + array + 'country_id' => string 'AE' (length=2) + 'iso2_code' => string 'AE' (length=2) + 'iso3_code' => string 'ARE' (length=3) + 'name' => string 'United Arab Emirates' (length=20) + 2 => + array + 'country_id' => string 'AF' (length=2) + 'iso2_code' => string 'AF' (length=2) + 'iso3_code' => string 'AFG' (length=3) + 'name' => string 'Afghanistan' (length=11)+
Allows you to export the list of regions from Magento
+ +Aliases:
+Retrieve the list of regions in the specified country.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +country | +Country code in ISO2 or ISO3 | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | + directoryRegionEntityArray |
+An array of directoryRegionEntity | +
The directoryRegionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +region_id | +ID of the region | +
| string | +code | +Region code | +
| string | +name | +Name of the region | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Country not exists. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$regions = $proxy->call($sessionId, 'region.list', 'US');
+
+var_dump($regions); // Region list for USA.
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->directoryRegionList($sessionId,'US');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->directoryRegionList((object)array('sessionId' => $sessionId->result, 'country' => 'US'));
+var_dump($result->result);
+ array + 0 => + array + 'region_id' => string '1' (length=1) + 'code' => string 'AL' (length=2) + 'name' => string 'Alabama' (length=7) + 1 => + array + 'region_id' => string '2' (length=1) + 'code' => string 'AK' (length=2) + 'name' => string 'Alaska' (length=6) + 2 => + array + 'region_id' => string '3' (length=1) + 'code' => string 'AS' (length=2) + 'name' => string 'American Samoa' (length=14) + 3 => + array + 'region_id' => string '4' (length=1) + 'code' => string 'AZ' (length=2) + 'name' => string 'Arizona' (length=7)+
| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1003 | +Provided data is invalid | +
| 1004 | +Gift card account with requested code does not exist | +
| 1005 | +Error happened while adding gift card to quote | +
Allows you to add a gift card to the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +giftcardAccountCode | +Gift card account code | +
| int | +quoteId | +Shopping cart ID (quote ID) | +
| int | +storeId | +Store ID (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the gift card is added to the quote | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1004 | +Gift card account with requested code does not exist | +
| 1005 | +Error happened while adding gift card to quote | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$code = "giftcardAccountCode";
+$quoteId = 15;
+
+$giftcardList = $proxy->call(
+ $sessionId,
+ "cart_giftcard.add",
+ array(
+ $code,
+ $quoteId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartGiftcardAdd($sessionId, 'giftcardAccountCode', '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartGiftcardAdd((object)array('sessionId' => $sessionId->result, 'giftcardAccountCode' => 'giftcardAccountCode', 'quoteId' => '15', 'storeId' => '3'));
+
+var_dump($result->result);
+ Allows you to retrieve the list of gift cards used in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| string | +storeId | +Store ID (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of enterpriseGiftcardaccountListEntity | +
The enterpriseGiftcardaccountListEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +giftcardaccount_id | +Gift card account ID | +
| string |
+ code |
+Gift card code | +
| string |
+ used_amount |
+Used amount (in store currency) | +
| string |
+ base_amount |
+Base amount (in base currency) | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$quoteId = 15;
+
+$giftcardList = $proxy->call(
+ $sessionId,
+ "cart_giftcard.list",
+ array(
+ $quoteId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartGiftcardList($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartGiftcardList((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'storeId' => '3'));
+
+var_dump($result->result);
+ array + 0 => + array + 'giftcardaccount_id' => string '5' (length=1) + 'code' => string 'code' (length=12) + 'used_amount' => float 141.34 + 'base_amount' => string '200.0000' (length=8) + 1 => + array + 'giftcardaccount_id' => string '6' (length=1) + 'code' => string 'code' (length=12) + 'used_amount' => float 35.34 + 'base_amount' => string '50.0000' (length=7)+
Allows you to remove a gift card from the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +giftcardAccountCode | +Gift card account code | +
| string |
+quoteId | +Shopping cart ID (quote ID) | +
| string |
+storeId | +Store ID (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the gift card is removed from the shopping cart | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1004 | +Gift card account with requested code does not exist | +
| 1005 | +Error happened while adding gift card to quote | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$code = "giftcardAccountCode";
+$quoteId = 15;
+
+$giftcardList = $proxy->call(
+ $sessionId,
+ "cart_giftcard.remove",
+ array(
+ $code,
+ $quoteId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartGiftcardRemove($sessionId, 'giftcardAccountCode', '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartGiftcardRemove((object)array('sessionId' => $sessionId->result, 'giftcardAccountCode' => 'giftcardAccountCode', 'quoteId' => '15', 'storeId' => '3'));
+
+var_dump($result->result);
+ Allows you to retrieve information on a gift card and redeem gift card amount.
+ +Resource Name: giftcard_customer
+ + +Allows you to retrieve, add, and remove a gift card from/to a shopping cart.
+ +Resource Name: cart_giftcard
+ + +Allows you to create, update, remove, and retrieve information on a gift card account.
+ +Resource Name: giftcard_account
+ + +Allows you to operate with giftcards.
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
| 101 | +Invalid filters specified. Details in error message. | +
| 102 | +Unable to save data. | +
| 104 | +Provided email notification data is invalid | +
| 105 | +Provided gift card account data is invalid | +
| 106 | +Gift card account with requested id does not exist | +
| 107 | +Error occurs while deleting gift card | +
Allows you to create a new gift card account.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +giftcardAccountData | +Array of giftcardAccountCreateGiftcardAccountData | +
| array | +notificationData | +Array of giftcardAccountCreateNotificationData (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| string | +ID of the created gift card account | +
The giftcardAccountCreateGiftcardAccountData content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + status |
+Gift card status: available, used, redeemed, expired | +
| string |
+ date_expires |
+ Gift card expiration date in the YYYY-MM-DD format |
+
| string |
+ website_id |
+ Gift card website ID |
+
| string |
+ balance |
+ Initial gift card balance |
+
| string |
+ state |
+State: active or not active | +
| string |
+ is_redeemable |
+Defines whether the gift card is redeemable | +
The giftcardAccountCreateNotificationData content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + recipient_name |
+Recipient name | +
| string | + recipient_email |
+Recipient email address | +
| string | + recipient_store |
+Recipient store | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 105 | +Provided gift card account data is invalid. | +
| 104 | +Provided email notification data is invalid | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardToCreate = array(
+ "status" => 'available',
+ "is_redeemable" => 1,
+ "balance" => 200,
+ "website_id" => 2,
+ "date_expires" => null
+);
+
+$giftcardId = $proxy->call(
+ $sessionId,
+ "giftcard_account.create",
+ array(
+ $giftcardToCreate
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->giftcardAccountCreate($sessionId, array(
+'status' => 'available',
+'date_expires' => null,
+'website_id' => '2',
+'balance' => '200',
+'state' => '1',
+'is_redeemable' => '1'),
+array(
+'recipient_name' => 'name',
+'recipient_email' => 'email',
+'recipient_store' => null)
+);
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountCreate((object)array('sessionId' => $sessionId->result, 'giftcardAccountData' => array(
+'status' => 'available',
+'date_expires' => null,
+'website_id' => '2',
+'balance' => '200',
+'state' => '1',
+'is_redeemable' => '1'),
+'notificationData' => array(
+'recipient_name' => 'name',
+'recipient_email' => 'email',
+'recipient_store' => null)
+));
+
+var_dump($result->result);
+ Allows you to receive full information about the selected gift card account.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +giftcardAccountId | +Gift card account ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of giftcardAccountEntity | +
The giftcardAccountEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +giftcard_id | +Gift card account ID | +
| string | + code |
+Gift card account code | +
| int | + store_id |
+Gift card account store ID | +
| string | + date_created |
+Creation date in the YYYY-MM-DD format | +
| string | + expire_date |
+Expiration date in the YYYY-MM-DD format | +
| int | + is_active |
+Defines whether the gift card account is active | +
| int | + is_redeemable |
+Defines whether the gift card account is redeemable | +
| string | + status |
+Gift card account status | +
| double | + balance |
+Gift card account initial balance | +
| array | + history |
+Array of giftcardAccountEntityHistory | +
The giftcardAccountEntityHistory content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + record_id |
+Record ID | +
| string | + date |
+Date | +
| string | + action |
+ History action |
+
| double | + balance_delta |
+Balance delta | +
| double | + balance |
+Balance | +
| string | + info |
+ Record comment |
+
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardId = 1;
+$giftcardInfo = $proxy->call(
+ $sessionId,
+ "giftcard_account.info",
+ array(
+ $giftcardId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardAccountInfo($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountInfo((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '1'));
+
+var_dump($result->result);
+ array + 'giftcard_id' => string '1' (length=1) + 'code' => string '02DQ9T1K0Y0V' (length=12) + 'store_id' => string '0' (length=1) + 'date_created' => string '2012-04-06' (length=10) + 'expire_date' => null + 'is_active' => string '0' (length=1) + 'status' => string 'Available' (length=9) + 'balance' => string '0.0000' (length=6) + 'is_redeemable' => string '1' (length=1) + 'history' => + array + 0 => + array + 'record_id' => string '1' (length=1) + 'date' => string '2012-04-06 14:31:57' (length=19) + 'action' => string 'Created' (length=7) + 'balance_delta' => string '0.0000' (length=6) + 'balance' => string '0.0000' (length=6) + 'info' => null+
Allows you to retrieve the list of available gift card accounts.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +filters | +Array of filters (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of giftcardAccountEntity | +
The giftcardAccountEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + giftcard_id |
+Gift card ID | +
| string | + code |
+Gift card code | +
| int | + store_id |
+Gift card store ID | +
| string | + date_created |
+ Creation date in the YYYY-MM-DD format |
+
| string | + expire_date |
+ Expiration date in the YYYY-MM-DD format |
+
| int | + is_active |
+Defines whether the gift card is active | +
| string | + status |
+Gift card status | +
| double | + balance |
+Gift card balance | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Invalid filters specified. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardList = $proxy->call(
+ $sessionId,
+ "giftcard_account.list"
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardAccountList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'state',
+ 'value' => array('key' => 'in', 'value' => '2,1')
+ )
+ )
+);
+$result = $client->giftcardAccountList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountList((object)array('sessionId' => $sessionId->result, 'filters' => null));
+
+var_dump($result->result);
+ array + 0 => + array + 'giftcard_id' => string '1' (length=1) + 'code' => string 'code' (length=12) + 'store_id' => string '2' (length=1) + 'date_created' => string '2012-04-06' (length=10) + 'expire_date' => string '2012-04-22' (length=10) + 'is_active' => string '0' (length=1) + 'status' => string 'Available' (length=9) + 'balance' => string '300.0000' (length=8) + 1 => + array + 'giftcard_id' => string '2' (length=1) + 'code' => string 'code' (length=12) + 'store_id' => string '2' (length=1) + 'date_created' => string '2012-04-09' (length=10) + 'expire_date' => string '2012-04-25' (length=10) + 'is_active' => string '1' (length=1) + 'status' => string 'Available' (length=9) + 'balance' => string '500.0000' (length=8)+
Allows you to remove the specified gift card account.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +giftcardAccountId | +Gift card account ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the gift card account is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 106 | +Gift card account with requested id does not exist | +
| 107 | +Error occurs while deleting gift card | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardId = 2;
+$result = $proxy->call(
+ $sessionId,
+ "giftcard_account.remove",
+ array(
+ $giftcardId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardAccountRemove($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountRemove((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '2'));
+
+var_dump($result->result);
+ Allows you to update the required gift card account.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +giftcardAccountId | +Gift card account ID | +
| array | +giftcardData | +Array of giftcardAccountEntityToUpdate | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True is the gift card account is updated | +
The giftcardAccountEntityToUpdate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | + is_active |
+Defines whether the gift card account is active | +
| boolean | + is_redeemable |
+Defines whether the gift card account is redeemable | +
| int | + store_id |
+Store view ID | +
| double | + balance |
+Gift card account initial balance | +
| string | + date_expires |
+Expiration date in the YYYY-MM-DD format | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 102 | +Unable to save data. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardId = 1;
+$giftcardToUpdate = array(
+ "balance" => 700
+);
+
+$result = $proxy->call(
+ $sessionId,
+ "giftcard_account.update",
+ array(
+ $giftcardId,
+ $giftcardToUpdate
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+
+$sessionId = $proxy->login('apiUser', 'apiKey');Â
+Â
+$result = $proxy->giftcardAccountUpdate($sessionId, '3', array(
+'date_expires' => null,Â
+'store_id' => '2',Â
+'balance' => '700',Â
+'is_active' => TRUE,Â
+'is_redeemable' => TRUE)); Â Â
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountUpdate((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '3', 'giftcardData' => array(
+'balance' => '700',
+'is_active' => TRUE,
+'is_redeemable' => TRUE,
+'store_id' => '2',
+'date_expires' => null)));
+
+var_dump($result->result);
+ | Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
| 101 | +Gift card is not valid. | +
| 103 | +Redemption functionality is disabled. | +
| 104 | +Unable to redeem gift card. | +
Allows you to receive information about the gift card for a selected customer.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +code | +Gift card code | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of giftcardCustomerEntity | +
The giftcardCustomerEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| double | + balance |
+Gift card balance | +
| string | + expire_date |
+Gift card expiration date in the YYYY-MM-DD format | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
| 101 | +Gift card is not valid. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$code = "code";
+
+$giftcardInfo = $proxy->call(
+ $sessionId,
+ "giftcard_customer.info",
+ array(
+ $code
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardCustomerInfo($sessionId, 'code');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardCustomerInfo((object)array('sessionId' => $sessionId->result, 'code' => 'code'));
+
+var_dump($result->result);
+ array + 'balance' => string '500.0000' (length=8) + 'expire_date' => string '2012-04-25' (length=10)+
Allows you to redeem amount from a giftcard to the customer store credit.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +code | +Gift card code | +
| string |
+customer_id | +Customer ID | +
| string |
+store_id | +Store view ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the amount is redeemed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
| 101 | +Gift card is not valid. | +
| 103 | +Redemption functionality is disabled. | +
| 104 | +Unable to redeem gift card. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$code = "giftcardcode";
+$customerId = 1;
+$storeId = 1;
+
+$giftcardInfo = $proxy->call(
+ $sessionId,
+ "giftcard_customer.redeem",
+ array(
+ $code,
+ $customerId,
+ $storeId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardCustomerRedeem($sessionId, 'giftcardcode', '1', '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardCustomerRedeem((object)array('sessionId' => $sessionId->result, 'code' => 'giftcardcode', 'customerId' => '1', 'storeId' => '1'));
+
+var_dump($result->result);
+ This module allows you to set a gift message for a quote or for a product in a quote.
+ + +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1101 | +Gift message data is not valid. | +
| 1102 | +Product's data is not valid. | +
| 1103 | +Quote item is not exists | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Create a quote, get quote identifier
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+// set gift message for quote
+$giftMessage = array (
+ 'from' => 'test',
+ 'to' => 'test',
+ 'message' => 'test'
+);
+
+$giftMessageSetForQuoteResult = $proxy->call($sessionId,"giftmessage.setForQuote", array($shoppingCartId, $giftMessage, 'magento_store'));
+print_r( $giftMessageSetForQuoteResult );
+
+
+// add products into shopping cart
+$arrProducts = array(
+ array(
+ 'product_id' => '1',
+ 'qty' => 2
+ ),
+ array(
+ 'sku' => 'testSKU',
+ 'qty' => 4
+ )
+);
+$resultCartProductAdd = $proxy->call($sessionId, 'cart_product.add', array($shoppingCartId, $arrProducts));
+
+// set gift message for product
+$giftMessage = array (
+ 'from' => 'test for Product',
+ 'to' => 'test for Product',
+ 'message' => 'test for Product'
+);
+
+/**
+* Note:
+* array for product should be the same as for cart_product.add
+*/
+$giftMessageSetForProductResult = $proxy->call(
+ $sessionId,
+ "giftmessage.setForQuoteProduct",
+ array(
+ $shoppingCartId,
+ array(
+ array(
+ 'product' => $arrProducts[0],
+ 'giftmessage' => $giftMessage,
+ ),
+ array(
+ 'product' => $arrProducts[1],
+ 'giftmessage' => $giftMessage,
+ )
+ ),
+ 'magento_store'
+ )
+);
+
+print_r( $giftMessageSetForProductResult );
+ Allows you to set a global gift message for the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| array | +giftMessage | +Array of giftMessageEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +giftMessageResponse | +
The giftMessageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + from |
+Gift message sender | +
| string |
+ to |
+Gift message recipient | +
| string |
+ message |
+Gift message text | +
The giftMessageResponse content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + entityId |
+Entity ID | +
| boolean | + result |
+Result of adding a message | +
| string | + error |
+Error | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'giftmessage.setForQuote', array('quoteId' => '10', 'giftMessage' => array('from' => 'John', 'to' => 'Sara', 'message' => 'Gift message text')));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+
+$sessionId = $proxy->login('apiUser', 'apiKey');Â
+Â
+$result = $proxy->giftMessageSetForQuote($sessionId, 10, array(
+'from' => 'John',
+'to' => 'Sara',
+'message' => 'Gift message text'
+)); Â
+Â
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftMessageSetForQuote((object)array('sessionId' => $sessionId->result, 'quoteId' => '10', 'giftMessage' => array(
+'from' => 'John',
+'to' => 'Sara',
+'message' => 'Gift message text'
+)));
+
+var_dump($result);
+ array + 'entityId' => string '15' (length=2) + 'result' => boolean true + 'error' => string '' (length=0)+
Allows you to set a gift message for an item in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteItemId | +Shopping cart (quote) item ID | +
| array | +giftMessage | +Array of giftMessageEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +giftMessageResponse | +
The giftMessageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + from |
+Gift message sender | +
| string | + to |
+Gift message recipient | +
| string | + message |
+Gift message | +
The giftMessageResponse content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + entityId |
+Entity ID | +
| boolean | + result |
+Result of adding a message | +
| string | + error |
+Error | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'giftmessage.setForQuoteItem', array('quoteItemId' => '1', 'giftMessage' => array('from' => 'John', 'to' => 'Sara', 'message' => 'Gift message text')));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->giftMessageSetForQuoteItem($sessionId, '1', array(
+'from' => 'John',
+'to' => 'Sara',
+'message' => 'Gift message text'
+));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));Â
+Â
+$result = $proxy->giftMessageSetForQuoteItem((object)array('sessionId' => $sessionId->result, 'quoteItemId' => '1', 'giftMessage' => array(
+'from' => 'John',
+'to' => 'Sara',
+'message' => 'Gift message text'
+))); Â
+Â
+var_dump($result);
+ array + 'entityId' => string '1' (length=1) + 'result' => boolean true + 'error' => string '' (length=0)+
Allows you to set a gift message for a product in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| array | + productsAndMessages |
+Array of giftMessageAssociativeProductsEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of giftMessageResponse | +
The giftMessageAssociativeProductsEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +product | +Array of shoppingCartProductEntity | +
| array | + message |
+Array of giftMessageEntity | +
The giftMessageResponse content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + entityId |
+Entity ID | +
| boolean | + result |
+Result | +
| string | + error |
+Error | +
The shoppingCartProductEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+ ID of the product |
+
| string | + sku |
+ SKU of the product |
+
| double | + qty |
+ Number of products |
+
| associativeArray |
+ options |
+An array of options | +
| associativeArray |
+ bundle_option |
+ An array of bundle item options |
+
| associativeArray |
+ bundle_option_qty |
+ An array of bundle items quantity |
+
| ArrayOfString | + links |
+ An array of links |
+
The giftMessageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + from |
+Gift message sender | +
| string | + to |
+Gift message recipient | +
| string | + message |
+Gift message | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->call($sessionId, 'giftmessage.setForQuoteProduct', array(10, array(
+'product' => array(
+ 'product_id' => '5',
+ 'sku' => 'sku',
+ 'qty' => '1',
+ 'options' => null,
+ 'bundle_option' => null,
+ 'bundle_option_qty' => null,
+ 'links' => null),
+'message' => array(
+ 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
+)));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->giftMessageSetForQuoteProduct($sessionId, '10', array(array(
+'product' => array(
+ 'product_id' => '5',
+ 'sku' => 'sku',
+ 'qty' => '1',
+ 'options' => null,
+ 'bundle_option' => null,
+ 'bundle_option_qty' => null,
+ 'links' => null),
+'message' => array(
+ 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
+)));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftMessageSetForQuoteProduct((object)array('sessionId' => $sessionId->result, 'quoteId' => '10', 'productsAndMessages' => array(array(
+'product' => array(
+ 'product_id' => '5',
+ 'sku' => 'sku',
+ 'qty' => '1',
+ 'options' => null,
+ 'bundle_option' => null,
+ 'bundle_option_qty' => null,
+ 'links' => null),
+'message' => array(
+ 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
+))));
+
+var_dump($result->result);
+ Allows you to retrieve the customer store credit balance amount.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +customerId | +Customer ID | +
| string | +websiteId | +Website ID | +
Return:
+ +| Type | +Description | +
|---|---|
| string/float | +Virtual balance amount | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 101 | +No balance found with requested parameters. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$customerId = 4;
+$websiteId = 2;
+
+$balanceAmount = $proxy->call($sessionId, 'storecredit.balance', array($customerId, $websiteId));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->enterpriseCustomerbalanceBalance($sessionId, '4', '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->enterpriseCustomerbalanceBalance((object)array('sessionId' => $sessionId->result, 'customerId' => '4', 'websiteId' => '2'));
+var_dump($result->result);
+ Allows you to retrieve the customer store credit history information.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +customerId | +Customer ID | +
| string | +websiteId | +Website ID (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of enterpriseCustomerbalanceHistoryItemEntity | +
The enterpriseCustomerbalanceHistoryItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +history_id | + History item ID |
+
| string |
+ balance_id |
+ Customer balance ID |
+
| string |
+ updated_at |
+Date when the balance was updated | +
| string |
+ action |
+ Code of the reason for balance change |
+
| string |
+ balance_amount |
+ Balance amount after changing |
+
| string |
+ balance_delta |
+ Balance change amount |
+
| string |
+ additional_info |
+ Comment text |
+
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ customer_id |
+ Balance owner ID |
+
| string |
+ website_id |
+Website ID | +
| string |
+ base_currency_code |
+ Currency code for the customer balance |
+
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 102 | +No history found with requested parameters. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$customerId = 4;
+
+$balanceHistory = $proxy->call($sessionId, 'storecredit.history', array($customerId));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->enterpriseCustomerbalanceHistory($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->enterpriseCustomerbalanceHistory((object)array('sessionId' => $sessionId->result, 'customerId' => '4', 'websiteId' => '2'));
+var_dump($result->result);
+ array + 0 => + array + 'history_id' => string '2' (length=1) + 'balance_id' => string '1' (length=1) + 'updated_at' => string '2012-04-06 13:50:33' (length=19) + 'action' => string '1' (length=1) + 'balance_amount' => string '300.0000' (length=8) + 'balance_delta' => string '-200.0000' (length=9) + 'additional_info' => string 'By admin: john@example.com. (update balance)' (length=44) + 'is_customer_notified' => string '0' (length=1) + 'customer_id' => string '4' (length=1) + 'website_id' => string '2' (length=1) + 'base_currency_code' => null + 1 => + array + 'history_id' => string '1' (length=1) + 'balance_id' => string '1' (length=1) + 'updated_at' => string '2012-04-06 13:44:58' (length=19) + 'action' => string '2' (length=1) + 'balance_amount' => string '500.0000' (length=8) + 'balance_delta' => string '500.0000' (length=8) + 'additional_info' => string 'By admin: john@example.com. (new balance)' (length=41) + 'is_customer_notified' => string '0' (length=1) + 'customer_id' => string '4' (length=1) + 'website_id' => string '2' (length=1) + 'base_currency_code' => null+
Allows you to operate with customer virtual balance.
+ + +Aliases: storecredit
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 101 | +No balance found with requested parameters. | +
| 102 | +No history found with requested parameters. | +
Allows you to operate with customer virtual balance.
+ +Aliases: storecredit
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 101 | +No balance found with requested parameters. | +
| 102 | +No history found with requested parameters. | +
Aliases: storecredit_quote
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 103 | +No quote found with requested id. | +
| 104 | +Store credit can not be used for quote created by guest. | +
| 105 | +No store found with requested id or code. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$customerId = 10002;
+$websiteId = 1;
+// Get customer balance amount
+$balanceAmount = $proxy->call($sessionId, 'storecredit.balance', array($customerId, $websiteId));
+echo $balanceAmount . "<br />";
+// Get store credit history for specified customer
+$balanceHistory = $proxy->call($sessionId, 'storecredit.history', array($customerId));
+print_r($balanceHistory);
+
+$quoteId = 2;
+$store = 'default';
+// Set customer balance use in shopping cart (quote)
+$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.setAmount', array($quoteId, $store));
+echo $balanceAmountUsedInQuote . "<br />";
+// Unset customer balance use in shopping cart (quote)
+$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.removeAmount', array($quoteId));
+echo $balanceAmountUsedInQuote;
+ Allows you to operate with customer virtual balance.
+ +Aliases: storecredit_quote
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 103 | +No quote found with requested id. | +
| 104 | +Store credit can not be used for quote created by guest. | +
| 105 | +No store found with requested id or code. | +
Allows you to remove store credit amount from the shopping cart (quote) and increase the customer store credit.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| string | +store | +Store view code or ID (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +Result of removing the amount | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 103 | +No quote found with requested id. | +
| 104 | +Store credit can not be used for quote created by guest. | +
| 105 | +No store found with requested id or code. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$quoteId = 15;
+
+$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.removeAmount', array($quoteId));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCustomerbalanceRemoveAmount($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCustomerbalanceRemoveAmount((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'store' => null));
+var_dump($result->result);
+ Allows you to set amount from the customer store credit to the shopping cart.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| string | +store | +Store view code or ID (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| float | +Customer balance amount used in the shopping cart (quote) | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 103 | +No quote found with requested id. | +
| 104 | +Store credit can not be used for quote created by guest. | +
| 105 | +No store found with requested id or code. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$quoteId = 2;
+$store = 'default';
+
+$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.setAmount', array($quoteId, $store));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCustomerbalanceSetAmount($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCustomerbalanceSetAmount((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'store' => null));
+var_dump($result->result);
+ The Magento SOAP v1 API provides you with the ability to manage your eCommerce stores by providing calls for working with resources such as customers, categories, products, and sales orders. It also allows you to manage shopping carts and inventory.
+ +A SOAP v2 API version has been available since Magento 1.3, and a WS-I compliant version has been available since Magento 1.6.
+ +The Magento API supports SOAP and XML-RPC, where SOAP is the default protocol.
+ +To connect to Magento SOAP web services, load the WSDL into your SOAP client from either of these URLs:
+ +http://magentohost/api/?wsdl+
http://magentohost/api/soap/?wsdl+
where magentohost is the domain for your Magento host.
+ +As of v1.3, you may also use the following URL to access the Magento API v2, which has been added to improve compatibility with Java and .NET:
+ +http://magentohost/api/v2_soap?wsdl=1+
The following PHP example shows how to make SOAP calls to the Magento API v1:
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'somestuff.method');
+$result = $client->call($session, 'somestuff.method', 'arg1');
+$result = $client->call($session, 'somestuff.method', array('arg1', 'arg2', 'arg3'));
+$result = $client->multiCall($session, array(
+ array('somestuff.method'),
+ array('somestuff.method', 'arg1'),
+ array('somestuff.method', array('arg1', 'arg2'))
+));
+
+
+// If you don't need the session anymore
+$client->endSession($session);
+ To use XML-RPC, load the following URL into your XML-RPC client:
+ +http://magentohost/api/xmlrpc/+
where magentohost is the domain for your Magento host.
+ +The following PHP example shows how to make XML-RPC calls:
+ +$client = new Zend_XmlRpc_Client('http://magentohost/api/xmlrpc/');
+
+// If somestuff requires API authentication,
+// we should get session token
+$session = $client->call('login', array('apiUser', 'apiKey'));
+
+$client->call('call', array($session, 'somestuff.method', array('arg1', 'arg2', 'arg3')));
+$client->call('call', array($session, 'somestuff.method', 'arg1'));
+$client->call('call', array($session, 'somestuff.method'));
+$client->call('multiCall', array($session,
+ array(
+ array('somestuff.method', 'arg1'),
+ array('somestuff.method', array('arg1', 'arg2')),
+ array('somestuff.method')
+ )
+));
+
+// If you don't need the session anymore
+$client->call('endSession', array($session));
+ The XML-RPC only supports the version 1 of the Magento API.
+ +The following table contains the API methods that can be called from your SOAP or XML-RPC client on the Magento v1 API.
+ + + +| Method | +Description | +Return Value | +
|---|---|---|
| startSession() | +Start the API session and return session ID. | +string | +
| endSession(sessionId) | +End the API session. | +boolean | +
| login(apiUser, apiKey) | +Start the API session, return the session ID, and authorize the API user. | +string | +
| call(sessionId, resourcePath,array arguments) | +Call the API resource that is allowed in the current session. See Note below. | +mixed | +
| multiCall(sessionId, array calls,array options) | +Call the API resource’s methods that are allowed for current session. See Notes below. | +array | +
| resources(sessionId) | +Return a list of available API resources and methods allowed for the current session. | +array | +
| globalFaults(sessionId) | +Return a list of fault messages and their codes that do not depend on any resource. | +array | +
| resourceFaults(sessionId, resourceName) | +Return a list of the specified resource fault messages, if this resource is allowed in the current session. | +array | +
Note: For call and multiCall, if no session is specified, you can call only resources that are not protected by ACL.
+ +Note: For multiCall, if the "break" option is specified, multiCall breaks on first error.
+ +The Magento SOAP API v2 does not support the call() and multiCall() methods, and instead provides a separate method for each API resource.
+ +The following table contains fault codes that apply to all SOAP/XML-RPC API calls.
+ +| Fault Code | +Fault Message | +
|---|---|
| 0 | +Unknown Error | +
| 1 | +Internal Error. Please see log for details. | +
| 2 | +Access denied. | +
| 3 | +Invalid API path. | +
| 4 | +Resource path is not callable. | +
Since Magento 1.3, version v2 of the SOAP API has also been available. The main difference between v1 and v2 is that instead of using methods call and multiCall, it has separate methods for each action.
+ +For example, consider the following PHP code using SOAP v1.
+$params = array(array(
+ 'status'=>array('eq'=>'pending'),
+ 'customer_is_guest'=>array('eq'=>'1'))
+));
+$result = $client->call($sessionId, 'sales_order.list', $params);
+ With SOAP v2, the following code would be equivalent.
+$params = array('filter' => array(
+ array('key' => 'status', 'value' => 'pending'),
+ array('key' => 'customer_is_guest', 'value' => '1')
+));
+$result = $client->salesOrderList($sessionId, $params);
+ Note that the WSDL for SOAP v1 and SOAP v2 are different. Note that in SOAP v1, customizing the API did not involve changing the WSDL. In SOAP v2, changes to the WSDL are required.
+ +You can configure the SOAP v2 API to be WS-I compliant in the system configuration menu. To do this, set Services > Magento Core API > WS-I Compliance to Yes.
+ +Note that the WSDL for the SOAP v2 API is different when in WS-I compliant mode.
+ +Using the WS-I compliant SOAP v2 API WSDL, it is easy to automatically generate client classes for Java, .NET, and other languages using standard libraries.
+ + + diff --git a/guides/v1.8/api/soap/miscellaneous/magento.info.html b/guides/v1.8/api/soap/miscellaneous/magento.info.html new file mode 100644 index 0000000000..655ef33b39 --- /dev/null +++ b/guides/v1.8/api/soap/miscellaneous/magento.info.html @@ -0,0 +1,118 @@ +--- +layout: v1x_soap +title: Magento Info +--- + +Allows you to get information about the current Magento installation.
+ +Aliases: magento
+ + +Allows you to retrieve information about Magento version and edition.
+ +Aliases: magento.info
+ +Arguments:
+ +| Type |
+ Name |
+ Description |
+
|---|---|---|
| string |
+ sessionId |
+Session ID | +
Returns:
+ +| Type |
+ Name |
+ Description |
+
|---|---|---|
| string | +magento_version | +Magento version | +
| string | +magento_edition | +Magento edition (Community, Professional, Enterprise) | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$magentoInfo = $proxy->call(
+ $sessionId,
+ 'magento.info'
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->magentoInfo($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->magentoInfo((object)array('sessionId' => $sessionId->result));
+
+var_dump($result->result);
+ array + 'magento_edition' => string 'Community' (length=9) + 'magento_version' => string '1.4.2.0-rc1' (length=11)+
The following APIs allow you to access additional Magento information.
+ +Allows you to retrieve information on the store view.
+ +Resource Name: Store
+ +Allows you to get information about the current Magento installation.
+ +Resource Name: core_magento
+ +Aliases: magento
+ + +Allows you to retrieve information about the required store view.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeId | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of storeEntity | +
The storeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + store_id |
+Store view ID | +
| string | + code |
+Store view code | +
| int | + website_id |
+Website ID | +
| int | + group_id |
+Group ID | +
| string | + name |
+Store name | +
| int | + sort_order |
+Store view sort order | +
| int | + is_active |
+Defines whether the store is active | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store view not found. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'store.info', '2');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->storeInfo($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->storeInfo((object)array('sessionId' => $sessionId->result, 'storeId' => '2'));
+
+var_dump($result->result);
+ array + 'store_id' => string '2' (length=1) + 'code' => string 'english' (length=7) + 'website_id' => string '2' (length=1) + 'group_id' => string '2' (length=1) + 'name' => string 'English' (length=7) + 'sort_order' => string '0' (length=1) + 'is_active' => string '1' (length=1)+
Allows you to retrieve the list of store views.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of storeEntity | +
The storeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + store_id |
+Store view ID | +
| string | + code |
+Store view code | +
| int | + website_id |
+Website ID | +
| int | + group_id |
+Group ID | +
| string | + name |
+Store view name | +
| int | + sort_order |
+Store view sort order | +
| int | + is_active |
+Defines whether the store is active | +
Faults:
+No Faults
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'store.list');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->storeList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->storeList((object)array('sessionId' => $sessionId->result));
+
+var_dump($result->result);
+ array + 0 => + array + 'store_id' => string '1' (length=1) + 'code' => string 'default' (length=7) + 'website_id' => string '1' (length=1) + 'group_id' => string '1' (length=1) + 'name' => string 'Default Store View' (length=18) + 'sort_order' => string '0' (length=1) + 'is_active' => string '1' (length=1) + 1 => + array + 'store_id' => string '2' (length=1) + 'code' => string 'english' (length=7) + 'website_id' => string '2' (length=1) + 'group_id' => string '2' (length=1) + 'name' => string 'English' (length=7) + 'sort_order' => string '0' (length=1) + 'is_active' => string '1' (length=1)+
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
+ +Allows you to manage orders.
+ +Resource Name: sales_order
+ +Aliases:
+Methods:
+Allows you to manage invoices.
+ +Resource Name: sales_order_invoice
+ +Aliases:
+Methods:
+Allows you to manage shipments and tracking numbers.
+ +Resource Name: sales_order_shipment
+ +Aliases:
+Methods:
+Allows you to manage order credit memos.
+ +Resource Name: sales_order_creditmemo
+ +Aliases:
+The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
+ +Allows you to manage orders.
+ +Resource Name: sales_order
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested order not exists. | +
| 101 | +Invalid filters given. Details in error message. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Order status not changed. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Getting list of orders created by John Doe
+var_dump($proxy->call($sessionId, 'sales_order.list', array(array('customer_firstname'=>array('eq'=>'John'), 'customer_lastname'=>array('eq'=>'Doe')))));
+
+
+// Get order info 100000003
+var_dump($proxy->call($sessionId, 'sales_order.info', '100000003'));
+
+
+// Hold order 100000003
+$proxy->call($sessionId, 'sales_order.hold', '100000003');
+
+// Unhold order 100000003
+$proxy->call($sessionId, 'sales_order.unhold', '100000003');
+
+// Hold order and add comment 100000003
+$proxy->call($sessionId, 'sales_order.addComment', array('100000003', 'holded', 'You order is holded', true));
+
+// Unhold order and add comment 100000003
+$proxy->call($sessionId, 'sales_order.addComment', array('100000003', 'pending', 'You order is pending', true));
+
+// Get order info 100000003
+var_dump($proxy->call($sessionId, 'sales_order.info', '100000003'));
+ Aliases:
+Allows you to add a new comment to the order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
| string | + status |
+Order status (pending, processing, etc.) | +
| string | + comment |
+Order comment (optional) | +
| string | + notify |
+Notification flag (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the comment is added to the order | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.addComment', array('orderIncrementId' => '200000004', 'status' => 'processing'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderAddComment($sessionId, '200000004', 'processing');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderAddComment((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000004', 'status' => 'processing', 'comment' => 'comment to the order', 'notify' => null));
+var_dump($result->result);
+ Aliases:
+Allows you to cancel the required order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the order is canceled | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.cancel', '200000004');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCancel($sessionId, '200000004');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCancel((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000004'));
+var_dump($result->result);
+ Aliases:
+Allows you to place the required order on hold.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the order is placed on hold | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.hold', '200000006');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderHold($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderHold((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the required order information.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderEntity | +
The salesOrderEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Defines whether the order is active | +
| string |
+ customer_id |
+Customer ID | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ subtotal |
+Subtotal sum | +
| string |
+ grand_total |
+Grand total sum | +
| string |
+ total_paid |
+Total paid | +
| string |
+ total_refunded |
+Total refunded | +
| string |
+ total_qty_ordered |
+Total quantity ordered | +
| string |
+ total_canceled |
+Total canceled | +
| string |
+ total_invoiced |
+Total invoiced | +
| string |
+ total_online_refunded |
+Total online refunded | +
| string |
+ total_offline_refunded |
+Total offline refunded | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ base_total_paid |
+Base total paid | +
| string |
+ base_total_refunded |
+Base total refunded | +
| string |
+ base_total_qty_ordered |
+Base total quantity ordered | +
| string |
+ base_total_canceled |
+Base total canceled | +
| string |
+ base_total_invoiced |
+Base total invoiced | +
| string |
+ base_total_online_refunded |
+Base total online refunded | +
| string |
+ base_total_offline_refunded |
+Base total offline refunded | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ billing_firstname |
+First name in the billing address | +
| string |
+ billing_lastname |
+Last name in the billing address | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ shipping_firstname |
+First name in the shipping address | +
| string |
+ shipping_lastname |
+Last name in the shipping address | +
| string |
+ billing_name |
+Billing name | +
| string |
+ shipping_name |
+Shipping name | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ weight |
+Weight | +
| string |
+ store_name |
+Store name | +
| string |
+ remote_ip |
+Remote IP | +
| string |
+ status |
+Order status | +
| string |
+ state |
+Order state | +
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ shipping_method |
+Shipping method | +
| string |
+ shipping_description |
+Shipping description | +
| string |
+ customer_email |
+Email address of the customer | +
| string |
+ customer_firstname |
+Customer first name | +
| string |
+ customer_lastname |
+Customer last name | +
| string |
+ quote_id |
+Shopping cart ID | +
| string |
+ is_virtual |
+Defines whether the product is a virtual one | +
| string |
+ customer_group_id |
+Customer group ID | +
| string |
+ customer_note_notify |
+Customer notification | +
| string |
+ customer_is_guest |
+Defines whether the customer is a guest | +
| string |
+ email_sent |
+Defines whether the email notification is sent | +
| string |
+ order_id |
+Order ID | +
| string |
+ gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
| array | + shipping_address |
+Array of salesOrderAddressEntity | +
| array | + billing_address |
+Array of salesOrderAddressEntity | +
| array | + items |
+Array of salesOrderItemEntity | +
| array | + payment |
+Array of salesOrderPaymentEntity | +
| array | + status_history |
+Array of salesOrderStatusHistoryEntity | +
The salesOrderAddressEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Defines whether the address is active | +
| string |
+ address_type |
+Address type | +
| string |
+ firstname |
+First name | +
| string |
+ lastname |
+Last name | +
| string |
+ company |
+Company name | +
| string |
+ street |
+Street name | +
| string |
+ city |
+City | +
| string |
+ region |
+Region | +
| string |
+ postcode |
+Post code | +
| string |
+ country_id |
+Country ID | +
| string |
+ telephone |
+Telephone number | +
| string |
+ fax |
+Fax number | +
| string |
+ region_id |
+Region ID | +
| string |
+ address_id |
+Address ID | +
The salesOrderItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + item_id |
+Item ID | +
| string |
+ order_id |
+Order ID | +
| string |
+ quote_item_id |
+Shopping cart item ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ product_id |
+Product ID | +
| string |
+ product_type |
+Product type | +
| string |
+ product_options |
+Product options | +
| string |
+ weight |
+Weight | +
| string |
+ is_virtual |
+Defines whether the product is a virtual one | +
| string |
+ sku |
+ Product SKU |
+
| string |
+ name |
+ Product name |
+
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ free_shipping |
+Defines whether free shipping is applied | +
| string |
+ is_qty_decimal |
+Defines whether the items quantity is decimal | +
| string |
+ no_discount |
+Defines whether no discount is applied | +
| string |
+ qty_canceled |
+Items quantity canceled | +
| string |
+ qty_invoiced |
+Items quantity invoiced | +
| string |
+ qty_ordered |
+Items quantity ordered | +
| string |
+ qty_refunded |
+Items quantity refunded | +
| string |
+ qty_shipped |
+Items quantity shipped | +
| string |
+ cost |
+Cost | +
| string |
+ price |
+Price | +
| string |
+ base_price |
+Base price | +
| string |
+ original_price |
+Original price | +
| string |
+ base_original_price |
+Base original price | +
| string |
+ tax_percent |
+Tax percent | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ tax_invoiced |
+Tax invoiced | +
| string |
+ base_tax_invoiced |
+Base tax invoiced | +
| string |
+ discount_percent |
+Discount percent | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ discount_invoiced |
+Discount invoiced | +
| string |
+ base_discount_invoiced |
+Base discount invoiced | +
| string |
+ amount_refunded |
+Amount refunded | +
| string |
+ base_amount_refunded |
+Base amount refunded | +
| string |
+ row_total |
+Row total | +
| string |
+ base_row_total |
+Base row total | +
| string |
+ row_invoiced |
+Row invoiced | +
| string |
+ base_row_invoiced |
+Base row invoiced | +
| string |
+ row_weight |
+Row weight | +
| string |
+ gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
| string |
+ gift_message_available |
+Defines whether the gift message is available | +
| string |
+ base_tax_before_discount |
+Base tax before discount | +
| string |
+ tax_before_discount |
+Tax before discount | +
| string |
+ weee_tax_applied |
+Applied fixed product tax | +
| string |
+ weee_tax_applied_amount |
+Applied fixed product tax amount | +
| string |
+ weee_tax_applied_row_amount |
+Applied fixed product tax row amount | +
| string |
+ base_weee_tax_applied_amount |
+Applied fixed product tax amount (in base currency) | +
| string |
+ base_weee_tax_applied_row_amount |
+Applied fixed product tax row amount (in base currency) | +
| string |
+ weee_tax_disposition |
+Fixed product tax disposition | +
| string |
+ weee_tax_row_disposition |
+Fixed product tax row disposition | +
| string |
+ base_weee_tax_disposition |
+Fixed product tax disposition (in base currency) | +
| string |
+ base_weee_tax_row_disposition |
+Fixed product tax row disposition (in base currency) | +
The salesOrderPaymentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Active flag | +
| string |
+ amount_ordered |
+Amount ordered | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ base_amount_ordered |
+Base amount ordered | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ method |
+Payment method | +
| string |
+ po_number |
+Purchase order number | +
| string |
+ cc_type |
+Credit card type | +
| string |
+ cc_number_enc |
+Credit card number | +
| string |
+ cc_last4 |
+Credit card last 4 digits | +
| string |
+ cc_owner |
+Credit card owner | +
| string |
+ cc_exp_month |
+Credit card expiration month | +
| string |
+ cc_exp_year |
+Credit card expiration year | +
| string |
+ cc_ss_start_month |
+Credit card start month (Switch/Solo) | +
| string |
+ cc_ss_start_year |
+Credit card start year (Switch/Solo) | +
| string |
+ payment_id |
+Payment ID | +
The salesOrderStatusHistoryEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Active flag | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ status |
+Order status | +
| string |
+ comment |
+Order comment | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.info', 'orderIncrementId');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderInfo($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInfo((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
+var_dump($result->result);
+ array + 'state' => string 'new' (length=3) + 'status' => string 'pending' (length=7) + 'coupon_code' => null + 'protect_code' => string 'defe18' (length=6) + 'shipping_description' => string 'Flat Rate - Fixed' (length=17) + 'is_virtual' => string '0' (length=1) + 'store_id' => string '2' (length=1) + 'customer_id' => string '2' (length=1) + 'base_discount_amount' => string '0.0000' (length=6) + 'base_discount_canceled' => null + 'base_discount_invoiced' => null + 'base_discount_refunded' => null + 'base_grand_total' => string '619.9700' (length=8) + 'base_shipping_amount' => string '10.0000' (length=7) + 'base_shipping_canceled' => null + 'base_shipping_invoiced' => null + 'base_shipping_refunded' => null + 'base_shipping_tax_amount' => string '0.0000' (length=6) + 'base_shipping_tax_refunded' => null + 'base_subtotal' => string '609.9700' (length=8) + 'base_subtotal_canceled' => null + 'base_subtotal_invoiced' => null + 'base_subtotal_refunded' => null + 'base_tax_amount' => string '0.0000' (length=6) + 'base_tax_canceled' => null + 'base_tax_invoiced' => null + 'base_tax_refunded' => null + 'base_to_global_rate' => string '1.0000' (length=6) + 'base_to_order_rate' => string '1.0000' (length=6) + 'base_total_canceled' => null + 'base_total_invoiced' => null + 'base_total_invoiced_cost' => null + 'base_total_offline_refunded' => null + 'base_total_online_refunded' => null + 'base_total_paid' => null + 'base_total_qty_ordered' => null + 'base_total_refunded' => null + 'discount_amount' => string '0.0000' (length=6) + 'discount_canceled' => null + 'discount_invoiced' => null + 'discount_refunded' => null + 'grand_total' => string '619.9700' (length=8) + 'shipping_amount' => string '10.0000' (length=7) + 'shipping_canceled' => null + 'shipping_invoiced' => null + 'shipping_refunded' => null + 'shipping_tax_amount' => string '0.0000' (length=6) + 'shipping_tax_refunded' => null + 'store_to_base_rate' => string '1.0000' (length=6) + 'store_to_order_rate' => string '1.0000' (length=6) + 'subtotal' => string '609.9700' (length=8) + 'subtotal_canceled' => null + 'subtotal_invoiced' => null + 'subtotal_refunded' => null + 'tax_amount' => string '0.0000' (length=6) + 'tax_canceled' => null + 'tax_invoiced' => null + 'tax_refunded' => null + 'total_canceled' => null + 'total_invoiced' => null + 'total_offline_refunded' => null + 'total_online_refunded' => null + 'total_paid' => null + 'total_qty_ordered' => string '2.0000' (length=6) + 'total_refunded' => null + 'can_ship_partially' => null + 'can_ship_partially_item' => null + 'customer_is_guest' => string '0' (length=1) + 'customer_note_notify' => string '1' (length=1) + 'billing_address_id' => string '1' (length=1) + 'customer_group_id' => string '1' (length=1) + 'edit_increment' => null + 'email_sent' => string '1' (length=1) + 'forced_shipment_with_invoice' => null + 'payment_auth_expiration' => null + 'quote_address_id' => null + 'quote_id' => string '1' (length=1) + 'shipping_address_id' => string '2' (length=1) + 'adjustment_negative' => null + 'adjustment_positive' => null + 'base_adjustment_negative' => null + 'base_adjustment_positive' => null + 'base_shipping_discount_amount' => string '0.0000' (length=6) + 'base_subtotal_incl_tax' => string '609.9700' (length=8) + 'base_total_due' => null + 'payment_authorization_amount' => null + 'shipping_discount_amount' => string '0.0000' (length=6) + 'subtotal_incl_tax' => string '609.9700' (length=8) + 'total_due' => null + 'weight' => string '1.2000' (length=6) + 'customer_dob' => null + 'increment_id' => string '200000001' (length=9) + 'applied_rule_ids' => null + 'base_currency_code' => string 'USD' (length=3) + 'customer_email' => string 'john@example.com' (length=16) + 'customer_firstname' => string 'johny' (length=5) + 'customer_lastname' => string 'doe' (length=3) + 'customer_middlename' => null + 'customer_prefix' => null + 'customer_suffix' => null + 'customer_taxvat' => null + 'discount_description' => null + 'ext_customer_id' => null + 'ext_order_id' => null + 'global_currency_code' => string 'USD' (length=3) + 'hold_before_state' => null + 'hold_before_status' => null + 'order_currency_code' => string 'USD' (length=3) + 'original_increment_id' => null + 'relation_child_id' => null + 'relation_child_real_id' => null + 'relation_parent_id' => null + 'relation_parent_real_id' => null + 'remote_ip' => string '127.0.0.1' (length=9) + 'shipping_method' => string 'flatrate_flatrate' (length=17) + 'store_currency_code' => string 'USD' (length=3) + 'store_name' => string 'website +English store +English' (length=29) + 'x_forwarded_for' => null + 'customer_note' => null + 'created_at' => string '2012-03-30 11:40:30' (length=19) + 'updated_at' => string '2012-03-30 11:40:32' (length=19) + 'total_item_count' => string '2' (length=1) + 'customer_gender' => null + 'hidden_tax_amount' => string '0.0000' (length=6) + 'base_hidden_tax_amount' => string '0.0000' (length=6) + 'shipping_hidden_tax_amount' => string '0.0000' (length=6) + 'base_shipping_hidden_tax_amnt' => string '0.0000' (length=6) + 'hidden_tax_invoiced' => null + more elements...+
Aliases:
+Allows you to retrieve the list of orders. Additional filters can be applied.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +filters | +Array of filters for the list of sales orders (optional) | +
Returns:
+ +| Type | +name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderEntity | +
The salesOrderEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Defines whether the order is active | +
| string |
+ customer_id |
+Customer ID | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ subtotal |
+Subtotal sum | +
| string |
+ grand_total |
+Grand total sum | +
| string |
+ total_paid |
+Total paid | +
| string |
+ total_refunded |
+Total refunded | +
| string |
+ total_qty_ordered |
+Total quantity ordered | +
| string |
+ total_canceled |
+Total canceled | +
| string |
+ total_invoiced |
+Total invoiced | +
| string |
+ total_online_refunded |
+Total online refunded | +
| string |
+ total_offline_refunded |
+Total offline refunded | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ base_total_paid |
+Base total paid | +
| string |
+ base_total_refunded |
+Base total refunded | +
| string |
+ base_total_qty_ordered |
+Base total quantity ordered | +
| string |
+ base_total_canceled |
+Base total canceled | +
| string |
+ base_total_invoiced |
+Base total invoiced | +
| string |
+ base_total_online_refunded |
+Base total online refunded | +
| string |
+ base_total_offline_refunded |
+Base total offline refunded | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ billing_firstname |
+First name in the billing address | +
| string |
+ billing_lastname |
+Last name in the billing address | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ shipping_firstname |
+First name in the shipping address | +
| string |
+ shipping_lastname |
+Last name in the shipping address | +
| string |
+ billing_name |
+Billing name | +
| string |
+ shipping_name |
+Shipping name | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ weight |
+Weight | +
| string |
+ store_name |
+Store name | +
| string |
+ remote_ip |
+Remote IP | +
| string |
+ status |
+Order status | +
| string |
+ state |
+Order state | +
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ shipping_method |
+Shipping method | +
| string |
+ shipping_description |
+Shipping description | +
| string |
+ customer_email |
+Email address of the customer | +
| string |
+ customer_firstname |
+Customer first name | +
| string |
+ customer_lastname |
+Customer last name | +
| string |
+ quote_id |
+Shopping cart ID | +
| string |
+ is_virtual |
+Defines whether the product is a virtual one | +
| string |
+ customer_group_id |
+Customer group ID | +
| string |
+ customer_note_notify |
+Customer notification | +
| string |
+ customer_is_guest |
+Defines whether the customer is a guest | +
| string |
+ email_sent |
+Defines whether the email notification is sent | +
| string |
+ order_id |
+Order ID | +
| string |
+ gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'order.list');
+var_dump ($result);
+ $params = array(array(
+ 'filter' => array(
+ array(
+ 'key' => 'status',
+ 'value' => 'pending'
+ ),
+ array(
+ 'key' => 'created_at',
+ 'value' => '2001-11-25 12:12:07',
+ )
+ ),
+ 'complex_filter' => array(
+ array(
+ 'key' => 'order_id',
+ 'value' => array(
+ 'key' => 'in',
+ 'value' => '12,23'
+ ),
+ ),
+ array(
+ 'key' => 'protect_code',
+ 'value' => array(
+ 'key' => 'eq',
+ 'value' => 'ebb2a0'
+ ),
+ ),
+ )
+ ));
+
+$result = $client->__call('salesOrderList', $params);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$filter = array('filter' => array(array('key' => 'status', 'value' => 'closed')));
+$result = $client->salesOrderList($session, $filter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderList((object)array('sessionId' => $sessionId->result, 'filters' => null));
+var_dump($result->result);
+ <?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" + SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> + <SOAP-ENV:Body> + <ns1:salesOrderList> + <sessionId xsi:type="xsd:string">abbc417256a3ffb93d130a77a2fd3665</sessionId> + <filters xsi:type="ns1:filters"> + <filter SOAP-ENC:arrayType="ns1:associativeEntity[2]" xsi:type="ns1:associativeArray"> + <item xsi:type="ns1:associativeEntity"> + <key xsi:type="xsd:string">status</key> + <value xsi:type="xsd:string">pending</value> + </item> + <item xsi:type="ns1:associativeEntity"> + <key xsi:type="xsd:string">created_at</key> + <value xsi:type="xsd:string">2011-11-29 15:41:11</value> + </item> + </filter> + <complex_filter SOAP-ENC:arrayType="ns1:complexFilter[2]" xsi:type="ns1:complexFilterArray"> + <item xsi:type="ns1:complexFilter"> + <key xsi:type="xsd:string">order_id</key> + <value xsi:type="ns1:associativeEntity"> + <key xsi:type="xsd:string">in</key> + <value xsi:type="xsd:string">Array</value> + </value> + </item> + <item xsi:type="ns1:complexFilter"> + <key xsi:type="xsd:string">protect_code</key> + <value xsi:type="ns1:associativeEntity"> + <key xsi:type="xsd:string">in</key> + <value xsi:type="xsd:string">a4ffa8</value> + </value> + </item> + </complex_filter> + </filters> + </ns1:salesOrderList> + </SOAP-ENV:Body> +</SOAP-ENV:Envelope>+
Aliases:
+Allows you to unhold the required order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the order is unheld | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.unhold', '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->salesOrderUnhold($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderUnhold((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
+var_dump($result->result);
+ Allows you to operate with credit memos for orders.
+ + +Aliases: order_creditmemo
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested credit memo does not exist. | +
| 101 | +Invalid filter given. Details in error message. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested order does not exist. | +
| 104 | +Credit memo status not changed. | +
| 105 | +Money can not be refunded to the store credit account as order was created by guest. | +
| 106 | +Credit memo for requested order can not be created. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Create creditmemo
+$orderIncrementId = '100000683'; //increment id of the invoiced order
+$data = array(
+ 'qtys' => array(
+ '712' => 1
+ ),
+ 'shipping_amount' => 3,
+ 'adjustment_positive' => 0.7,
+ 'adjustment_negative' => 0.06
+);
+$creditmemoIncrementId = $proxy->call($sessionId, 'order_creditmemo.create', array($orderIncrementId, $data));
+echo $creditmemoIncrementId . "<br />";
+
+// Add comment to created creditmemo
+$commentText = "Credit memo comment successfully added";
+$isCommentAdded = $proxy->call($sessionId, 'order_creditmemo.addComment', array($creditmemoIncrementId, $commentText, true));
+
+// Retrieve information about created creditmemo
+$creditmemoInfo = $proxy->call($sessionId, 'order_creditmemo.info', array($creditmemoIncrementId));
+print_r($creditmemoInfo);
+
+// Retrieve list of creditmemos by filter
+$filter = array(
+ 'increment_id' => array(
+ 'or' => array(
+ array(
+ 'from' => '100000617',
+ 'to' => '100000619',
+ ),
+ array(
+ 'from' => $creditmemoIncrementId,
+ 'to' => NULL,
+ )
+ )
+ )
+);
+$creditmemoList = $proxy->call($sessionId, 'order_creditmemo.list', array($filter));
+print_r($creditmemoList);
+ Aliases: order_creditmemo
+ +Allows you to add a new comment to an existing credit memo. Email notification can be sent to the user email.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +creditmemoIncrementId | +Credit memo increment ID | +
| string | +comment | +Comment text (optional) | +
| int | +notifyCustomer | +Notify customer by email flag (optional) | +
| int | +includeComment | +Include comment text into the email notification (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the comment is added to the credit memo | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested credit memo does not exist. | +
| 102 | +Invalid data given. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$creditmemoIncrementId = '200000001'; //increment id of existing credit memo
+$commentText = "Credit memo comment successfully added";
+
+$isCommentAdded = $proxy->call($sessionId, 'order_creditmemo.addComment', array($creditmemoIncrementId, $commentText, true));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCreditmemoAddComment($sessionId, '200000001');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCreditmemoAddComment((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000001', 'comment' => 'credit memo comment', 'notifyCustomer' => 1, 'includeComment' => 1));
+var_dump($result->result);
+ Allows you to cancel an existing credit memo.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +creditmemoIncrementId | +Credit memo increment ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +result | +Result of canceling the credit memo | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested credit memo does not exist. | +
| 104 | +Credit memo status not changed. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$creditmemoIncrementId = '100000637'; //increment id of existing credit memo
+
+$isCreditMemoCanceled = $proxy->call($sessionId, 'order_creditmemo.cancel', array($creditmemoIncrementId));
+ Allows you to create a new credit memo for the invoiced order. Comments can be added and an email notification can be sent to the user email.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +orderIncrementId | +Order increment ID | +
| array | +creditmemoData | +Array of salesOrderCreditmemoData (optional) | +
| string | +comment | +Comment text (optional) | +
| int | +notifyCustomer | +Notify customer by email flag (optional) | +
| int | +includeComment | +Include comment text into an email notification (optional) | +
| string | +refundToStoreCreditAmount | +Payment amount to be refunded to the customer store credit (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +result | +Created credit memo increment ID | +
The salesOrderCreditmemoData content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | + qtys |
+Array of orderItemIdQty | +
| double | + shipping_amount |
+ Refund shipping amount (optional) |
+
| double | + adjustment_positive |
+ Adjustment refund amount (optional) |
+
| double | + adjustment_negative |
+ Adjustment fee amount (optional) |
+
The orderItemIdQty content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + order_item_id |
+Order item ID to be refunded | +
| double | + qty |
+Items quantity to be refunded | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested order does not exist. | +
| 105 | +Money can not be refunded to the store credit account as order was created by guest. | +
| 106 | +Credit memo for requested order can not be created. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'order_creditmemo.create', '200000010');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCreditmemoCreate($sessionId, '200000010');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCreditmemoCreate((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000010',
+'creditmemoData' => array(
+'qtys' => array(
+'order_item_id' => 3,
+'qty' => '1'),
+'shipping_amount' => null,
+'adjustment_positive' => '0',
+'adjustment_negative' => null),
+'comment' => 'comment for credit memo',
+'notifyCustomer' => null,
+'includeComment' => 1,
+'refundToStoreCreditAmount' => '1'
+));
+var_dump($result->result);
+ Allows you to retrieve full information about the specified credit memo.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +creditmemoIncrementId | +Credit memo increment ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderCreditmemoEntity | +
The salesOrderCreditmemoEntity content is as follows:
+ + + +| Type | +Name | +Description | +
|---|---|---|
| string | +updated_at | +Date of updating | +
| string |
+ created_at |
+Date of creation | +
| string |
+ increment_id |
+Increment ID | +
| string |
+ transaction_id |
+Transaction ID | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ cybersource_token |
+Cybersource token | +
| string |
+ invoice_id |
+ID of the invoice for which the credit memo was created | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ state |
+State | +
| string |
+ creditmemo_status |
+Credit memo status | +
| string |
+ email_sent |
+Defines whether the email is sent | +
| string |
+ order_id |
+ID of the order for which the credit memo was created | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ shipping_tax_amount |
+Shipping tax amount | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_adjustment_positive |
+ Adjustment refund amount (using base currency) |
+
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ adjustment |
+Adjustment | +
| string |
+ subtotal |
+Subtotal | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_adjustment |
+Base adjustment | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ adjustment_negative |
+ Adjustment fee amount |
+
| string |
+ subtotal_incl_tax |
+Subtotal including tax | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ base_subtotal_incl_tax |
+Base subtotal including tax | +
| string |
+ base_adjustment_negative |
+ Adjustment fee amount (using base currency) |
+
| string |
+ grand_total |
+Grand total | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_shipping_tax_amount |
+Base shipping tax amount | +
| string |
+ adjustment_positive |
+ Adjustment refund amount |
+
| string |
+ store_id |
+Store ID | +
| string |
+ hidden_tax_amount |
+Hidden tax amount | +
| string |
+ base_hidden_tax_amount |
+Base hidden tax amount | +
| string |
+ shipping_hidden_tax_amount |
+Shipping hidden tax amount | +
| string |
+ base_shipping_hidden_tax_amnt |
+Base shipping hidden tax amount | +
| string |
+ shipping_incl_tax |
+Shipping including tax | +
| string |
+ base_shipping_incl_tax |
+Base shipping including tax | +
| string |
+ base_customer_balance_amount |
+Base customer balance amount | +
| string |
+ customer_balance_amount |
+Customer balance amount | +
| string |
+ bs_customer_bal_total_refunded |
+ Refunded base customer balance amount |
+
| string |
+ customer_bal_total_refunded |
+Customer balance total refunded | +
| string |
+ base_gift_cards_amount |
+Base gift cards amount | +
| string |
+ gift_cards_amount |
+Gift cards amount | +
| string |
+ gw_base_price |
+ Gift wrapping price refunded amount (using base currency) |
+
| string |
+ gw_price |
+ Gift wrapping price refunded amount |
+
| string |
+ gw_items_base_price |
+Gift wrapping items base price | +
| string |
+ gw_items_price |
+Gift wrapping items price | +
| string |
+ gw_card_base_price |
+Gift wrapping card base price | +
| string |
+ gw_card_price |
+Gift wrapping card price | +
| string |
+ gw_base_tax_amount |
+ Gift wrapping tax amount refunded (using base currency) |
+
| string |
+ gw_tax_amount |
+ Gift wrapping tax amount refunded |
+
| string |
+ gw_items_base_tax_amount |
+Gift wrapping items base tax amount | +
| string |
+ gw_items_tax_amount |
+Gift wrapping items tax amount | +
| string |
+ gw_card_base_tax_amount |
+Gift wrapping card base tax amount | +
| string |
+ gw_card_tax_amount |
+Gift wrapping card tax amount | +
| string |
+ base_reward_currency_amount |
+Base reward currency amount | +
| string |
+ reward_currency_amount |
+Reward currency amount | +
| string |
+ reward_points_balance |
+Reward points balance | +
| string |
+ reward_points_balance_refund |
+Reward points balance refund | +
| string |
+ creditmemo_id |
+Credit memo ID | +
| array | + items |
+Array of salesOrderCreditmemoItemEntity | +
| array | + comments |
+Array of salesOrderCreditmemoCommentEntity | +
The salesOrderCreditmemoItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +item_id | +Credit memo item ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ weee_tax_applied_row_amount |
+Applied fixed product tax row amount | +
| string |
+ base_price |
+Base price | +
| string |
+ base_weee_tax_row_disposition |
+Fixed product tax row disposition (in base currency) | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ base_weee_tax_applied_amount |
+ Applied fixed product tax amount (in base currency) |
+
| string |
+ weee_tax_row_disposition |
+ Fixed product tax row disposition |
+
| string |
+ base_row_total |
+Base row total | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ row_total |
+Row total | +
| string |
+ weee_tax_applied_amount |
+ Applied fixed product tax amount |
+
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_weee_tax_disposition |
+ Fixed product tax disposition (in base currency) |
+
| string |
+ price_incl_tax |
+Price including tax | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ weee_tax_disposition |
+ Fixed product tax disposition |
+
| string |
+ base_price_incl_tax |
+Base price including tax | +
| string |
+ qty |
+Quantity | +
| string |
+ base_cost |
+Base cost | +
| string |
+ base_weee_tax_applied_row_amount |
+ Applied fixed product tax row amount (in base currency) |
+
| string |
+ price |
+Price | +
| string |
+ base_row_total_incl_tax |
+Base row total including tax | +
| string |
+ row_total_incl_tax |
+Row total including tax | +
| string |
+ product_id |
+Product ID | +
| string |
+ order_item_id |
+Order item ID | +
| string |
+ additional_data |
+Additional data | +
| string |
+ description |
+Description | +
| string |
+ weee_tax_applied |
+ Applied fixed product tax |
+
| string |
+ sku |
+Item SKU | +
| string |
+ name |
+Name | +
| string |
+ hidden_tax_amount |
+Hidden tax amount | +
| string |
+ base_hidden_tax_amount |
+Base hidden tax amount | +
The salesOrderCreditmemoCommentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ comment |
+Comment data | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ comment_id |
+Comment ID | +
| string |
+ is_visible_on_front |
+Defines whether the comment is visible on the frontend | +
Faults:
+ +| Fault Code | +Fault Description | +
|---|---|
| 100 | +Requested credit memo does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'order_creditmemo.info', '200000001');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCreditmemoInfo($sessionId, '200000001');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCreditmemoInfo((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000001'));
+var_dump($result->result);
+ array(
+ 'store_id' => '1',
+ 'adjustment_positive' => NULL,
+ 'base_shipping_tax_amount' => '0.0000',
+ 'store_to_order_rate' => '1.0000',
+ 'base_discount_amount' => '0.0000',
+ 'base_to_order_rate' => '1.0000',
+ 'grand_total' => '90.0000',
+ 'base_adjustment_negative' => NULL,
+ 'base_subtotal_incl_tax' => '75.0000',
+ 'shipping_amount' => '15.0000',
+ 'subtotal_incl_tax' => '75.0000',
+ 'adjustment_negative' => NULL,
+ 'base_shipping_amount' => '15.0000',
+ 'store_to_base_rate' => '1.0000',
+ 'base_to_global_rate' => '1.0000',
+ 'base_adjustment' => '0.0000',
+ 'base_subtotal' => '75.0000',
+ 'discount_amount' => '0.0000',
+ 'subtotal' => '75.0000',
+ 'adjustment' => '0.0000',
+ 'base_grand_total' => '90.0000',
+ 'base_adjustment_positive' => NULL,
+ 'base_tax_amount' => '0.0000',
+ 'shipping_tax_amount' => '0.0000',
+ 'tax_amount' => '0.0000',
+ 'order_id' => '744',
+ 'email_sent' => NULL,
+ 'creditmemo_status' => NULL,
+ 'state' => '2',
+ 'shipping_address_id' => '1488',
+ 'billing_address_id' => '1487',
+ 'invoice_id' => NULL,
+ 'cybersource_token' => NULL,
+ 'store_currency_code' => 'USD',
+ 'order_currency_code' => 'USD',
+ 'base_currency_code' => 'USD',
+ 'global_currency_code' => 'USD',
+ 'transaction_id' => NULL,
+ 'increment_id' => '100000684',
+ 'created_at' => '2011-05-27 10:53:03',
+ 'updated_at' => '2011-05-27 10:53:03',
+ 'hidden_tax_amount' => '0.0000',
+ 'base_hidden_tax_amount' => '0.0000',
+ 'shipping_hidden_tax_amount' => NULL,
+ 'base_shipping_hidden_tax_amnt' => NULL,
+ 'shipping_incl_tax' => '15.0000',
+ 'base_shipping_incl_tax' => '15.0000',
+ 'base_customer_balance_amount' => NULL,
+ 'customer_balance_amount' => NULL,
+ 'bs_customer_bal_total_refunded' => '0.0000',
+ 'customer_bal_total_refunded' => '0.0000',
+ 'base_gift_cards_amount' => NULL,
+ 'gift_cards_amount' => NULL,
+ 'gw_base_price' => NULL,
+ 'gw_price' => NULL,
+ 'gw_items_base_price' => NULL,
+ 'gw_items_price' => NULL,
+ 'gw_card_base_price' => NULL,
+ 'gw_card_price' => NULL,
+ 'gw_base_tax_amount' => NULL,
+ 'gw_tax_amount' => NULL,
+ 'gw_items_base_tax_amount' => NULL,
+ 'gw_items_tax_amount' => NULL,
+ 'gw_card_base_tax_amount' => NULL,
+ 'gw_card_tax_amount' => NULL,
+ 'base_reward_currency_amount' => NULL,
+ 'reward_currency_amount' => NULL,
+ 'reward_points_balance' => NULL,
+ 'reward_points_balance_refund' => NULL,
+ 'base_customer_balance_total_refunded' => '0.0000',
+ 'customer_balance_total_refunded' => '0.0000',
+ 'gw_printed_card_base_price' => NULL,
+ 'gw_printed_card_price' => NULL,
+ 'gw_printed_card_base_tax_amount' => NULL,
+ 'gw_printed_card_tax_amount' => NULL,
+ 'reward_points_balance_to_refund' => NULL,
+ 'creditmemo_id' => '684',
+ 'order_increment_id' => '100000744',
+ 'items' => array(
+ 0 => array(
+ 'parent_id' => '684',
+ 'weee_tax_applied_row_amount' => '0.0000',
+ 'base_price' => '55.0000',
+ 'base_weee_tax_row_disposition' => '0.0000',
+ 'tax_amount' => '0.0000',
+ 'base_weee_tax_applied_amount' => '0.0000',
+ 'weee_tax_row_disposition' => '0.0000',
+ 'base_row_total' => '55.0000',
+ 'discount_amount' => NULL,
+ 'row_total' => '55.0000',
+ 'weee_tax_applied_amount' => '0.0000',
+ 'base_discount_amount' => NULL,
+ 'base_weee_tax_disposition' => '0.0000',
+ 'price_incl_tax' => '55.0000',
+ 'base_tax_amount' => '0.0000',
+ 'weee_tax_disposition' => '0.0000',
+ 'base_price_incl_tax' => '55.0000',
+ 'qty' => '1.0000',
+ 'base_cost' => NULL,
+ 'base_weee_tax_applied_row_amnt' => NULL,
+ 'price' => '55.0000',
+ 'base_row_total_incl_tax' => '55.0000',
+ 'row_total_incl_tax' => '55.0000',
+ 'product_id' => '20',
+ 'order_item_id' => '775',
+ 'additional_data' => NULL,
+ 'description' => NULL,
+ 'weee_tax_applied' => 'a:0:{}',
+ 'sku' => 'test_product_sku',
+ 'name' => 'Test Product',
+ 'hidden_tax_amount' => '0.0000',
+ 'base_hidden_tax_amount' => '0.0000',
+ 'item_id' => '708'
+ ),
+ 1 => array(
+ 'parent_id' => '684',
+ 'weee_tax_applied_row_amount' => '0.0000',
+ 'base_price' => '10.0000',
+ 'base_weee_tax_row_disposition' => '0.0000',
+ 'tax_amount' => '0.0000',
+ 'base_weee_tax_applied_amount' => '0.0000',
+ 'weee_tax_row_disposition' => '0.0000',
+ 'base_row_total' => '20.0000',
+ 'discount_amount' => NULL,
+ 'row_total' => '20.0000',
+ 'weee_tax_applied_amount' => '0.0000',
+ 'base_discount_amount' => NULL,
+ 'base_weee_tax_disposition' => '0.0000',
+ 'price_incl_tax' => '10.0000',
+ 'base_tax_amount' => '0.0000',
+ 'weee_tax_disposition' => '0.0000',
+ 'base_price_incl_tax' => '10.0000',
+ 'qty' => '2.0000',
+ 'base_cost' => NULL,
+ 'base_weee_tax_applied_row_amnt' => NULL,
+ 'price' => '10.0000',
+ 'base_row_total_incl_tax' => '20.0000',
+ 'row_total_incl_tax' => '20.0000',
+ 'product_id' => '21',
+ 'order_item_id' => '776',
+ 'additional_data' => NULL,
+ 'description' => NULL,
+ 'weee_tax_applied' => 'a:0:{}',
+ 'sku' => 'test_product_sku_2',
+ 'name' => 'Test 2',
+ 'hidden_tax_amount' => '0.0000',
+ 'base_hidden_tax_amount' => '0.0000',
+ 'item_id' => '709'
+ )
+ ),
+ 'comments' => array(
+ 0 => array(
+ 'parent_id' => '684',
+ 'is_customer_notified' => '0',
+ 'is_visible_on_front' => '0',
+ 'comment' => 'Test CreditMemo successfully created',
+ 'created_at' => '2011-05-27 10:53:03',
+ 'comment_id' => '118'
+ ),
+ 1 => array(
+ 'parent_id' => '684',
+ 'is_customer_notified' => '0',
+ 'is_visible_on_front' => '0',
+ 'comment' => 'Test CreditMemo comment successfully added',
+ 'created_at' => '2011-05-27 10:53:03',
+ 'comment_id' => '119'
+ )
+ )
+);
+ Allows you to retrieve the list of credit memos by filters.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| associative array | +filters | +Filters (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderCreditmemoEntity | +
The salesOrderCreditmemoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +updated_at | +Date of updating | +
| string |
+ created_at |
+Date of creation | +
| string |
+ increment_id |
+Increment ID | +
| string |
+ transaction_id |
+Transaction ID | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ cybersource_token |
+Cybersource token | +
| string |
+ invoice_id |
+ID of the invoice for which the credit memo was created | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ state |
+State | +
| string |
+ creditmemo_status |
+Credit memo status | +
| string |
+ email_sent |
+Defines whether the email is sent | +
| string |
+ order_id |
+ID of the order for which the credit memo was created | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ shipping_tax_amount |
+Shipping tax amount | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_adjustment_positive |
+ Adjustment refund amount (using base currency) |
+
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ adjustment |
+Adjustment | +
| string |
+ subtotal |
+Subtotal | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_adjustment |
+Base adjustment | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ adjustment_negative |
+ Adjustment fee amount |
+
| string |
+ subtotal_incl_tax |
+Subtotal including tax | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ base_subtotal_incl_tax |
+Base subtotal including tax | +
| string |
+ base_adjustment_negative |
+ Adjustment fee amount (using base currency) |
+
| string |
+ grand_total |
+Grand total | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_shipping_tax_amount |
+Base shipping tax amount | +
| string |
+ adjustment_positive |
+ Adjustment refund amount |
+
| string |
+ store_id |
+Store ID | +
| string |
+ hidden_tax_amount |
+Hidden tax amount | +
| string |
+ base_hidden_tax_amount |
+Base hidden tax amount | +
| string |
+ shipping_hidden_tax_amount |
+Shipping hidden tax amount | +
| string |
+ base_shipping_hidden_tax_amnt |
+Base shipping hidden tax amount | +
| string |
+ shipping_incl_tax |
+Shipping including tax | +
| string |
+ base_shipping_incl_tax |
+Base shipping including tax | +
| string |
+ base_customer_balance_amount |
+Base customer balance amount | +
| string |
+ customer_balance_amount |
+Customer balance amount | +
| string |
+ bs_customer_bal_total_refunded |
+ Refunded base customer balance amount |
+
| string |
+ customer_bal_total_refunded |
+Customer balance total refunded | +
| string |
+ base_gift_cards_amount |
+Base gift cards amount | +
| string |
+ gift_cards_amount |
+Gift cards amount | +
| string |
+ gw_base_price |
+ Gift wrapping price refunded amount (using base currency) |
+
| string |
+ gw_price |
+ Gift wrapping price refunded amount |
+
| string |
+ gw_items_base_price |
+Gift wrapping items base price | +
| string |
+ gw_items_price |
+Gift wrapping items price | +
| string |
+ gw_card_base_price |
+Gift wrapping card base price | +
| string |
+ gw_card_price |
+Gift wrapping card price | +
| string |
+ gw_base_tax_amount |
+ Gift wrapping tax amount refunded (using base currency) |
+
| string |
+ gw_tax_amount |
+ Gift wrapping tax amount refunded |
+
| string |
+ gw_items_base_tax_amount |
+Gift wrapping items base tax amount | +
| string |
+ gw_items_tax_amount |
+Gift wrapping items tax amount | +
| string |
+ gw_card_base_tax_amount |
+Gift wrapping card base tax amount | +
| string |
+ gw_card_tax_amount |
+Gift wrapping card tax amount | +
| string |
+ base_reward_currency_amount |
+Base reward currency amount | +
| string |
+ reward_currency_amount |
+Reward currency amount | +
| string |
+ reward_points_balance |
+Reward points balance | +
| string |
+ reward_points_balance_refund |
+Reward points balance refund | +
| string |
+ creditmemo_id |
+Credit memo ID | +
| array | + items |
+Array of salesOrderCreditmemoItemEntity | +
| array | + comments |
+Array of salesOrderCreditmemoCommentEntity | +
The salesOrderCreditmemoItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +item_id | +Credit memo item ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ weee_tax_applied_row_amount |
+ Applied fixed product tax row amount |
+
| string |
+ base_price |
+Base price | +
| string |
+ base_weee_tax_row_disposition |
+ Fixed product tax row disposition (in base currency) |
+
| string |
+ tax_amount |
+Tax amount | +
| string |
+ base_weee_tax_applied_amount |
+ Applied fixed product tax amount (in base currency) |
+
| string |
+ weee_tax_row_disposition |
+ Fixed product tax row disposition |
+
| string |
+ base_row_total |
+Base row total | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ row_total |
+Row total | +
| string |
+ weee_tax_applied_amount |
+ Applied fixed product tax amount |
+
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_weee_tax_disposition |
+ Fixed product tax disposition (in base currency) |
+
| string |
+ price_incl_tax |
+Price including tax | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ weee_tax_disposition |
+ Fixed product tax disposition |
+
| string |
+ base_price_incl_tax |
+Base price including tax | +
| string |
+ qty |
+Quantity | +
| string |
+ base_cost |
+Base cost | +
| string |
+ base_weee_tax_applied_row_amount |
+ Applied fixed product tax row amount (in base currency) |
+
| string |
+ price |
+Price | +
| string |
+ base_row_total_incl_tax |
+Base row total including tax | +
| string |
+ row_total_incl_tax |
+Row total including tax | +
| string |
+ product_id |
+Product ID | +
| string |
+ order_item_id |
+Order item ID | +
| string |
+ additional_data |
+Additional data | +
| string |
+ description |
+Description | +
| string |
+ weee_tax_applied |
+ Applied fixed product tax |
+
| string |
+ sku |
+Item SKU | +
| string |
+ name |
+Name | +
| string |
+ hidden_tax_amount |
+Hidden tax amount | +
| string |
+ base_hidden_tax_amount |
+Base hidden tax amount | +
The salesOrderCreditmemoCommentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ comment |
+Comment data | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ comment_id |
+Comment ID | +
| string |
+ is_visible_on_front |
+Defines whether the comment is visible on the frontend | +
Faults:
+ +| Fault Code | +Fault Description | +
|---|---|
| 101 | +Invalid filter given. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$filter = array(
+ 'order_id' => array(
+ 'or' => array(
+ array(
+ 'from' => '673',
+ 'to' => '674',
+ ),
+ array(
+ 'from' => '677',
+ 'to' => NULL,
+ )
+ )
+ ),
+ 'increment_id' => array(
+ 'or' => array(
+ array(
+ 'from' => '100000617',
+ 'to' => '100000619',
+ ),
+ array(
+ 'from' => '100000619',
+ 'to' => NULL,
+ )
+ )
+ )
+);
+$creditmemoList = $proxy->call($sessionId, 'order_creditmemo.list', array($filter));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCreditmemoList($sessionId, '200000001');
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'state',
+ 'value' => array('key' => 'in', 'value' => '2,3')
+ )
+ )
+);
+$result = $client->salesOrderCreditmemoList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCreditmemoList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array( + 0 => array( + 'store_id' => '1', + 'adjustment_positive' => NULL, + 'base_shipping_tax_amount' => '0.0000', + 'store_to_order_rate' => '1.0000', + 'base_discount_amount' => '0.0000', + 'base_to_order_rate' => '1.0000', + 'grand_total' => '60.0000', + 'base_adjustment_negative' => NULL, + 'base_subtotal_incl_tax' => '55.0000', + 'shipping_amount' => '5.0000', + 'subtotal_incl_tax' => '55.0000', + 'adjustment_negative' => NULL, + 'base_shipping_amount' => '5.0000', + 'store_to_base_rate' => '1.0000', + 'base_to_global_rate' => '1.0000', + 'base_adjustment' => '0.0000', + 'base_subtotal' => '55.0000', + 'discount_amount' => '0.0000', + 'subtotal' => '55.0000', + 'adjustment' => '0.0000', + 'base_grand_total' => '60.0000', + 'base_adjustment_positive' => NULL, + 'base_tax_amount' => '0.0000', + 'shipping_tax_amount' => '0.0000', + 'tax_amount' => '0.0000', + 'order_id' => '674', + 'email_sent' => NULL, + 'creditmemo_status' => NULL, + 'state' => '2', + 'shipping_address_id' => '1348', + 'billing_address_id' => '1347', + 'invoice_id' => NULL, + 'cybersource_token' => NULL, + 'store_currency_code' => 'USD', + 'order_currency_code' => 'USD', + 'base_currency_code' => 'USD', + 'global_currency_code' => 'USD', + 'transaction_id' => NULL, + 'increment_id' => '100000617', + 'created_at' => '2011-05-26 10:49:45', + 'updated_at' => '2011-05-26 10:49:45', + 'hidden_tax_amount' => '0.0000', + 'base_hidden_tax_amount' => '0.0000', + 'shipping_hidden_tax_amount' => NULL, + 'base_shipping_hidden_tax_amnt' => NULL, + 'shipping_incl_tax' => '5.0000', + 'base_shipping_incl_tax' => '5.0000', + 'base_customer_balance_amount' => NULL, + 'customer_balance_amount' => NULL, + 'bs_customer_bal_total_refunded' => '0.0000', + 'customer_bal_total_refunded' => '0.0000', + 'base_gift_cards_amount' => NULL, + 'gift_cards_amount' => NULL, + 'gw_base_price' => NULL, + 'gw_price' => NULL, + 'gw_items_base_price' => NULL, + 'gw_items_price' => NULL, + 'gw_card_base_price' => NULL, + 'gw_card_price' => NULL, + 'gw_base_tax_amount' => NULL, + 'gw_tax_amount' => NULL, + 'gw_items_base_tax_amount' => NULL, + 'gw_items_tax_amount' => NULL, + 'gw_card_base_tax_amount' => NULL, + 'gw_card_tax_amount' => NULL, + 'base_reward_currency_amount' => NULL, + 'reward_currency_amount' => NULL, + 'reward_points_balance' => NULL, + 'reward_points_balance_refund' => NULL, + 'creditmemo_id' => '617', + ), + 1 => array( + 'store_id' => '1', + 'adjustment_positive' => NULL, + ....................................... + 'creditmemo_id' => '620', + ) +);+
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
+ +Allows you to manage invoices.
+ +Resource Name: sales_order_invoice
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested shipment does not exists. | +
| 101 | +Invalid filters given. Details in error message. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested order does not exists | +
| 104 | +Invoice status not changed. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$notInvoicedOrderId = '100000003';
+
+// Create new invoice
+$newInvoiceId = $proxy->call($sessionId, 'sales_order_invoice.create', array($notInvoicedOrderId, array(), 'Invoice Created', true, true));
+
+// View new invoice
+$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
+
+var_dump($invoice);
+
+// Add Comment
+$proxy->call($sessionId, 'sales_order_invoice.addComment', array($newInvoiceId, 'Invoice comment, some text', true, false));
+
+// View invoice with new comment
+$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
+
+var_dump($invoice);
+
+$proxy->call($sessionId, 'sales_order_invoice.capture', $newInvoiceId);
+
+// View captured invoice
+$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
+var_dump($invoice);
+ Aliases:
+Allows you to add a new comment to the order invoice.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ invoiceIncrementId |
+Invoice increment ID | +
| string |
+ comment |
+Invoice comment (optional) | +
| int |
+ email |
+Send invoice on email flag (optional) | +
| int |
+ includeComment |
+Include comment in email flag (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the comment is added to the invoice | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apikey');
+
+$result = $client->call($session, 'sales_order_invoice.addComment', array('invoiceIncrementId' => '200000006', 'comment' => 'invoice comment'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderInvoiceAddComment($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceAddComment((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '200000006', 'comment' => 'invoice comment', 'email' => null, 'includeComment' => null));
+var_dump($result->result);
+ Aliases:
+Allows you to cancel the required invoice. Note that not all order invoices can be canceled. Only some payment methods support canceling the order invoice (e.g., Google Checkout, PayPal Pro, PayPal Express Checkout).
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + invoiceIncrementId |
+Invoice increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the order invoice is canceled. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$invoiceIncrementId = '100000013';
+
+$result = $proxy->call(
+ $session,
+ 'sales_order_invoice.cancel',
+ $invoiceIncrementId
+);
+ Aliases:
+Allows you to capture the required invoice. Note that not all order invoices can be captured. Only some payment methods support capturing the order invoice (e.g., PayPal Pro).
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + invoiceIncrementId |
+Invoice increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the order invoice is captured. | +
Notes:
+ +You should check the invoice to see if it can be captured before attempting to capture the invoice. Otherwise, the API call will generate an error.
+ +Invoices have states as defined in the model Mage_Sales_Model_Order_Invoice:
+Also note that there is a method call in the model that checks this for you - canCapture(). And it also verifies that the payment can be captured, so the invoice state might not be the only condition that is required to allow it to be captured.
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$orderIncrementId = '100000016';
+
+//Create invoice for order
+$invoiceIncrementId = $proxy->call(
+ $session,
+ 'sales_order_invoice.create',
+ array(
+ 'orderIncrementId' => $orderIncrementId,
+ array('order_item_id' => '15', 'qty' => '1')
+ )
+);
+
+//Capture invoice amount
+$result = $proxy->call(
+ $session,
+ 'sales_order_invoice.capture',
+ $invoiceIncrementId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionID = $proxy->login('apiUser', 'apiKey');
+
+$orderIncrementId = '100000016';
+
+//Create invoice for order
+$qty = array(
+Â Â Â array('order_item_id' => '15', 'qty' => '1')
+);
+$invoiceIncrementId = $proxy->salesOrderInvoiceCreate(
+ $sessionID,
+ $orderIncrementId,
+ Â $qty);
+
+//Capture invoice amount
+$result = $proxy->salesOrderInvoiceCapture(
+ $sessionID,
+ $invoiceIncrementId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceCapture((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '100000016'));
+
+var_dump($result->result);
+ Aliases:
+Allows you to create a new invoice for an order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ invoiceIncrementId |
+Order increment ID | +
| array | + itemsQty |
+Array of orderItemIdQty (quantity of items to invoice) | +
| string |
+ comment |
+Invoice comment (optional) | +
| string |
+ email |
+Send invoice on email (optional) | +
| string |
+ includeComment |
+Include comments in email (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| string | +ID of the created invoice | +
The orderItemIdQty content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + order_item_id |
+Order item ID | +
| double | + qty |
+Quantity | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call(
+ $session,
+ 'sales_order_invoice.create',
+ array('orderIncrementId' => '200000008', array('15' => '1', '16' => '1'))
+ // orderItemIdQty Array is Keyed with Order Item ID, with Value of qty to invoice
+);
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+//Create invoice for order
+
+// orderItemIdQty Array is Keyed with Order Item ID, with Value of qty to invoice
+$qty = array('15' => '1', '16' => '1');
+
+$invoiceIncrementId = $proxy->salesOrderInvoiceCreate(
+ $sessionID,
+ '200000008',
+ Â $qty
+);
+var_dump($invoiceIncrementId);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceCreate((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000008', 'itemsQty' => array('15' => '1', '16' => '1'), 'comment' => null,
+'email' => null,
+'includeComment' => null
+));
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve information about the required invoice.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +invoiceIncrementId | +Invoice increment ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | + Array of salesOrderInvoiceEntity |
+
The salesOrderInvoiceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Defines whether the invoice is active | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ subtotal |
+Subtotal | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ billing_firstname |
+First name in the billing address | +
| string |
+ billing_lastname |
+Last name in the billing address | +
| string |
+ order_id |
+Order ID | +
| string |
+ order_increment_id |
+Order increment ID | +
| string |
+ order_created_at |
+Date of order creation | +
| string |
+ state |
+Order state | +
| string |
+ grand_total |
+Grand total | +
| string |
+ invoice_id |
+Invoice ID | +
| array | + items |
+Array of salesOrderInvoiceItemEntity | +
| array | + comments |
+Array of salesOrderInvoiceCommentEntity | +
The salesOrderInvoiceItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Active flag | +
| string |
+ weee_tax_applied |
+Applied fixed product tax | +
| string |
+ qty |
+Quantity | +
| string |
+ cost |
+Cost | +
| string |
+ price |
+Price | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ row_total |
+Row total | +
| string |
+ base_price |
+Base price | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_row_total |
+Base row total | +
| string |
+ base_weee_tax_applied_amount |
+Applied fixed product tax amount (in base currency) | +
| string |
+ base_weee_tax_applied_row_amount |
+Applied fixed product tax row amount (in base currency) | +
| string |
+ weee_tax_applied_amount |
+Applied fixed product tax amount | +
| string |
+ weee_tax_applied_row_amount |
+Applied fixed product tax row amount | +
| string |
+ weee_tax_disposition |
+Fixed product tax disposition | +
| string |
+ weee_tax_row_disposition |
+Fixed product tax row disposition | +
| string |
+ base_weee_tax_disposition |
+Fixed product tax disposition (in base currency) | +
| string |
+ base_weee_tax_row_disposition |
+Fixed product tax row disposition (in base currency) | +
| string |
+ sku |
+SKU | +
| string |
+ name |
+Name | +
| string |
+ order_item_id |
+Order item ID | +
| string |
+ product_id |
+Product ID | +
| string |
+ item_id |
+Item ID | +
The salesOrderInvoiceCommentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Active flag | +
| string |
+ comment |
+Invoice comment | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ comment_id |
+Comment ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_invoice.info', '200000006');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderInvoiceInfo($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceInfo((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '200000006'));
+var_dump($result->result);
+ array
+ 'store_id' => string '2' (length=1)
+ 'base_grand_total' => string '384.9800' (length=8)
+ 'shipping_tax_amount' => string '0.0000' (length=6)
+ 'tax_amount' => string '0.0000' (length=6)
+ 'base_tax_amount' => string '0.0000' (length=6)
+ 'store_to_order_rate' => string '1.0000' (length=6)
+ 'base_shipping_tax_amount' => string '0.0000' (length=6)
+ 'base_discount_amount' => string '0.0000' (length=6)
+ 'base_to_order_rate' => string '1.0000' (length=6)
+ 'grand_total' => string '384.9800' (length=8)
+ 'shipping_amount' => string '5.0000' (length=6)
+ 'subtotal_incl_tax' => string '379.9800' (length=8)
+ 'base_subtotal_incl_tax' => string '379.9800' (length=8)
+ 'store_to_base_rate' => string '1.0000' (length=6)
+ 'base_shipping_amount' => string '5.0000' (length=6)
+ 'total_qty' => string '1.0000' (length=6)
+ 'base_to_global_rate' => string '1.0000' (length=6)
+ 'subtotal' => string '379.9800' (length=8)
+ 'base_subtotal' => string '379.9800' (length=8)
+ 'discount_amount' => string '0.0000' (length=6)
+ 'billing_address_id' => string '3' (length=1)
+ 'is_used_for_refund' => null
+ 'order_id' => string '2' (length=1)
+ 'email_sent' => null
+ 'can_void_flag' => string '0' (length=1)
+ 'state' => string '2' (length=1)
+ 'shipping_address_id' => string '4' (length=1)
+ 'store_currency_code' => string 'USD' (length=3)
+ 'transaction_id' => null
+ 'order_currency_code' => string 'USD' (length=3)
+ 'base_currency_code' => string 'USD' (length=3)
+ 'global_currency_code' => string 'USD' (length=3)
+ 'increment_id' => string '200000006' (length=9)
+ 'created_at' => string '2012-03-30 12:02:19' (length=19)
+ 'updated_at' => string '2012-03-30 12:02:19' (length=19)
+ 'hidden_tax_amount' => string '0.0000' (length=6)
+ 'base_hidden_tax_amount' => string '0.0000' (length=6)
+ 'shipping_hidden_tax_amount' => string '0.0000' (length=6)
+ 'base_shipping_hidden_tax_amnt' => null
+ 'shipping_incl_tax' => string '5.0000' (length=6)
+ 'base_shipping_incl_tax' => string '5.0000' (length=6)
+ 'base_total_refunded' => null
+ 'cybersource_token' => null
+ 'invoice_id' => string '1' (length=1)
+ 'order_increment_id' => string '200000002' (length=9)
+ 'items' =>
+ array
+ 0 =>
+ array
+ 'parent_id' => string '1' (length=1)
+ 'base_price' => string '379.9800' (length=8)
+ 'tax_amount' => string '0.0000' (length=6)
+ 'base_row_total' => string '379.9800' (length=8)
+ 'discount_amount' => null
+ 'row_total' => string '379.9800' (length=8)
+ 'base_discount_amount' => null
+ 'price_incl_tax' => string '379.9800' (length=8)
+ 'base_tax_amount' => string '0.0000' (length=6)
+ 'base_price_incl_tax' => string '379.9800' (length=8)
+ 'qty' => string '1.0000' (length=6)
+ 'base_cost' => null
+ 'price' => string '379.9800' (length=8)
+ 'base_row_total_incl_tax' => string '379.9800' (length=8)
+ 'row_total_incl_tax' => string '379.9800' (length=8)
+ 'product_id' => string '1' (length=1)
+ 'order_item_id' => string '3' (length=1)
+ 'additional_data' => null
+ 'description' => null
+ 'sku' => string 'n2610-slider' (length=12)
+ 'name' => string 'Nokia 2610 Phone' (length=16)
+ 'hidden_tax_amount' => string '0.0000' (length=6)
+ 'base_hidden_tax_amount' => string '0.0000' (length=6)
+ 'base_weee_tax_applied_amount' => string '0.0000' (length=6)
+ 'base_weee_tax_applied_row_amnt' => string '0.0000' (length=6)
+ 'base_weee_tax_applied_row_amount' => string '0.0000' (length=6)
+ 'weee_tax_applied_amount' => string '0.0000' (length=6)
+ 'weee_tax_applied_row_amount' => string '0.0000' (length=6)
+ 'weee_tax_applied' => string 'a:0:{}' (length=6)
+ 'weee_tax_disposition' => string '0.0000' (length=6)
+ 'weee_tax_row_disposition' => string '0.0000' (length=6)
+ 'base_weee_tax_disposition' => string '0.0000' (length=6)
+ 'base_weee_tax_row_disposition' => string '0.0000' (length=6)
+ 'item_id' => string '1' (length=1)
+ 'comments' =>
+ array
+ empty
+ Aliases:
+Allows you to retrieve the list of order invoices. Additional filters can also be applied.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| array | + filters |
+Array of filters for the list of invoices (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderInvoiceEntity | +
The salesOrderInvoiceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ created_at |
+Date of invoice creation | +
| string |
+ order_currency_code |
+Order currency code (e.g., EUR) | +
| string |
+ order_id |
+Order ID | +
| string |
+ state |
+Order state | +
| string |
+ grand_total |
+Grand total amount invoiced | +
| string |
+ invoice_id |
+Invoice ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_invoice.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderInvoiceList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'state',
+ 'value' => array('key' => 'in', 'value' => '2,3')
+ )
+ )
+);
+$result = $client->salesOrderInvoiceList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'order_id' => string '2' (length=1) + 'increment_id' => string '200000001' (length=9) + 'created_at' => string '2012-03-30 12:02:19' (length=19) + 'state' => string '2' (length=1) + 'grand_total' => string '384.9800' (length=8) + 'order_currency_code' => string 'USD' (length=3) + 'invoice_id' => null + 1 => + array + 'order_id' => string '3' (length=1) + 'increment_id' => string '200000002' (length=9) + 'created_at' => string '2012-03-30 12:06:20' (length=19) + 'state' => string '2' (length=1) + 'grand_total' => string '339.9900' (length=8) + 'order_currency_code' => string 'USD' (length=3) + 'invoice_id' => null+
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
+ +Allows you to manage shipments and tracking numbers.
+ +Resource Name: sales_order_shipment
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested shipment not exists. | +
| 101 | +Invalid filters given. Details in error message. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested order not exists. | +
| 104 | +Requested tracking not exists. | +
| 105 | +Tracking not deleted. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$notShipedOrderId = '100000003';
+
+// Create new shipment
+$newShipmentId = $proxy->call($sessionId, 'sales_order_shipment.create', array($notShipedOrderId, array(), 'Shipment Created', true, true));
+
+// View new shipment
+$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);
+
+var_dump($shipment);
+
+
+// Get allowed carriers for shipping
+$allowedCarriers = $proxy->call($sessionId, 'sales_order_shipment.getCarriers', $notShipedOrderId);
+
+end($allowedCarriers);
+
+$choosenCarrier = key($allowedCarriers);
+
+var_dump($allowedCarriers);
+var_dump($choosenCarrier);
+
+// Add tracking
+$newTrackId = $proxy->call($sessionId, 'sales_order_shipment.addTrack', array($newShipmentId, $choosenCarrier, 'My Track', rand(5000, 9000)));
+
+$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);
+
+var_dump($shipment);
+ Aliases:
+Allows you to add a new comment to the order shipment.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ shipmentIncrementId |
+Shipment increment ID | +
| string |
+ comment |
+Shipment comment (optional) | +
| string |
+ email |
+Send email flag (optional) | +
| string |
+ includeInEmail |
+Include comment in email flag (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the comment is added to the order shipment | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.addComment', array('shipmentIncrementId' => '200000002', 'comment' => 'comment for the shipment', 'email' => null));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentAddComment($sessionId, '200000002');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentAddComment((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'comment' => 'comment for the shipment', 'email' => null, 'includeInEmail' => null));
+var_dump($result->result);
+ Aliases:
+Allows you to add a new tracking number to the order shipment.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ shipmentIncrementId |
+Shipment increment ID | +
| string |
+ carrier |
+Carrier code (ups, usps, dhl, fedex, or dhlint) | +
| string |
+ title |
+Tracking title | +
| string |
+ trackNumber |
+Tracking number | +
Returns:
+ +| Type | +Description | +
|---|---|
| int | +Tracking number ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.addTrack', array('shipmentIncrementId' => '200000002', 'carrier' => 'ups', 'title' => 'tracking title', 'trackNumber' => '123123'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentAddTrack($sessionId, '200000002', 'ups', 'tracking title', '123123');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentAddTrack((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'carrier' => 'ups', 'title' => 'tracking title', 'trackNumber' => '123123'));
+var_dump($result->result);
+ Aliases:
+Allows you to create a new shipment for an order.
+ + +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
| array | + itemsQty |
+Array of orderItemIdQty (optional) | +
| string | + comment |
+Shipment comment (optional) | +
| int | + email |
+Send email flag (optional) | +
| int | + includeComment |
+Include comment in email flag (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + shipmentIncrementId |
+Shipment increment ID | +
The orderItemIdQty content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + order_item_id |
+Order item ID | +
| double | + qty |
+Quantity of items to be shipped | +
Notes: The array of orderItemQty is used for partial shipment. To create shipment for all order items, you do not need to specify these attributes.
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+$session = $proxy->login('apiUser', 'apiKey');
+
+$orderIncrementId = '200000006';
+$orderItemId = 3;
+$qty = 5;
+$itemsQty = array(
+ $orderItemId => $qty,
+ );
+
+$result = $proxy->call(
+ $session,
+ 'order_shipment.create',
+ array(
+ $orderIncrementId,
+ $itemsQty
+ )
+);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$itemsQty = array(
+ array(
+ 'order_item_id' => 3,
+ 'qty' => 3
+ ),
+ array(
+ 'order_item_id' => 4,
+ 'qty' => 5
+ ));
+
+$result = $proxy->salesOrderShipmentCreate($sessionId, '200000006', $itemsQty, 'shipment comment');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$itemsQty = array(
+ array(
+ 'order_item_id' => 3,
+ 'qty' => 3
+ ),
+ array(
+ 'order_item_id' => 4,
+ 'qty' => 5
+ ));
+
+$result = $proxy->salesOrderShipmentCreate((object)array(
+ 'sessionId' => $sessionId->result,
+ 'orderIncrementId' => '200000006',
+ 'itemsQty' => $itemsQty,
+ 'comment' => 'shipment comment',
+ 'email' => null, 'includeComment' => null));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of allowed carriers for an order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| associativeArray | +result | +Array of carriers | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.getCarriers', '200000010');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentGetCarriers($sessionId, '200000010');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentGetCarriers((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000010'));
+var_dump($result->result);
+ array + 'custom' => string 'Custom Value' (length=12) + 'dhl' => string 'DHL (Deprecated)' (length=16) + 'fedex' => string 'Federal Express' (length=15) + 'ups' => string 'United Parcel Service' (length=21) + 'usps' => string 'United States Postal Service' (length=28) + 'dhlint' => string 'DHL' (length=3)+
Aliases:
+Allows you to retrieve the shipment information.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + shipmentIncrementId |
+Order shipment increment ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderShipmentEntity | +
The salesOrderShipmentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Shipment increment ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ created_at |
+Date of shipment creation | +
| string |
+ updated_at |
+Date of shipment updating | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ order_id |
+Order ID | +
| string |
+ total_qty |
+Total quantity of items to ship | +
| string |
+ shipment_id |
+Shipment ID | +
| array | + items |
+Array of salesOrderShipmentItemEntity | +
| array | + tracks |
+Array of salesOrderShipmentTrackEntity | +
| array | + comments |
+Array of salesOrderShipmentCommentEntity | +
The salesOrderShipmentItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ parent_id |
+Parent ID | +
| string |
+ sku |
+Shipment item SKU | +
| string |
+ name |
+Shipment item name | +
| string |
+ order_item_id |
+Order item ID | +
| string |
+ product_id |
+Product ID | +
| string |
+ weight |
+Weight | +
| string |
+ price |
+Price | +
| string |
+ qty |
+Quantity of items | +
| string |
+ item_id |
+Item ID | +
The salesOrderShipmentTrackEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of tracking number creation | +
| string |
+ updated_at |
+Date of tracking number updating | +
| string |
+ carrier_code |
+Carrier code | +
| string |
+ title |
+Track title | +
| string |
+ number |
+Tracking number | +
| string |
+ order_id |
+Order ID | +
| string |
+ track_id |
+Track ID | +
The salesOrderShipmentCommentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of comment creation | +
| string |
+ comment |
+Shipment comment text | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ comment_id |
+Comment ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session, 'sales_order_shipment.info', '200000003');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentInfo($sessionId, '200000003');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentInfo((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000003'));
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of order shipments. Additional filters can be applied.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| array | + filters |
+Array of filters for the list of shipments | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderShipmentEntity | +
The salesOrderShipmentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ created_at |
+Date of shipment creation | +
| string |
+ total_qty |
+Total quantity of items to ship | +
| string |
+ shipment_id |
+Shipment ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'created_at',
+ 'value' => array('key' => 'in', 'value' => '2012-03-30 12:54:46')
+ )
+ )
+);
+$result = $client->salesOrderShipmentList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'increment_id' => string '200000001' (length=9) + 'created_at' => string '2012-03-30 12:35:29' (length=19) + 'total_qty' => string '2.0000' (length=6) + 'shipment_id' => null + 1 => + array + 'increment_id' => string '200000002' (length=9) + 'created_at' => string '2012-03-30 12:54:46' (length=19) + 'total_qty' => string '1.0000' (length=6) + 'shipment_id' => null+
Aliases:
+Allows you to remove a tracking number from the order shipment.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + shipmentIncrementId |
+Shipment increment ID | +
| string | + trackId |
+Track ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the tracking number is removed from the shipment | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.removeTrack', array('shipmentIncrementId' => '200000002', 'trackId' => '2'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentRemoveTrack($sessionId, '200000002', '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentRemoveTrack((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'trackId' => '2'));
+var_dump($result->result);
+ Magento provides you with the ability to use two modes for SOAP API V2. These are with WS-I compliance mode enabled and WS-I compliance mode disabled. The first one was introduced to make the system flexible, namely, to increase compatibility with .NET and Java programming languages.
+ +To enable/disable the WS-I compliance mode, perform the following steps:
+
The WS-I compliant mode uses the same WSDL endpoint as SOAP API V2 does. The key difference is that XML namespaces are used in WS-I compliance mode.
+
WSDL file with disabled WS-I compliance mode:
+
WSDL file with enabled WS-I compliance mode:
+
+{% include v1x/eol_message.html %}
+
+Welcome to the documentation home page for the Magento Enterprise Edition (EE) 1.13 and Community Edition (CE) 1.8 releases! Let's start out by telling you a little bit about them.
+Magento recognizes that merchants and systems integrators require higher performance in key areas—such as product search, product browsing, and checkout. Merchants and integrators are now commonly coming to Magento with:
+To address these ever-growing needs, Magento systematically examined performance and scalability characteristics. Our engineers continually measured performance on a range of environments and use cases to identify and remove bottlenecks, and then conducted extensive testing to confirm improvements.
+We characterized performance based on variations in deployment and business configurations to ensure improvement for a range of merchant sizes and configurations.
+In this release, we focused primarily on improvements to indexing, tax calculations, caching, and checkout performance.
+We're excited about the changes you'll find, including:
+
+{% include v1x/eol_message.html %}
+The focus of the Magento Enterprise Edition 1.13 release is performance and scalability. The benchmarking results + presented here demonstrate that we have addressed the following concerns:
+ +We identified the following areas for enhancement in Magento Enterprise Edition 1.13:
+ +Magento Enterprise Edition 1.13 delivers the following improvements over Magento Enterprise Edition 1.12:
+ +Before we introduce you to the benchmarks, an overview of our multi-node benchmarking facility is in order. We + started with a basic multi-node cluster with load balancer and caching and separate DB node, and installed + Apache. This is a familiar hardware configuration for the Magento developer community. Once provisioned, we + installed both Magento Enterprise Edition 1.13 and Magento Enterprise Edition 1.12 on the cluster to compare + their performance.
+ +This is a representation of the multi-node Magento Enterprise Edition 1.12/1.13 installation used for performance + testing. It consists of four physical nodes, three of which are virtualized.
+ +
+ We used HP ProLiant SL230s Gen8 servers with 8x16GB DDR3 and 2x Intel Xeon E5â€2660 CPUs for our benchmarking.
+ +We used a physical disk of a usable 1.2 TB managed by a RAID10 controller. The load balancer we used is + nginx.
+ +The cluster resides in our Las Vegas data center, connected to the Internet via a gigabit connection. We tested + the cluster using the popular Gatling suite from our engineering offices in Austin, TX.
+ +
+ This section presents the merchant scenarios we simulated for our testing. These scenarios are based on + real-world experience and industry standards with respect to shopper flows and catalog sizes.
+ +We used real-world, established eCommerce metrics to simulate shopper flows.
+ +
+ The catalogs we simulated also reflect real-world, established eCommerce experience.
+ +
+ The simulated merchant profile we benchmarked against represents the profile of our enterprise customers. We + established these metrics based on the day-to-day experience of large merchants operating a successful eCommerce + business. Again, we used what we consider to be a typical hardware and software configuration.
+ +These benchmarks were generated during extensive testing of our multi-node configuration running Magento + Enterprise Edition 1.13 described above. Our configuration was modeled after what a commercial hosting partner + would put into production, and the results reflect accurate gains over Magento Enterprise Edition 1.12.
+ +The duration of the test sessions is 72 seconds, which significantly stresses the multi-node configuration.
+ +In Magento Enterprise Edition 1.12, any change to a product would result in a full re-index. Magento Enterprise + Edition 1.13 introduces a new feature--incremental re-indexing. With incremental re-indexing, only those items + that were changed or added will be re-indexed, reducing the processing time to a fraction of what was required + before.
+ +Take the example of a merchant with a catalog containing 500,000 products. In Magento Enterprise Edition 1.12, + any change to a product would result in a full re-index operation. In Magento Enterprise Edition 1.13, + incremental re-indexing means the merchant will only re-index items that were changed. The test focused on + measuring the improvements provided by the incremental re-indexing feature in Magento Enterprise Edition 1.13. + The table below compares improvements to common admin actions, such as changing a product description, prices or + inventory.
+ +
+ As part of the benchmarking effort, we also measured the improvements in the full re-indexing feature on Magento + Enterprise Edition 1.13, where indexing a 500,000-item catalog was 53% faster than Magento Enterprise Edition + 1.12. Faster re-indexing means less load on the system and that changes to the catalog propagate faster to the + storefront.
+ +
+ The Magento Enterprise Edition 1.13 indexer component contains a number of individual indexers such as Product + Flat Data and Product Price. When a Magento admin changes the price of a product, it is only necessary to + execute the Product Price indexer for pricing changes to propagate to the frontend. The completion times of + these individual indexers were measured in the benchmark environment for Magento Enterprise Edition 1.13 and + Magento Enterprise Edition 1.12.
+ +This section presents the results for full re-index completion times for the individual indexers in Magento + Enterprise Edition 1.13 compared to Magento Enterprise Edition 1.12.
+ +
+ When Magento Enterprise Edition 1.12 and Magento Enterprise Edition 1.13 were compared, with both running on our + multi-node benchmarking configuration, Magento Enterprise Edition 1.13 loaded pages 65% faster than Magento + Enterprise Edition 1.12.
+ +Guest checkout and registered user checkout are two flows that are crucial to storefront operation. This section + presents the results of page load time measurements for these two flows.
+ +In the guest checkout flow pages, Magento Enterprise Edition 1.13 provides a substantial decrease in load times + over its predecessor, most of the time more than twice as fast.
+ +
+ The bar chart below presents the improvements in page load times for registered checkout flow.
+ +
+ In addition to page load times, the benchmark also focused on measuring throughput improvements, particularly + page views per day and orders per day.
+ +During our testing, which simulated a storefront running at peak hours, EE 1.13 executed 33% more orders and 31% + more page views than Magento Enterprise Edition 1.12 on the multi-node benchmarking configuration. Notably, + Magento Enterprise Edition 1.13 served 47K pages during the test run (10 minutes).
+ +
+ What we noted during the benchmarking tests:
+ +Magento Enterprise Edition 1.13 was engineered for performance--and clearly delivers on the goal as measured by + important metrics.
+ +In addition, we have focused on providing these benefits without the need to upgrade existing hardware, improving + your return on assets and investment.
+ +| Concurrent session (users) | +1000 | +
| Peak load duration | +10 minutes | +
| Session duration | +72 seconds | +
| CPU utilization | +95% | +
| + | ||||||||||||
| Magento EE v1.13 | ++ | + | + | + | + | + | + | + | + | + | + | + |
| Requests | ++ | Total | +OK | +KO | ++ | Min | +Max | +Mean | +Std Dev | +95th Pct | +99th Pct | +Req/s | +
| Global Information0 | ++ | 62161 | +62087 | +74 | ++ | 80 | +12910 | +1735 | +1869 | +5780 | +8060 | +75 | +
| product page0 | ++ | 28573 | +28573 | +0 | ++ | 80 | +9390 | +709 | +996 | +2670 | +4920 | +34 | +
| Click add to cart1 | ++ | 10458 | +10458 | +0 | ++ | 440 | +7170 | +1868 | +1139 | +4010 | +4980 | +13 | +
| Click add to cart Redirect 12 | ++ | 10458 | +10458 | +0 | ++ | 960 | +12910 | +3816 | +2239 | +8050 | +9960 | +13 | +
| click checkout3 | ++ | 3486 | +3486 | +0 | ++ | 1100 | +10800 | +3459 | +1965 | +7130 | +8970 | +4 | +
| Registered Checkout:Login and Pick Address4 | ++ | 3366 | +3366 | +0 | ++ | 200 | +7380 | +1155 | +1482 | +4870 | +5900 | +4 | +
| Registered Checkout:Login and Pick Address Redirect 15 | ++ | 3366 | +3366 | +0 | ++ | 700 | +11440 | +2605 | +1662 | +5640 | +7710 | +4 | +
| Guest Checkout start6 | ++ | 120 | +120 | +0 | ++ | 360 | +2490 | +908 | +487 | +1860 | +2420 | +0 | +
| Registered:Pick Billing Address 17 | ++ | 120 | +120 | +0 | ++ | 390 | +4240 | +1457 | +974 | +3510 | +4210 | +0 | +
| Registered:Pick Billing Address 2-18 | ++ | 120 | +120 | +0 | ++ | 410 | +3690 | +1218 | +685 | +2460 | +3070 | +0 | +
| Registered:Pick Billing Address 2-29 | ++ | 120 | +120 | +0 | ++ | 400 | +3600 | +1201 | +714 | +2700 | +3510 | +0 | +
| Registered:Go to pick Shipping Method10 | ++ | 120 | +120 | +0 | ++ | 340 | +2900 | +1072 | +633 | +2330 | +2700 | +0 | +
| Guest:Pick Billing Address 111 | ++ | 120 | +120 | +0 | ++ | 610 | +4620 | +1688 | +941 | +3580 | +4440 | +0 | +
| Guest:Pick Billing Address 212 | ++ | 120 | +120 | +0 | ++ | 380 | +3530 | +1049 | +589 | +2050 | +2750 | +0 | +
| Guest:Go to pick Shipping Method13 | ++ | 120 | +120 | +0 | ++ | 300 | +2080 | +796 | +401 | +1530 | +1960 | +0 | +
| Set Shipping Method (Flatrate) 114 | ++ | 240 | +240 | +0 | ++ | 510 | +4830 | +1780 | +1066 | +3930 | +4720 | +0 | +
| Set Shipping Method (Flatrate): Goto Payment15 | ++ | 240 | +240 | +0 | ++ | 300 | +3150 | +905 | +516 | +1940 | +2300 | +0 | +
| Set Payment Method (Check/MO) 116 | ++ | 240 | +240 | +0 | ++ | 670 | +5290 | +1787 | +987 | +3660 | +4920 | +0 | +
| Set Payment Method (Check/MO) 217 | ++ | 240 | +240 | +0 | ++ | 300 | +2760 | +904 | +518 | +2010 | +2440 | +0 | +
| Set Payment Method (Check/MO) 318 | ++ | 220 | +220 | +0 | ++ | 370 | +8180 | +2696 | +1725 | +5810 | +7590 | +0 | +
| /checkout/../success/19 | ++ | 240 | +240 | +0 | ++ | 250 | +2830 | +931 | +583 | +1970 | +2530 | +0 | +
| /checkout/../success/ Redirect 120 | ++ | 74 | +0 | +74 | ++ | 1030 | +8350 | +2473 | +1620 | +5590 | +7310 | +0 | +
| + | + | + | + | + | + | + | + | + | + | + | + | + |
| + | + | + | + | + | + | + | + | + | + | + | + | + |
| + | + | + | + | + | + | + | + | + | + | + | + | + |
| + | + | + | + | + | + | + | + | + | + | + | + | + |
| Magento EE v1.12 | ++ | + | + | + | + | + | + | + | + | + | + | + |
| Requests | ++ | Total | +OK | +KO | ++ | Min | +Max | +Mean | +Std Dev | +95th Pct | +99th Pct | +Req/s | +
| Global Information0 | ++ | 48044 | +47887 | +157 | ++ | 40 | +40580 | +4985 | +3290 | +10650 | +13870 | +58 | +
| product page0 | ++ | 21327 | +21286 | +41 | ++ | 40 | +20040 | +4557 | +2820 | +9740 | +12350 | +26 | +
| Click add to cart1 | ++ | 8340 | +8324 | +16 | ++ | 40 | +12130 | +4216 | +2217 | +7520 | +9000 | +10 | +
| Click add to cart Redirect 12 | ++ | 8324 | +8320 | +4 | ++ | 40 | +16500 | +7022 | +3449 | +11780 | +13500 | +10 | +
| click checkout3 | ++ | 2780 | +2779 | +1 | ++ | 920 | +12350 | +6311 | +2829 | +9760 | +10950 | +3 | +
| Guest Checkout start4 | ++ | 90 | +90 | +0 | ++ | 390 | +3690 | +2103 | +795 | +3210 | +3410 | +0 | +
| Registered Checkout:Login and Pick Address5 | ++ | 2690 | +2690 | +0 | ++ | 180 | +19120 | +3298 | +4984 | +15470 | +16940 | +3 | +
| Guest:Pick Billing Address 16 | ++ | 90 | +90 | +0 | ++ | 600 | +7750 | +4348 | +1605 | +6430 | +7400 | +0 | +
| Registered Checkout:Login and Pick Address Redirect 17 | ++ | 2690 | +2688 | +2 | ++ | 40 | +24360 | +5433 | +3350 | +11780 | +14060 | +3 | +
| Guest:Pick Billing Address 28 | ++ | 90 | +90 | +0 | ++ | 520 | +8240 | +3412 | +1423 | +5480 | +6810 | +0 | +
| Guest:Go to pick Shipping Method9 | ++ | 90 | +90 | +0 | ++ | 310 | +4780 | +2334 | +888 | +3300 | +4450 | +0 | +
| Registered:Pick Billing Address 110 | ++ | 90 | +90 | +0 | ++ | 370 | +10090 | +3657 | +2453 | +8660 | +9600 | +0 | +
| Registered:Pick Billing Address 2-111 | ++ | 90 | +90 | +0 | ++ | 540 | +17670 | +4148 | +2741 | +10220 | +12510 | +0 | +
| Registered:Pick Billing Address 2-212 | ++ | 90 | +90 | +0 | ++ | 530 | +12640 | +3983 | +2411 | +8290 | +11590 | +0 | +
| Registered:Go to pick Shipping Method13 | ++ | 90 | +90 | +0 | ++ | 360 | +6290 | +2546 | +1401 | +5050 | +5980 | +0 | +
| Set Shipping Method (Flatrate) 114 | ++ | 180 | +180 | +0 | ++ | 450 | +7640 | +3926 | +1884 | +6550 | +7450 | +0 | +
| Set Shipping Method (Flatrate): Goto Payment15 | ++ | 180 | +180 | +0 | ++ | 380 | +6290 | +2451 | +1256 | +4270 | +4830 | +0 | +
| Set Payment Method (Check/MO) 116 | ++ | 180 | +180 | +0 | ++ | 570 | +8290 | +3923 | +1996 | +6460 | +7300 | +0 | +
| Set Payment Method (Check/MO) 217 | ++ | 180 | +180 | +0 | ++ | 330 | +5230 | +2318 | +1238 | +4210 | +4810 | +0 | +
| Set Payment Method (Check/MO) 318 | ++ | 180 | +180 | +0 | ++ | 940 | +40580 | +12673 | +7957 | +25910 | +29540 | +0 | +
| /checkout/../success/19 | ++ | 180 | +180 | +0 | ++ | 230 | +3330 | +1437 | +854 | +2870 | +3150 | +0 | +
| /checkout/../success/ Redirect 120 | ++ | 93 | +0 | +93 | ++ | 780 | +10470 | +5031 | +2251 | +7920 | +8880 | +0 | +
| + |

+ {% include v1x/eol_message.html %}
+
+
+
+
+
+ These Release Notes contain the following information:
+Magento has the following patches available for multiple Magento CE versions.
+ +EE_1.14.0.1 in the name. These patches were all tested against CE 1.8.x as well.Patch name: SUPEE-3941
+/app/code/community directory structure, the Magento administrator
+ sees an error message in the Magento Connect Manager.Patch name: SUPEE-3762.
+ Refreshing the SOAP v2
+ index page (http://your-magento-host-name/index.php/api/v2_soap/index/) results in all
+ administrators and customers viewing the Magento installation page.
Magento has fixed an issue that prevented some Discover credit cards from validating properly. The issue was that + certain Discover credit card number ranges were not recognized as being valid. As a result of the fix, all Discover + cards should validate properly.
+The issue affects Magento CE versions 1.4.2.0–1.8.1.0.
+To get a fix for the issue, see Discover credit card validation issue: Magento EE 1.9.1.1–1.13.1.0 and CE + 1.4.2.0–1.8.1.0.
+You can use PHP 5.4 with Magento CE versions 1.6.0.0–1.8.1.0.
+To get the patch, see Getting the PHP 5.4 + patch for Magento Enterprise Edition (EE) and Community Edition (CE).
+For more information about PHP 5.4, see the PHP migration page and the PHP changelog.
+ +This section discusses how to get patches referenced in these Release Notes.
+To get patches for Magento CE:
+See the following sections for information about changes in this release:
+Magento CE 1.8.1.0 helps advance overall product quality and ease operations by providing significant tax + calculation improvements, a wide range of bug fixes, and several security enhancements.
+ +CE 1.8.1.0 resolves Value Added Tax (VAT) and Fixed Product Tax (FPT) issues so that Magento administrators can + create invoices and credit memos to give merchants merchants access to accurate and consistent tax calculations + and displays. We've also addressed:
+CE 1.8.1.0 includes bug fixes across important feature areas, including the shopping cart, checkout, content + management system, and product import and export function. Many of these updates came from a hackathon held with + Magento community developers, which demonstrates the vitality of our development community and their powerful + ability to help us advance the platform.
+ +CE 1.8.1.0 includes several security enhancements that were identified through our rigorous security assessment + process. Magento complements its own comprehensive internal testing with quarterly penetration testing by expert + consultants and actively works with the development community to identify security issues in order to harden the + platform against potential threats.
+ + + +Magento addressed the following security issues:
+frontend cookie to protect user sessions.
+
+ + There is a known Issue After Upgrading to CE 1.8.1 that affects + you only if you do not follow the recommended procedure to upgrade to a new environment as + discussed in Getting Ready For + Your Upgrade.
+Symptom: After completing the upgrade, when you log in to the Admin Panel and click + System > Configuration, a fatal error similar to the following displays in your + browser:
+Class 'Mage_Googlecheckout_Helper_Data' not found in /var/www/html/magento/app/Mage.php on line 547+ +
Solution:
+root privileges, delete all files except config.xml from the
+ following directory:magento-install-dir/app/code/core/Mage/GoogleCheckout/etc+
See the following sections for a discussion of changes in this release:
+*) wildcard character for the value of State when you set up a new
+ tax rate. This enables you to apply the same tax rate to all states or provinces in a particular country.http://xmlapi.dhl-usa.com/ApiLanding.asp+
Tax calculation issues can be divided into the following sections:
+The following general fixes were made to Magento tax configuration and calculations:
+NOT LOGGED IN customer group.)The following tax rounding issues were resolved:
+The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web + store:
+Fixes in this release can be divided into the following categories:
+ + +'Zend_Date_Exception' with message 'Invalid year, it must be between -10000 and 10000'Mage_Catalog_Block_Product_Abstract class that caused errors to display on product view pages in
+ your web store.Mage_Page_Block_Template_Links::addLinkBlock to enable you to sort an array of results by
+ position.See the following sections for information about changes in this release:
+The USPS changed the names of their Priority and Express shipping options in their API in July 2013. To enable you + to continue utilizing USPS Priority and Express mail methods, CE 1.8 includes a patch that addresses the + issue.
+Following are details about the upgrade impact:
+Tax calculation issues can be divided into the following sections:
+The following general fixes were made to Magento tax configuration and calculations:
+Sub item price = Sub item base price * Applicable tiered price adjustment or discount, then rounded
+ Bundle price = Sum (round(sub item price * qty))round(unit price * non-integer quantity)For details, see the Magento + User Guide.
+ + +The following issues relate to one-cent rounding errors in the web store or shopping cart:
+The following issues relate to errors in calculating taxes that include FPT in the web store or shopping cart:
+The following issues relate to price calculations when coupon codes or other discounts are applied in the web store + or shopping cart:
+The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web + store:
+The following are fixed in the Magento SOAP v2.0 APIs (with exceptions noted):
+8888 in the following example):
+ $result = $client->call($sessionId, 'catalog_product.info', '8888', null, null, 'sku');
+
+ salesOrderAddComment.
+
+ shoppingCartProductMoveToCustomerQuote method works properly.
+
+ from-to complex filters to perform "window" filtration on a single
+ field. For example, you can use from and to on the created_at return a list
+ of sales orders using the salesOrderList.
+
+ productGetSpecialPrice method returns special price information for a product, whether or not
+ WS-I Compliance is
+ enabled.
+
+ shoppingCartPaymentList method returns the list of the available payment
+ methods for the shopping cart appropriately. The following error is no longer returned:
+ SOAP-ERROR: Encoding: object has no 'code' property in name
+
+ productAttributeAddOption and catalogProductAttributeUpdate methods are now supported when WS-I
+ Compliance is enabled.
+
+ salesOrderCreditmemoCreate is now correct; that is, it matches the code.
+
+ C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin> wsdl /out:Magento.cs /v
+ http://magentohost/api/v2_soap/?wsdl
+
+ catalogProductAttributeInfo.
+
+ product_custom_option.add operation with multicall no
+ longer results in redundant options.
+
+ Fixes in this release can be divided into the following categories:
+There has been an error processing your request. Please contact us or try again later).
+
+ 10,50 (using a comma character and not a period) for Adjustment
+ Fee now results in the correct amount of credit being applied to the transaction.
+
+ /sitemap/catalog/string.
+
+ SAMPLE printed on them only when you request a sample label.
+
+ The following fixes relate to administering and using shopping cart price rules and catalog price rules:
+QTY) of all products imports correctly.
+
+ use_cfg_max_sale_qty) is correct.
+
+ user@example.com and User@example.com).
+
+ .csv) file have been resolved.
+
+ state correctly. (Before the fix, city was sent as the value for state.)
+
+ Gateway error: Void error: V18A4B18E0F9 has been captured errors when canceling
+ partially invoiced orders when the Payflow Pro processor was used to process the payment.
+
+ This
+ customer email already exists.
+
+ .htaccess.sample provided with Magento now includes php_value memory_limit 512M to be
+ consistent with the Magento system
+ requirements.mage_ because you specified a tables prefix during installation).Magento acknowledges and thanks everyone in the Magento Community who contributed to this release, including Colin + Mollenhour for Redis modules.
+ +
+ {% include v1x/eol_message.html %}
+
+
+
+ These Release Notes contain the following information:
+ +Magento has the following patches available for multiple Magento EE versions.
+ +EE_1.14.0.1 in the name. These patches were all tested against EE 1.13.x as well.Patch name: PATCH_SUPEE-3941_EE_1.14.0.1_v1-2014-08-12-12-10-06.sh
+/app/code/community directory structure, the Magento administrator
+ sees an error message in the Magento Connect Manager.Patch name: PATCH_SUPEE-3762_EE_1.14.0.1_v1.sh.
+ Refreshing the SOAP v2
+ index page (http://your-magento-host-name/index.php/api/v2_soap/index/) results in all
+ administrators and customers viewing the Magento installation page.
Patch name: PATCH_SUPEE-3819_EE_1.14.0.1_v1.sh. + Multiple Magento + administrators can simultaneously add new products; or edit descriptions, edit prices, or edit stock quantities of + existing products without causing deadlocks, key violations, or critical data errors. Together with applying the + patch, you must set all indexers to Update when scheduled as follows:
+Magento has fixed an issue that prevented some Discover credit cards from validating properly. The issue was that + certain Discover credit card number ranges were not recognized as being valid. As a result of the fix, all Discover + cards should validate properly.
+The issue affects EE versions 1.9.1.1 through 1.13.1.0.
+To get a fix for the issue, see Discover credit card validation issue: Magento EE 1.9.1.1–1.13.1.0 and CE + 1.4.2.0–1.8.1.0.
+You can use PHP 5.4 with Magento EE versions 11.0.0.0–1.13.1.0.
+To get the patch, see Getting the PHP 5.4 + patch for Magento Enterprise Edition (EE) and Community Edition (CE).
+For more information about PHP 5.4, see the PHP migration page and the + PHP changelog.
+ +This section discusses how to get patches referenced in these Release Notes. Magento has other patches available + from the EE support portal and the partner portal; you + can use the following instructions to install any of those patches as well.
+To get patches for Magento EE:
++
See the following sections for information about changes in this release:
+Magento EE 1.13.1.0 helps advance overall product quality and ease operations by providing significant tax + calculation improvements, a wide range of bug fixes, and several security enhancements.
+ +EE 1.13.1.0 resolves Value Added Tax (VAT) and Fixed Product Tax (FPT) issues so that Magento administrators can + create invoices and credit memos to give merchants merchants access to accurate and consistent tax calculations + and displays. We've also addressed:
+EE 1.13.1.0 includes bug fixes across important feature areas, including the shopping cart, checkout, content + management system, and product import and export function. Many of these updates came from a hackathon held with + Magento community developers, which demonstrates the vitality of our development community and their powerful + ability to help us advance the platform.
+ +EE 1.13.1.0 includes several security enhancements that were identified through our rigorous security assessment + process. Magento complements its own comprehensive internal testing with quarterly penetration testing by expert + consultants and actively works with the development community to identify security issues in order to harden the + platform against potential threats.
+ +Magento addressed the following security issues:
+frontend cookie to protect user sessions.
+
+ There is a known issue after upgrading to EE 1.13.1 that affects you only if you do not follow + the recommended procedure to upgrade to a new environment as discussed in Getting Ready For Your + Upgrade.
+Symptom: After completing the upgrade, when you log in to the Admin Panel and click + System > Configuration, a fatal error similar to the following displays in your + browser:
+Class 'Mage_Googlecheckout_Helper_Data' not found in /var/www/html/magento/app/Mage.php on line 547+ +
Solution:
+root privileges, delete all files except config.xml from the
+ following directory:magento-install-dir/app/code/core/Mage/GoogleCheckout/etc+
See the following sections for a discussion of changes in this release:
+*) wildcard character for the value of State when you set up a new
+ tax rate. This enables you to apply the same tax rate to all states or provinces in a particular country.http://xmlapi.dhl-usa.com/ApiLanding.asp.
Tax calculation issues can be divided into the following sections:
+The following general fixes were made to Magento tax configuration and calculations:
+NOT LOGGED IN customer group.)The following tax rounding issues were resolved:
+The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web + store:
+Fixes in this release can be divided into the following categories:
+'Zend_Date_Exception' with message 'Invalid year, it must be between -10000 and 10000'Mage_Catalog_Block_Product_Abstract class that caused errors to display on product view pages in
+ your web store.Mage_Page_Block_Template_Links::addLinkBlock to enable you to sort an array of results by
+ position.In response to customer feedback about EE 1.13.0.0 and EE 1.13.0.1, Magento has modified the functionality to + smooth the migration path from earlier EE versions and support duplicate category URL keys.
+See the following sections for a discussion of changes in this release:
+Important:
+This section discusses how search engine optimization (SEO) works in EE 1.13.0.2. This section is not + intended to be a tutorial on SEO.
+See one of the following for more information:
+The following sections quickly summarize the changes you'll see in EE 1.13.0.2:
+ + +Product URL key uniqueness
+In EE 1.12, it was possible to have multiple products with the same URL key; however, every time the indexer
+ ran, it silently assigned a numerical suffix to duplicates (for example, shoes became
+ shoes-1 and so on).
Every time this happened, another URL rewrite was created, resulted in a set of chained redirects for + the same product. Having multiple URLs for a product dilutes the effectiveness of URL in search engine + weightings, especially if you enabled canonical URLs. (As discussed in this + article on Google's blog, a canonical URL is a public specification of your preferred URL. The + canonical URL is used by any search engine when crawling and indexing your site.)
+This behavior was not clear to merchants and had the effect of diluting search engine weightings.
+In EE 1.13.0.2, there is a single, unique way to access a product (or multiple ways if you use the category + path in URLs).
+No more chained redirects
+Per-entity indexing
+Similar to chained redirects, in EE 1.12, if a product had the same URL key as its parent category, the indexer + assigned an incrementing numeric suffix to either the category or the product. This was done without the + merchant's knowledge and was confusing as well. +
In EE 1.12, if you named a top-level category slippers and had product also named
+ slippers, the indexer allowed to access to the category using a URL like the following:
+ http://www.example.com/slippers-1
In EE 1.13.0.2, the same product can be accessed using a URL like:
+ http://www.example.com/slippers
+
There is a new Admin Panel setting to specify how indexing should be prioritized. This setting, + System > Configuration > CATALOG > Catalog > Search + Engine Optimizations > Priority for Duplicated URL Keys, is discussed in more + detail in Prioritizing URL Resolution.
+The following entities can be indexed and therefore have a requirement for URL key uniqueness:
+Uniqueness rules for each entity type follow:
+| Entity type | +Uniqueness rule | +
|---|---|
| Product, including custom URL redirects† | +All product URL keys must be globally unique. | +
| Category | +
+ Category URL keys must be unique only in the same level in the hierarchy; for example +website+ Note: Uniqueness rules apply to inactive categories as well. You cannot use the same URL + key for both an active and inactive category at the same level in the category hierarchy. + |
+
| CMS | +CMS URL keys, like category URL keys, must be unique only in the same level in the + hierarchy. | +
†—Custom URL redirect refers to a product's Create Custom Redirect + for old URL option.
+ +The following table shows category URL keys that are allowed. (The URL key is shoes for all entities
+ in the table.)
| URL examples | +Reason allowed | +
|---|---|
http://example.com/mens/shoes+ http://example.com/womens/shoes |
+ Different category hierarchies. | +
http://example1.com/shoes+ http://example2.com/shoes |
+ Different domains. | +
http://example.com/shoes (store view 1)+ http://example.com/shoes (store view 2) |
+ Different store views. | +
Notes:
+Suppose you have the following set of URL keys. All of them are allowed because they're for different entity types. +
+| Entity type | +Entity name | +URL key | +Sample URL | +
|---|---|---|---|
| Category | +shoes | +shoes | +http://www.example.com/shoes.html | +
| Product | +shoes | +shoes | +http://www.example.com/shoes.html | +
| Custom URL redirects | +shoes | +shoes | +http://www.example.com/shoes.html | +
Question: What happens when a web store visitor requests
+ http://www.example.com/shoes.html?
Answer: You control the response in the Admin Panel. Click System > + Configuration > CATALOG > Search Engine Optimizations. In the right pane, click an + option from the Priority for Duplicated URL Keys list. Some examples follow:
+| Priority setting | +Result | +
|---|---|
Default setting:
+
|
+ Custom URL redirect | +
+
|
+ Shoes category | +
†—Custom URL redirect refers to a product's Create Custom Redirect + for old URL option.
+The other options are:
+In the event no URL key matches your priority setting, Magento continues through the priorities in order until a + match is found.
+For more information about SEO, see:
++ After changing the + value for product or category suffix, previous suffixes do not work.
+For example, if a category URL suffix was set to .html and you change it to .php, + categories that had been using the .html suffix display an HTTP 404 (Not Found) error in your web store.
+(In the Admin Panel, click System > Configuration > CATALOG > + Catalog > Search Engine Optimizations. In the right pane, the options are named + Product URL Suffix and Category URL Suffix.)
+ +The United States Postal Service (USPS) changed the names of their Priority and Express shipping options in their + API on Sunday, July 28, 2013. Magento has a patch available; however, this patch is not included in new EE 1.13.0.2 + installations.
+For new EE 1.13.0.2 installations to continue utilizing USPS Priority and Express mail methods, you must + install the patch we've created to address the issue.
+Get the patch from the EE support portal by logging in to magentocommerce.com.
+ +testurlkey, the new product's URL key might is testurlkey-1.product1
+ and you create a new product with the name Product1 and the product has an ID of 500, the new
+ product's URL key is product1-500.http://www.example.com/mens/shoes
+ domain-name/product-url-key because product URL keys must be globally
+ unique.domain-name/product-url-key but the product can also be accessed using
+ its full URL (including the category hierarchy). Examples:producturlkey and it's assigned to the Apparel > Womens >
+ Purses category, the product can be accessed using both of the following URLs:http://www.example.com/producturlkeyhttp://www.example.com/apparel/womens/purses/producturlkeyhttp://www.example.com/producturlkey.
+ Notes:
This section discusses fixes made in EE 1.13.0.2.
+SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get
+ lock.mage_ because you specified a tables prefix during installation).SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry/catalog/category/view/s/newcategory/id/36//catalog/newcategory//parent-category/category-2//parent-category/category-2/product-1SQLSTATE[23000]: Integrity constraint violation.SQLSTATE[23000]: Integrity constraint violation.See the following sections for information about changes in this release:
+Magento has identified a potential vulnerability that might affect you if both of the following are true:
+If both of the preceding are true, Magento can be subjected to cross-site scripting + (XSS) attacks—a type of injection issue, which means that malicious code is injected into otherwise + trusted websites, generally in the form of a browser-side script.
+Issue: Magento is subject to XSS attacks because the SID cookie value is not sanitized by default.
+Suggested solution: Either disable Use SID on Frontend or output-encode any usage of the SID cookie value before using it or passing it as a + parameter to any page cache helper functions.
+Additional references:
+Magento EE 1.13—unlike earlier versions—does not allow duplicate URL keys for products or + categories. An issue has been identified that causes problems during upgrades if you already have duplicate URL + keys. The issue is being addressed; until a solution is announced, Magento recommends you test your upgrade but + do not try to deploy it to a production environment.
+ For more information about upgrading in a development environment, see Upgrading to and Verifying + Magento Community Edition (CE) 1.8 and Enterprise Edition (EE) 1.13. + +For more information, see Magento + Enterprise Edition 1.13 Benchmarking
+ +Tax calculation issues can be divided into the following sections:
+The following general fixes were made to Magento tax configuration and calculations:
+Sub item price = Sub item base price * Applicable tiered price adjustment or discount, then rounded
+ Bundle price = Sum (round(sub item price * qty))round(unit price * non-integer quantity)For details, see the Magento + User Guide.
+ + +The following issues relate to one-cent rounding errors in the web store or shopping cart:
+The following issues relate to errors in calculating taxes that include FPT in the web store or shopping cart:
+The following issues relate to price calculations when coupon codes or other discounts are applied in the web store + or shopping cart:
+The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web + store:
+The following are fixed in the Magento SOAP v2.0 APIs (with exceptions noted):
+8888 in the following example):
+ $result = $client->call($sessionId, 'catalog_product.info', '8888', null, null, 'sku');
+
+ salesOrderAddComment.
+
+ shoppingCartProductMoveToCustomerQuote method works properly.
+
+ from-to complex filters to perform "window" filtration on a single
+ field. For example, you can use from and to on the created_at return a list
+ of sales orders using the salesOrderList.
+
+ productGetSpecialPrice method returns special price information for a product, whether or not
+ WS-I Compliance is
+ enabled.
+
+ shoppingCartPaymentList method returns the list of the available payment
+ methods for the shopping cart appropriately. The following error is no longer returned:
+ SOAP-ERROR: Encoding: object has no 'code' property in name
+
+ productAttributeAddOption and catalogProductAttributeUpdate methods are now supported when WS-I
+ Compliance is enabled.
+
+ salesOrderCreditmemoCreate is now correct; that is, it matches the code.
+
+ C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin> wsdl /out:Magento.cs /v
+ http://magentohost/api/v2_soap/?wsdl
+
+ catalogProductAttributeInfo.
+
+ product_custom_option.add operation with multicall no
+ longer results in redundant options.
+
+ Fixes in this release can be divided into the following categories:
+There has been an error processing your request. Please contact us or try again later).
+
+ 10,50 (using a comma character and not a period) for Adjustment
+ Fee now results in the correct amount of credit being applied to the transaction.
+
+ /sitemap/catalog/string.
+
+ SAMPLE printed on them only when you request a sample label.
+
+ The following fixes relate to administering and using shopping cart price rules and catalog price rules:
+QTY) of all products imports correctly.
+
+ use_cfg_max_sale_qty) is correct.
+
+ user@example.com and User@example.com).
+
+ .csv) file have been resolved.
+
+ state correctly. (Before the fix, city was sent as the value for state.)
+
+ Gateway error: Void error: V18A4B18E0F9 has been captured errors when canceling
+ partially invoiced orders when the Payflow Pro processor was used to process the payment.
+
+ This
+ customer email already exists.
+
+ GiftRegistry/Model/Item/Option.php has been resolved.
+
+ magento-install-dir/app/code/core/Enterprise/PageCache/Model/Config.php was
+ modified to enable you to set specific lifetimes for certain blocks.
+
+ This release includes the following changes to support the changes in indexing:
+catalog_product_entity_url_key and catalog_category_entity_url_key
+ database tables for the corresponding url_key attributes have been added.
+
+ + For more information about indexing changes, see the Magento User Guide.
+ + + + + + diff --git a/guides/v1.8/ce18-ee113/ht_magento-ce-sample.data.html b/guides/v1.8/ce18-ee113/ht_magento-ce-sample.data.html new file mode 100644 index 0000000000..3d5e6bf356 --- /dev/null +++ b/guides/v1.8/ce18-ee113/ht_magento-ce-sample.data.html @@ -0,0 +1,45 @@ +--- +layout: v1x +title: Installing Sample Data for Magento Community Edition (CE) +--- + +This page discusses how to get the sample data for:
+Magento CE sample data must be installed before you install Magento CE.
+ ++ The sample data is provided in different formats for your convenience. + Archives for each version have exactly the same content (they differ only by compression method). +
+Detailed instructions for installing sample data for Magento CE 1.6–1.9 can be found on the Magento Knowledge Base.
diff --git a/guides/v1.8/ce18-ee113/using_redis.html b/guides/v1.8/ce18-ee113/using_redis.html new file mode 100644 index 0000000000..64eab88162 --- /dev/null +++ b/guides/v1.8/ce18-ee113/using_redis.html @@ -0,0 +1,119 @@ +--- +--- + + + + + + + + + +
+{% include v1x/eol_message.html %}
+
+
+
+
+Redis is an open source, Berkeley Software Distribution (BSD) licensed, advanced key-value store that can optionally be used in Magento for backend and session storage. In fact, you can replace memcached with Redis.
+Following are some of the benefits Redis provides for Magento implementations:
+The following Magento editions support Redis session and backend caching:
+The preceding Magento editions support Redis server version 2.6.9 and later available from redis.io.
+In addition, you can optionally use the Redis extension for PHP version 2.2.3 or later if you're using Redis for backend caching; however, Magento works without this extension.
+ +To use Redis with Magento, you must configure Magento to use Redis and you must install and configure the Redis server. These tasks are discussed in the following sections:
+ + +To use Redis with Magento, you only need to install and configure the Redis server. The integration between Redis and Magento is already included with Magento CE 1.8 and EE 1.13 and later versions. All you need to do is configure it.
+Important: The Cm_RedisSession module in CE 1.8 is disabled by default. Magento disables the module to avoid unnecessary connection tries to Redis when you choose to use file, database, or a different session storage method.
+To enable Magento to use Redis, perform the following tasks:
+Get Redis server version 2.6.9 or later and configure it according to their documentation.
+You can optionally install the Redis extension for PHP version 2.2.3 or later as well, but Magento functions without it.
+ +Important: Colin Mollenhour, the original author of Redis, does not provide support for Magento implementations. You can get support for Magento implementations in the following ways:
+| Magento edition | +How to get help | +
|---|---|
| Magento CE and Magento EE | ++ | +
| Magento CE | +Submit bug reports | +
| Magento EE only | +Submit bug reports | +
For more information about using Redis with Magento, see:
+ + +Magento acknowledges the contributions of Colin Mollenhour in providing the code for the Magento implementation of Redis.
+ + + + +Welcome to the home page for Magento 1.9.x documentation for installation, configuration, developers, patches, and more. Here you'll find articles that were formerly located on http://magentocommerce.com/knowledge-base.
For information you don't find here—including Release Notes—see the User Guide page.
+ +
+{% include v1x/eol_message.html %}
+
+In a continuing effort to improve security and ease of use, Magento is updating its recommendations for file system permissions and ownership for the following Magento editions:
+This article discusses recommended permission and ownership schemes to apply after you install Magento.
+The guidelines discussed in this article apply to:
+This article discusses the following permission and ownership schemes:
+root access on the server).This article uses the following terminology:
+root. The web server typically runs as an ordinary user. Magento assumes you log in as this user to start and stop the web server and that you already own all the files and directories in the Magento installation directory. You can use chmod to change permissions on files and directories.root and, as root, you can use the chown and chmod commands to set ownership and privileges in the Magento installation directory.If you have installed Magento, you can set file system privileges and ownership as follows:
+media/ and var/ directories at 700/600 because they must be writable.Following is an explanation of the privileges:
+dr-x------) gives the web server user read and execute privileges to prevent the accidental deletion or modification of files in the directory. Other users have no access to Magento directories.-r--------) prevent any user (even the web server user) from overwriting files.drwx------) for the media/ and var/ directories give full control (that is, read/write/execute) to the owner and no permissions to anyone else.-rw-------) for files in the media/ and var/ directories enable the web server user to write to them and to overwrite them.root privileges. On a hosted system, commands must be entered as the web server user.To set up ownership and permissions on a dedicated Magento server:
+root privileges, find the web server user:
+ grep User /etc/apache2/apache2.confgrep User /etc/httpd/conf/httpd.conf.conf files on your system might be different. You can use the command whereis nginx to find the location of the configuration files.apache and the Apache web server user on Ubuntu is www-data./etc/nginx/nginx.conf. The user directive specifies the username. It might run as the Apache user if Apache is installed on the same system./var/www/html/magento. On Ubuntu, it is typically /var/www/magento.root privileges, enter the following command to set ownership of the Magento installation directory and all its subdirectories:
+ chown -R web-server-user-name .+ For example, on Ubuntu where Apache usually runs as
www-data, enter
+ chown -R www-data .
find . -type f -exec chmod 400 {} +
+find . -type d -exec chmod 500 {} +
+find var/ -type f -exec chmod 600 {} +
+find media/ -type f -exec chmod 600 {} +
+find var/ -type d -exec chmod 700 {} +
+find media/ -type d -exec chmod 700 {} +
+chmod 700 includes
+chmod 600 includes/config.phpIf you set permissions and ownership as discussed in this article, you must change permissions temporarily to be able to use the Magento Connect Manager in the Admin Panel. (System > Magento Connect > Magento Connect Manager). You can still install extensions manually, however; that is beyond the scope of this article.
+You can confirm the issue when you access Magento Connect Manager in the Admin Panel. The following error displays on the Extensions tab page:
+Warning: Your Magento folder does not have sufficient write permissions.+
To use Magento Connect Manager, you must:
+In addition, if you have a dedicated Magento server, you should check ownership of files and directories and reset them if necessary. Often, Magento Connect Manager installs extensions with user and group ownership both set to the web server user.
+ +To temporarily set file and directory permissions so you can use Magento Connect Manager:
+/var/www/html/magento. On Ubuntu, it is typically /var/www/magento.find . -type d -exec chmod 700 {} +
+find . -type f -exec chmod 600 {} +Enter the commands discussed in this section to return permissions and ownership to their recommended values after you have installed extensions.
+To restore Magento installation directory permissions:
+/var/www/html/magento. On Ubuntu, it is typically /var/www/magento.root privileges, enter the following command to set ownership of the Magento installation directory and all its subdirectories:
+ chown -R web-server-user-name .+ For example, on Ubuntu where Apache usually runs as
www-data, enter
+ chown -R www-data .
find . -type f -exec chmod 400 {} +
+find . -type d -exec chmod 500 {} +
+find var/ -type f -exec chmod 600 {} +
+find media/ -type f -exec chmod 600 {} +
+find var/ -type d -exec chmod 700 {} +
+find media/ -type d -exec chmod 700 {} +Magento Support typically provides a shell script to patch various Magento issues. When you run the shell script, file and directory permissions are typically not changed; however, the files provided with the patch are owned by the user who applied the patch. If you have a dedicated Magento server, this is typically root; therefore, after applying the patch, you must change file ownership.
If you are required to apply a patch provided by Magento Support, use the following process:
+root privileges or as the owner of the Magento installation directory.root privileges, use the following steps to reset file ownership:
+ grep User /etc/apache2/apache2.confgrep User /etc/httpd/conf/httpd.confapache and the Apache web server user on Ubuntu is www-data./etc/nginx/nginx.conf. The user directive specifies the username. It might run as the Apache user if Apache is installed on the same system.root privileges, enter the following command from the Magento installation directory:chown -R web-server-user-name .
+ For example, on Ubuntu where Apache usually runs as www-data, enter
+ chown -R www-data .For more information about UNIX permissions, see the following resources:
+ +
+{% include v1x/eol_message.html %}
+
+In a continuing effort to improve security and ease of use, Magento is updating its recommendations for file + system permissions and ownership for the following Magento editions:
+The guidelines discussed in this article apply to:
+This article uses the following terminology:
+This section discusses Magento's pre-installation recommended privilege and ownership settings, which are as + follows:
+Note: On a dedicated system, all commands discussed in this article must be + entered as a user with root privileges.
+After you extract the Magento installation package, set ownership and permissions as follows:
+Note: The preceding paths are samples only. The paths + to these .conf files on your system might be different. You can use the command + whereis nginx to find the location of the configuration files.
+chown -R web-server-user-name .+ For example, on Ubuntu where Apache usually runs as www-data, enter +
chown -R www-data .+
find . -type d -exec chmod 700 {} +
+find . -type f -exec chmod 600 {} +
+ For more information about UNIX permissions, see the following resources:
+ + +
+{% include v1x/eol_message.html %}
+
+We're happy you chose to install or upgrade your Magento software. We're going to help you to install or to upgrade to the following versions:
+These releases include a number of improvements:
+The sections that follow get you started on your installation or upgrade. Detailed, step-by-step procedures are discussed in the following articles:
+ + +In the event you have a large, distributed system or you need additional help, consult the following resources.
+| Magento edition | +How to get help | +
|---|---|
| Magento CE and Magento EE | ++ | +
| Magento CE | +Submit bug reports | +
| Magento EE only | +Submit bug reports | +
The following table discusses where to get the upgrade image and optional sample data.
+| Magento edition | +Upgrade image location | +
|---|---|
| Magento CE | +www.magentocommerce.com/download | +
| Magento EE | +Use the following steps:
+
|
+
See Installing Magento CE or EE.
+ +
+{% include v1x/eol_message.html %}
+
+This article discusses how to install:
+To install Magento CE or Magento EE, use the following high-level guidelines:
+Before starting your installation:
+Magento strongly recommends you observe the following guidelines when you set up your Magento database:
+More information, including software prerequisites, can be found in the next section.
+ +The following sections discuss how to download and install prerequisite software and install Magento CE or EE on a system running:
+Complete the tasks discussed in the following sections in the order shown:
+root privileges.Security Enhanced Linux (SELinux) enables CentOS and Ubuntu administrators greater access control over their servers. If you're using SELinux and Apache must initiate a connection to another host, you must run the commands discussed in this section.
+If Apache and the database server are on the same host, you can skip this section and continue with Opening Ports In Your Firewall.
+To enable Apache to initiate a connection to another host with SELinux enabled:
+getenforce+
Enforcing displays to confirm that SELinux is running.setsebool -P httpd_can_network_connect=1
setsebool -P apache2_can_network_connect=1
Depending on your security requirements, you might find it necessary to open port 80 and other ports in your firewall. Because of the sensitive nature of networking security, Magento strongly recommends you consult with your IT department before proceeding. Following are some suggested references:
+This section discusses how to create or install the following:
+phpinfo.php filephpmyadmin database administration utility.These optional utilities might assist you with your installation; however, they are not required to install or use Magento.
+To skip installing these utilities, go directly to Creating a Magento Database Instance.
+See the following sections:
+ + +NTP enables servers to synchronize their system clocks using globally available pool servers. Magento recommends you use NTP servers you trust, whether they are dedicated hardware solutions your internal network or external, public servers.
+If you are deploying Magento on multiple hosts, NTP is a simple way to guarantee their clocks are all synchronized, no matter what time zone the servers are in.
+To install and configure NTP:
+yum search ntpntp.x86_64.yum -y install ntp.x86_64apt-get install ntp/etc/ntp.conf in a text editor.server 0.centos.pool.ntp.org +server 1.centos.pool.ntp.org +server 2.centos.pool.ntp.org
server 0.us.pool.ntp.org +server 1.us.pool.ntp.org +server 2.us.pool.ntp.org
/etc/ntp.conf and exit the text editor.chkconfig ntpd on
service ntpd restart
service ntp restart
date command to check the server's date.ntpdate pool-server-host-name command. If it fails, search for the error it returns.phpinfo.php displays a large amount of information about PHP and its extensions. Add the following code anywhere in your web server's docroot:
<?php +// Show all information, defaults to INFO_ALL +phpinfo();+
For more information, see the phpinfo manual page.
+To view the results, enter the following URL in your browser's location or address field:
+http://web-server-ip-or-host/phpinfo.php+
If a 404 (Not Found) error displays, check the following:
+phpmyadmin is an easy-to-use, free database administration utility. You can use it to check and manipulate the contents of your database. You must log in to phpmyadmin as the MySQL database administrative user.
For more information about phpmyadmin, see the phpmyadmin home page.
For more detailed information about installation, see the phpmyadmin installation documentation.
+To install phpmyadmin on CentOS:
+cd /tmp
+wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
+rpm -ivh epel-release-6-8.noarch.rpm
phpmyadmin as follows:
+yum -y install phpmyadmin
vim /etc/httpd/conf.d/phpMyAdmin.conf
#Require ip 127.0.0.1+For example, +
Require ip 192.51.100.101
#Allow from 127.0.0.1+For example, +
Allow from 192.51.100.101
/etc/httpd/conf.d/phpMyAdmin.conf and exit the text editor.service httpd restart
http://host-or-ip-address/phpmyadmin
root or administrative user's username and password.To install phpmyadmin on Ubuntu:
+apt-get install phpmyadminhttp://host-or-ip-address/phpmyadmin
+root or administrative user's username and password.This section discusses how to create a new database instance for Magento. Although a new database instance is recommended, you can optionally install Magento into an existing database instance. If you choose to do that, skip this section and continue with Installing Optional Sample Data.
+To create a new database instance:
+magento:
+mysql -u root -p +#Enter the remaining commands at the mysql> prompt. + +create database magento; +GRANT ALL ON magento.* TO magento@localhost IDENTIFIED BY 'magento';
GRANT SUPER ON *.* TO 'magento'@'localhost';
exitmysql -u magento -p+Messages similar to the following display to confirm you successfully created the database instance. If errors display, repeat the preceding commands. +
Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 20 +Server version: 5.1.67 Source distribution + +Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
Extract the Magento installation archive on your web server's docroot.
+The path on Ubuntu is typically /var/www
The path on CentOS is typically /var/www/html
Examples follow:
+cd /var/www +cp /path/magento-install-archive . +tar -zxf magento-install-archive-name
cd /var/www/html +cp /path/magento-install-archive-name . +tar -zxf magento-install-archive
To optionally install Magento sample data, continue with the next section.
+To install Magento without sample data, continue with Setting File and Directory Ownership and Privileges.
+ +Magento provides sample data you can optionally install to give you an idea of what products look like in the Admin Panel and in your web store. You can use this sample data to learn how Magento works and to experiment with custom themes.
+You must install sample data on the file system and in the database before you install Magento.
+To skip sample data installation, continue with Setting File and Directory Ownership and Privileges.
+To install Magento sample data:
+media subdirectory.[your Magento install dir]/media directory.
+#Ubuntu example +cd /var/www/magento/media + +#CentOS example +cd /var/www/html/magento/media
media directory and subdirectories to your Magento installation directory./home/username to /var/www/magento, enter
+cp -R /home/username/media/* .
skin directory to [your Magento install dir]/skin as follows:/home/username/skin to /var/www/magento/skin, enter
+cd [your Magento install dir]/skin +cp -R /home/username/skin/* .
mysql -u root -p magento-db-instance-name < path-to-sample-data-extract-dir/sample-data-filename.sql+EE 1.14 example +
mysql -u root -p magento < /home/username/magento_sample_data_for_1.14.0.0.sql
Magento recommends the following ownership and privilege settings for files and directories in the Magento installation directory:
+root).drwx------).-rw-------).Note: The way you set permissions and ownership depends on whether Magento is running on a dedicated or hosted system:
+root. The web server typically runs as an ordinary user. Magento assumes you log in as this user to start and stop the web server and that you already own all the files and directories in the Magento installation directory. You can use chmod to change permissions on files and directories.root and, as root, you can use the chown and chmod commands to set ownership and privileges in the Magento installation directory.To set privileges and ownership:
+#Ubuntu example +cd /var/www/magento + +#CentOS example +cd /var/www/html/magento
chown -R web-server-user-name .+For example, on Ubuntu where Apache usually runs as
www-data, enter
+chown -R www-data .
find . -type d -exec chmod 700 {} +
+find . -type f -exec chmod 600 {} +This section discusses how to run the Magento installer, using Magento EE as an example. The Magento CE installer has exactly the same options; only the appearance is different.
+To install Magento CE or EE:
+web-server-ip-or-host:port/magento-path/magento+For example, if your web server is
http://www.example.com, listens on port 80, and Magento is installed in the web server docroot's magento subdirectory, enter
+http://www.example.com/magento+The following page displays.

| Option | +Meaning | +
|---|---|
| Locale | +From the list, click the option that best matches the locale in which your Magento server resides. | +
| Time Zone | +From the list, click the option that best matches the time zone in which your Magento server resides. | +
| Default currency | +From the list, click the default currency to use on your Magento web store. | +

| Option | +Meaning | +
|---|---|
| Database Type | +From the list, click MySQL. | +
| Host | +Enter the database server's fully qualified hostname or IP address. Use the default setting of localhost if your database server is on the same host as your web server. | +
| Database Name | +Enter the name of the Magento database instance in which you want to install the Magento database tables. | +
| User Name | +Enter the username of the Magento database instance owner. | +
| User Password | +Enter the Magento database owner's password. | +
| Tables Prefix | +(Optional.) Use only if you're installing the Magento database tables in a database instance that has Magento tables in it already. In that case, enter a prefix to identify the Magento tables for this installation. +Some customers have more than one Magento instance running on a server with all tables in the same database. This option enables those customers to share the database server with more than one Magento installation. + |
+

| Option | +Meaning | +
|---|---|
| Base URL | +Enter the base URL to use to access the Magento Admin Panel and your Magento web store. | +
| Admin Path | +Enter the path to access the Admin Panel. This path is appended to Base URL. + For example, if Base URL is http://www.example.com and Admin Path is admin, the Admin Panel's URL is http://www.example.com/admin—provided you configured your web server for server rewrites. |
+
| Enable Charts | +Select the checkbox to display charts on the Admin Panel. | +
| Skip Base URL Validation Before the Next Step | +Clearing this checkbox validates your server's base URL by performing an HTTP GET. Clear this checkbox unless your web server's base URL is not verifiable; for example, in a development or test environment. | +
| Use Web Server (Apache) Rewrites | +Select this checkbox to enable the use of the Apache mod_rewrite module. You can select this checkbox only if you configured Apache to use server rewrites. |
+
| Use Secure URLs (SSL) | +Select this checkbox only if your web server supports SSL. | +

[your Magento install dir]/var/session directory.| Option | +Meaning | +
|---|---|
| First Name | +Enter the first name of the user you want to identify as the Magento web store owner. | +
| Last Name | +Enter the user's last name. | +
| Enter the user's email address. | +|
| Username | +Enter the Magento Admin Panel administrator's username. (You can create additional Magento administrators later.) | +
| Password | +Enter the user's password. | +
| Confirm Password | +Enter the user's password again for verification. | +
| Encryption Key | +If you have one, enter a key to encrypt sensitive data in the Magento database. If you don't have one, Magento generates one for you. + The encryption key is stored in [your Magento install dir]/app/etc/local.xml. |
+


To make sure Magento installed properly, you should log in to the Admin Panel to verify the Magento version.
+You can also import products into Magento or perform other tasks that verify you can write to the database.
+http://www.example.com/magento/admin+(The Admin Panel URL is a combination of the Base URL and Admin Path fields you entered when you installed Magento.

Congratulations! You successfully installed Magento!
+ +Several Magento features require at least one cronjob, which schedules activities to occur in the future. A partial list of these activities follows:
+Crontab files define tasks (cronjobs) that are performed at scheduled dates and times. Each user on a system has its own crontab file, and the cron daemon runs each cronjob as the user who owns the crontab. For Magento, this user is the web server.
+ +Magento recommends splitting your cronjob on two tasks in your crontab for best performance and completing your cronjobs without issues:
+malways mode) can take longer to execute and complete, skipping other cronjobs (mdefault mode) scheduled during the time that the indexer runs.mdefault scope may take longer to execute and complete, blocking others scheduled during the time it is still running.To split your malways and mdefault cronjob modes, use the following:
* * * * * /path/to/magento/cron.sh cron.php -mdefault +* * * * * /path/to/magento/cron.sh cron.php -malways+ +
Determine which of your cronjobs may be long-running and move them into separate crontabs. For example, imports, exports, and indexes can run long, blocking other cronjobs scheduled in that crontab.
+ +Magento recommends running cron every minute for EE and every five minutes for CE.
+ +First, determine your web server's user. SSH into the server and enter the following command:
+ps -o "user group command" -C httpd,apache2+
In CentOS, the Apache user is typically apache. In Ubuntu, it's typically www-data. Enter this user in the commands for creating the crontabs and cronjobs.
We recommend splitting the cronjob between two tasks to prevent the indexer blocking other mdefault jobs or an mdefault job blocking the indexer. These instructions include these commands.
To create a cronjob as the user that runs Apache:
+crontab -u apache-user-name -e
* * * * * /bin/sh /path/to/magento/cron.sh cron.php -mdefault +* * * * * /bin/sh /path/to/magento/cron.sh cron.php -malways
* * * * * /bin/sh /var/www/html/magento/cron.sh cron.php -mdefault +* * * * * /bin/sh /var/www/html/magento/cron.sh cron.php -malways
* * * * * /bin/sh /path/to/magento/cron.sh
* * * * * /bin/sh /var/www/html/magento/cron.sh
:wp.To check if crons are running, you should see the following log files in the Magento directory about 10 minutes after the scheduled cron runs:
+./cron.php.log +./cron.sh.log ++ +
To secure your Magento installation after the installation, see After You Install Magento: Recommended File System Ownership and Privileges.
+ +This section discusses some suggestions for issues you might encounter when installing Magento.
+| Issue | +Suggested solution | +
|---|---|
| During the installation, errors like the following display: + Path "/var/www/html/magento/app/etc" must be writable. |
+ Set privileges and ownership on the Magento installation directory and subdirectories as discussed in Setting File and Directory Ownership and Privileges. | +
| You never advance past the installer's Configuration page. | +Try selecting the Skip Base URL Validation Before the Next Step checkbox. If problems persist, get help. | +
+{% include v1x/eol_message.html %}
+
+
+This article discusses how to install required prerequisite software for CentOS. You must complete these tasks before you install Magento CE 1.8 or later or Magento EE 1.13 or later.
+Before you continue, make sure you familiarize yourself with the installation process discussed in Prerequisites.
+root privileges.It's a good practice to update your repositories and optionally update system software.
+Update repositories:
+yum -y update+
Optionally upgrade software. This might cause a system reboot.
+yum -y upgrade+ +
Magento requires Apache use server rewrites. You must also specify the type of directives that can be used in .htaccess, which Magento uses to specify rewrite rules.
Installing and configuring Apache is basically a three-step process: install the software, enable rewrites, and specify .htaccess directives.
Install Apache 2 if you haven't already done so.
+yum -y install httpd+ +
httpd.conf for editing.
+ vim /etc/httpd/conf/httpd.conf
<Directory /var/www/html>
AllowOverride to All.httpd.conf and exit the text editor.service httpd restart
Magento CE and EE support the following PHP versions:
+We recommend you use the most recent PHP version supported by your version of Magento. For example, you should use PHP 5.5 with CE 1.9.1 or EE 1.14.1.
+For more information about PHP, see:
+ +Check with a system administrator or reference for your version of CentOS to see what PHP versions are available.
+If you're installing Magento CE 1.9.1 or Magento EE 1.14.1, you can use PHP 5.5; otherwise, we recommend PHP 5.4. For certain versions of CE and EE, a patch is required to use PHP 5.4.
+Enter the following command to see what version of PHP is currently running:
+php -v+
See one of the following sections for more information:
+ + +CentOS 6.x repositories have PHP 5.3. This section assumes you use either PHP 5.4 or 5.5. Make sure you understand which version of Magento CE or EE supports the PHP version to which you upgrade.
+Before you start, verify you have PHP 5.3 installed:
+php -v+
If you already have the desired PHP version installed, you don't have to do anything.
+If PHP is not installed, install PHP 5.3 using the following command:
+yum -y install php php-xml+
Continue with one of the following sections.
+There is more than one way to upgrade CentOS 6.5 to PHP 5.5; the following is a suggestion only. Consult a reference for additional options.
+Enter the following commands in the order shown.
+cd /tmp +rpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm +yum -y remove php-common-5.3.3-40.el6_6.x86_64 +yum -y install php55w php55w-opcache+
Skip the next section and continue with Installing Required PHP Extensions.
+ +Enter the following commands to upgrade to PHP 5.4:
+cd /tmp +rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm +rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm +yum --enablerepo=remi install httpd php php-common+
The following resources are also available:
+ + +The names of the PHP extensions you must install depend on the repository from which you installed PHP. Use one of the following commands:
+PHP 5.5:
+yum -y install php55w-xml php55w-mcrypt php55w-gd php55w-devel php55w-mysql php55w-mbstring+
PHP 5.4:
+yum -y install --enablerepo=remi php-mcrypt gd gd-devel php-gd php-mysql php54w-mbstring+ +
Increase memory_limit in php.ini to at least 512MB.
/etc/php.ini in a text editor.memory_limit to:
+ memory_limit = 512M
This section discusses how to install and configure MySQL 5.6. CentOS 6.x repositories have MySQL 5.1; to install a different version of MySQL, see the MySQL documentation.
+The following procedure is based on Install MySQL Server 5.6 in CentOS 6.x and Red Hat 6.x Linux.
+cd /tmp +wget http://repo.mysql.com/mysql-community-release-el6-5.noarch.rpm +rpm -ivh mysql-community-release-el6-5.noarch.rpm +yum -y install mysql-server
service mysqld start+
root user and set other security-related options. Enter the following command and follow the prompts on your screen to complete the configuration.
+ mysql_secure_installation
After installing the required prerequisite software, continue your installation with Preparing Your Server for Magento CE or EE.
+
+{% include v1x/eol_message.html %}
+
+
+This article discusses how to install required prerequisite software for Ubuntu. You must complete these tasks before you install Magento CE 1.8 or later or Magento EE 1.13 or later.
+Before you continue, make sure you familiarize yourself with the installation process discussed in Prerequisites.
+root privileges.It's a good practice to update your repositories and system software, if necessary.
+Log in to your Magento server as a user with root privileges and enter the commands shown in this section.
Update repositories:
+apt-get update+
Optionally upgrade software. This might require a system reboot.
+apt-get upgrade+ +
This section discusses how to install Apache. For more details, you can consult a reference like the Ubuntu site.
+Magento requires Apache use server rewrites. You must also specify the type of directives that can be used in .htaccess, which Magento uses to specify rewrite rules.
Installing and configuring Apache is basically a three-step process: install the software, enable rewrites, and specify .htaccess directives.
Install Apache 2 if you haven't already done so:
+apt-get -y install apache2+ +
Ubuntu 12 (which natively supports Apache 2.2) is different from Ubuntu 14 (which natively supports Apache 2.4).
+It's very important you choose a value for AllowOverride that is suited to your deployment. You can use AllowOverride All in development but it might not be desirable in production.
For more information, see one of the following references:
+ + +Use this section to enable Apache rewrites and specify .htaccess if you use Apache 2.2, which is supported by the default Ubuntu 12 repository.
vim /etc/apache2/sites-available/default
<Directory /var/www/> + Options Indexes FollowSymLinks MultiViews + AllowOverride None + Order allow,deny + allow from all +</Directory>
AllowOverride to [value from Apache site].
+<Directory /var/www/> + Options Indexes FollowSymLinks MultiViews + AllowOverride All + Order allow,deny + allow from all +</Directory>
mod_rewrite module.cd /etc/apache2/mods-enabled +ln -s ../mods-available/rewrite.load
service apache2 restart
Use this section to enable Apache rewrites and specify .htaccess if you use Apache 2.4, which is supported by the default Ubuntu 14 repository.
a2enmod rewrite
.htaccess./etc/apache2/sites-available/000-default.conf000-default.conf:<Directory "/var/www"> +AllowOverride [value from Apache site] +</Directory>+Note: You must change the value of
AllowOverride in the directive for the directory to which you expect to install the Magento software. For example, to install in the web server docroot, edit the directive in <Directory /var/www>.service apache2 restartMagento CE and EE support the following PHP versions:
+We recommend you use the most recent PHP version supported by your version of Magento. For example, you should use PHP 5.5 with CE 1.9.1 or EE 1.14.1.
+For more information about PHP, see:
+ +Check with a system administrator or reference for your version of Ubuntu to see what PHP versions are available.
+If you're installing Magento CE 1.9.1 or Magento EE 1.14.1, you can use PHP 5.5; otherwise, we recommend PHP 5.4. For certain versions of CE and EE, a patch is required to use PHP 5.4.
+Enter the following command to see what version of PHP is currently running:
+php -v+
See one of the following sections for more information:
+To upgrade your version of PHP, see one of the following:
+ + +See one of the following sections:
+ + +Use the following commands from dev-metal:
+add-apt-repository ppa:ondrej/php5 +apt-get update +sudo apt-get install php5+ +
Use the following commands from askubuntu:
+add-apt-repository ppa:ondrej/php5-oldstable +apt-get update +apt-get upgrade +apt-get install php5+ +
Enter the following command:
+apt-get -y install php5+ +
Enter the following command to install PHP extensions required by Magento:
+apt-get -y install php5 php5-mhash php5-mcrypt php5-curl php5-cli php5-mysql php5-gd libapache2-mod-php5+ +
Increase memory_limit in php.ini to at least 512MB:
/etc/php5/apache2/php.ini in a text editor.memory_limit to:
+memory_limit = 512M
Magento CE and EE support the following MySQL versions:
+Install the MySQL database:
+apt-get -y install mysql-client mysql-server+ +
Only Magento CE 1.9.1 and EE 1.14.1 support MySQL 5.6. To install MySQL 5.6 on Ubuntu 14, see Installing MySQL 5.6 on Ubuntu 14. To install MySQL 5.6 on Ubuntu 12, see the next section.
+ +To install MySQL 5.6 on Ubuntu 12, enter the following commands in the order shown:
+apt-add-repository ppa:ondrej/mysql-5.6 +apt-get -y update +apt-get -y install mysql-server+
Test the installation by entering the following command:
+mysql -u root -p+
Messages similar to the following display:
+Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 43 +Server version: 5.6.21-1+deb.sury.org~precise+1 (Ubuntu) + +Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +mysql>+ +
To install MySQL 5.6 on Ubuntu 14, enter the following command:
+apt-get -y install mysql-server-5.6 mysql-client-5.6+
Test the installation by entering the following command:
+Welcome to the MySQL monitor. Commands end with ; or \g. +Your MySQL connection id is 45 +Server version: 5.6.19-0ubuntu0.14.04.1 (Ubuntu) + +Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + +Oracle is a registered trademark of Oracle Corporation and/or its +affiliates. Other names may be trademarks of their respective +owners. + +Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. + +mysql>+ + +
After installing the required prerequisite software, continue your installation with Preparing Your Server for Magento CE or EE.
+ +
+{% include v1x/eol_message.html %}
+
+Magento recommends you upgrade your installation using the following guidelines in a development or test environment, separate from your existing production environment:
+When you're ready to start your upgrade, see Upgrading to and Verifying Magento Community Edition 1.8 and Enterprise Edition 1.13 - Part 2.
+
+{% include v1x/eol_message.html %}
+
+This article discusses how you upgrade to:
+Because of changes to URL rewrites, the following upgrades are more complex than other upgrades.
+This section discusses how to get ready for your upgrade by backing up the database and customizations on the file system. The steps that follow do not affect your current production system. You can continue serving customers with no downtime.
+To get ready for your upgrade:
+Complete the tasks discussed in the following sections in the order shown:
+Before you start your upgrade, you should enable exception logging so it will be enabled on the development system. Without exception logging, it will be more difficult to diagnose errors during your upgrade. You can disable exception logging after you've exported the Magento database.
+To enable exception logging:
+
Before upgrading to EE 1.13.0.2 or later, disable all running cron jobs. A simple way to stop cron jobs follows; consult an appropriate reference for other options.
+As a user with root privileges, enter one of the following commands:
service crond stopservice cron stopThis section applies to upgrading Magento EE only. Skip this section if you're using Magento CE.
+Because of the changes to indexing in Magento EE 1.13, you must set all indexers to update on save before you upgrade; otherwise, unpredictable performance will result. You can revert indexer settings after you've exported the Magento database.
+To set indexers to update on save:
+

Clear the Magento cache as follows:
+Back up your database using mysqldump or another tool. mysqldump syntax follows:
mysqldump -u root magento-database-name > export-file-name.sql+ +
To archive your custom themes and extensions:
+media directory and all subdirectories. For example,cd [your Magento install dir] +tar -czf media.tgz media
[your Magento install dir]/app/design/frontend +[your Magento install dir]/skin/frontend
[your Magento install dir]/app/code/local +[your Magento install dir]/app/code/community
[your Magento install dir]/app/etc/local.xml to your development environment.After you've exported the Magento database and extensions, you can revert the configuration changes you made as discussed in these sections:
+ + +In your development environment:
+magento subdirectory of that directory.magento subdirectory so if you want your Magento installation directory to be /var/www/magento, you don't need to do anything.magento using the following commands:mysql -u root -p+Enter the remaining commands at the
mysql> prompt
+create database magento; +GRANT USAGE ON *.* TO magento@localhost IDENTIFIED BY 'magento'; +GRANT ALL ON magento.* TO magento@localhost;+For MySQL versions later than 5.0.2 but earlier than 5.1.6, the following command is required: +
GRANT SUPER ON *.* TO 'magento'@'localhost';+Exit the MySQL command shell: +
exit+Verify the database exists using the following command: +
mysql -u magento -p magento+If an error displays, repeat the commands. If the command succeeded, enter
exit to return to the command prompt.getenforceEnforcing displays to confirm that SELinux is running.setsebool -P httpd_can_network_connect=1+Ubuntu +
setsebool -P apache2_can_network_connect=1
PHP 5.3 is currently the latest PHP version available in the default repositories for Ubuntu and CentOS. PHP 5.3 works with CE 1.8, CE 1.9, EE 1.13, and EE 1.14.
+We recommend PHP 5.4 for all of the preceding CE and EE versions because of the new features and changes in that release.
+CE 1.8 and EE 1.13 both require a PHP 5.4 patch. The patch is listed as PHP 5.4 Compatibility in the EE support portal.
+ +Use the instructions on phpave.
+ +Enter the following commands in the order shown as a user with root privileges:
cd /tmp +rpm -Uvh http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm +rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm +yum --enablerepo=remi install httpd php php-common+
The following resources are also available:
+ + +Upgrade your Magento installation by completing all of the following tasks in the order shown:
+Before attempting your Magento upgrade, complete all the tasks discussed in:
+ + +This section discusses how to extract the Magento archive in your development system and manually copy over your customizations, themes, and extensions.
+/var/www/magento, copy the archive to /var/www.tar -zxf archive-namemedia archive, overwriting the installation archive. You created the media archive as discussed in Getting Ready For Your Upgrade.media directory and all subdirectories. If you copy the media archive to the Magento installation directory on your development system, extracting it automatically replaces existing media subdirectory contents.media directory and subdirectories to media directory in your new Magento installation, overwriting the existing contents.[your Magento install dir]/app/design/frontend and [your Magento install dir]/skin/frontend directories, as appropriate, overwriting the existing contents.[your Magento install dir]/app/code/local and [your Magento install dir]/app/code/community directories, as appropriate, overwriting the existing contents.This section discusses how to:
+web/unsecure/base_url and web/secure/base_url in the core_config_data table to the development server's IP address or hostname.Import the production database data using your database manager tool.
+mysql syntax follows:
mysql -u root -p database-name < database-export-filename.sql+For example, if the database name is
magento and the database export file name is mangento-db-export.sql, enter
+mysql -u root -p magento < mangento-db-export.sql+
The following sections discuss how to change the base URL paths from http://prod.example.com to http://dev.example.com using SQL commands and phpmyadmin:
This section discusses how to update the secure and unsecure URLs of your webstores and store views in the Magento database. The following example assumes you have two URLs, which every Magento installation has by default. Depending on your setup, you could have more (for additional store views, Content Delivery Networks (CDNs) and so on.
+Use the following procedure to update all matching URLs in the database.
+To update the database with the development system's base URLs using SQL commands:
+mysql -u root -p+Enter the remaining commands at the mysql> prompt. +
use magento-db-name; +SELECT * FROM core_config_data WHERE path LIKE '%base_url%';
web/unsecure/base_url and web/secure/base_url.config_id for these rows.web/unsecure/base_url and web/secure/base_url:
+UPDATE core_config_data SET value='base-url' WHERE config_id=id1 or config_id=id2;+Example 1—
config_ids are the same: if your base URL is http://dev.example.com/, the config_id of the row containing web/unsecure/base_url is 354 and the config_id of the row containing web/secure/base_url is 355, enter:
+UPDATE core_config_data SET value='http://dev.example.com/' WHERE config_id=354 or config_id=355;+Example 2—
config_ids are different: Same as preceding example except that web/secure/base_url uses https://
+UPDATE core_config_data SET value='http://dev.example.com/' WHERE config_id=354; +UPDATE core_config_data SET value='https://dev.example.com/' WHERE config_id=355;
SELECT * FROM core_config_data WHERE path LIKE '%base_url%';
http://prod.example.com/view1/+Make sure to update the URL like the following: +
UPDATE core_config_data SET value='http://dev.example.com/view1/' WHERE config_id=377;
SELECT * FROM core_config_data WHERE path LIKE '%base_url%';
exit at the mysql> prompt and continue with Finishing the File System.This section discusses how to use phpmyadmin to change the values of the paths web/unsecure/base_url and web/secure/base_url in the core_config_data table to the development server's IP address or hostname.
dev-web-server-host-or-ip/phpmyadmin
+For example, if your web server address is http://dev.example.com, enter
+http://dev.example.com/phpmyadminroot user.%base_url% in the Value field.

web/unsecure/base_url.
+web/secure/base_url.This section applies to upgrading to EE 1.14.0.0 using the Solr search engine only. If you're upgrading to a different version—or if you're not using Solr—skip this section and continue with Finishing the File System.
+Because of changes to the Solr schema, you must copy two files from Magento to your Solr installation. Failure to do so might prevent products from displaying on your web store. After copying the files, you must also reindex the catalog search index.
+To update Solr:
+[your Magento install dir]/lib/Apache/Solr/conf/schema.xml +[your Magento install dir]/lib/Apache/Solr/conf/solrconfig.xml+
For example, if Magento is installed in /var/www/html/magento and the example Solr configuration is installed in the /etc/solr/apache-solr-3.6.2/example/solr/conf directory on the same host, enter:
cp /var/www/html/magento/lib/Apache/Solr/conf/solrconfig.xml /etc/solr/apache-solr-3.6.2/example/solr/conf +cp /var/www/html/magento/lib/Apache/Solr/conf/schema.xml /etc/solr/apache-solr-3.6.2/example/solr/conf
shell subdirectory of your Magento installation directory.cd /var/www/html/magento/shell
php indexer.php --reindex catalogsearch_fulltext
This section discusses how to edit copy local.xml and set file system permissions and ownership on the production system.
local.xml to [your Magento install dir]/app/etc.local.xml in a text editor.default_setup element, as follows:
+<default_setup> + <connection> + <host><![CDATA[change-if-necessary]]></host> + <username><![CDATA[change-if-necessary]]></username> + <password><![CDATA[change-if-necessary]]></password> + <dbname><![CDATA[change-if-necessary]]></dbname> + <initStatements><![CDATA[SET NAMES utf8]]></initStatements> + <model><![CDATA[mysql4]]></model> + <type><![CDATA[pdo_mysql]]></type> + <pdoType><![CDATA[]]></pdoType> + <active>1</active> + </connection> +</default_setup>
local.xml and exit the text editor.Magento recommends the following ownership and privilege settings for files and directories in the Magento installation directory:
+root).drwx------).-rw-------).Note: The way you set permissions and ownership depends on whether Magento is running on a dedicated or hosted system:
+root. The web server typically runs as an ordinary user. Magento assumes you log in as this user to start and stop the web server and that you already own all the files and directories in the Magento installation directory. You can use chmod to change permissions on files and directories.root and, as root, you can use the chown and chmod commands to set ownership and privileges in the Magento installation directory.To set privileges and ownership:
+#Ubuntu example +cd /var/www/magento + +#CentOS example +cd /var/www/html/magento
chown -R web-server-user-name .+For example, on Ubuntu where Apache usually runs as
www-data, enter
+chown -R www-data .
find . -type d -exec chmod 700 {} +
+find . -type f -exec chmod 600 {} +If you're upgrading to EE 1.14 from EE 1.13.0.0 or 1.13.0.1, see EE 1.13.1.0 Upgrade: Running the EE 1.13.0.0 or EE 1.13.0.1 URL Redirect Script now. When you're done, return here to continue your upgrade.
+ +To complete the upgrade, go to your Magento base URL in a web browser. The first time you go to your Magento base URL, server-side scripts run to update the database. Depending on the amount of data in your database, this process can take a long time.
+If you're upgrading from a version earlier than CE 1.4 or EE 1.7, Magento strongly recommends the two-step upgrade approach discussed in Upgrade Path. In addition, you should expect the upgrade and testing process to take a long time and to expect more downtime for your production system.
+Complete the following tasks in the order shown:
+The first step in your upgrade is to run server-side upgrade scripts. Depending on the nature of your customizations and extensions, and how many customers and products are in your database, these scripts can take a long time to run and can result in exceptions. You must resolve all exceptions before continuing to the next step in the process.
+This step in the upgrade process is iterative; that is, you'll probably run through it more than once.
+To run the upgrade scripts:
+[your Magento install dir]/var/log.var/ subdirectories:
+rm -rf [your Magento install dir]/var/cache [your Magento install dir]/var/full_page_cache \ + [your Magento install dir]/var/locks [your Magento install dir]/var/session+
This section applies to upgrading from 1.13.0.1 only. If you're upgrading CE or if you're upgrading from a different EE version, continue with Setting Up the Magento Cron Job.
+After successfully running the Magento upgrade and fixing errors, enter the following command from the Magento root directory:
+php -f shell/indexer.php -- --reindexall+
This command runs a full reindex and it might take a long time, depending on the size of your database.
+After the reindex completes, enter the following command from your Magento installation directory:
+rm -rf var/cache var/full_page_cache var/locks+
Continue with Setting Up Magento Cron Jobs.
+ +If you're upgrading to EE 1.14 from EE 1.12 or earlier, see EE 1.14 Upgrade: Running the EE 1.12 and Earlier URL Redirect Script now. When you're done, return here to continue your upgrade.
+ + +You should now set up your Magento cron job as discussed here.
+ +Run the following command to clean the Magento var/ subdirectories:
rm -rf [your Magento install dir]/var/cache [your Magento install dir]/var/full_page_cache [your Magento install dir]/var/locks+
After the cron job runs, all indexers should be in a Ready status. Before testing your upgrade, verify all indexers are Ready; otherwise, your testing will be inconclusive.
+To verify the status of indexers:
+
| Indexer status | +Suggested action | +
|---|---|
| Scheduled | +Wait for cron to finish or run http://magento-host-name/cron.php from a web browser. |
+
| Processing | +Wait for cron to finish or run If indexers are Processing for an extended period of time, run the command discussed in Clearing Magento var/ Subdirectories and refresh the Index Management page. |
+
After you have upgraded with no fatal errors or exceptions, Magento strongly recommends you thoroughly test the upgrade in your development environment as follows:
+The last step in upgrading is to take your production system offline and switching to your development system—which then becomes the production system from that point on.
+To switch from your production to development system:
+[your Magento install dir]/maintenance.flag.The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.Congratulations! You successfully upgraded! Review our welcome page to see the improvements you're getting.
+ +To secure your Magento installation after the upgrade, see After You Install Magento: Recommended File System Ownership and Privileges.
+ +There is a known issue after upgrading to EE 1.13.1 that affects you only if you do not follow the recommended procedure to upgrade to a new environment as discussed in Getting Ready For Your Upgrade.
+Symptom: After completing the upgrade, when you log in to the Admin Panel and click System > Configuration, a fatal error similar to the following displays in your browser:
+Class 'Mage_Googlecheckout_Helper_Data' not found in /var/www/html/magento/app/Mage.php on line 547+ +
Solution:
+root privileges, delete all files except config.xml from the following directory:[your Magento install dir]/app/code/core/Mage/GoogleCheckout/etc
In the event of any other issue during the upgrade, see Getting Help With Your Installation or Upgrade.
+ + + \ No newline at end of file diff --git a/guides/v1.8/install/installing_upgrade_from-ee112.html b/guides/v1.8/install/installing_upgrade_from-ee112.html new file mode 100644 index 0000000000..772e5a139d --- /dev/null +++ b/guides/v1.8/install/installing_upgrade_from-ee112.html @@ -0,0 +1,173 @@ +--- +--- + + + + + + + + + + + + + +
+{% include v1x/eol_message.html %}
+
+This article is part of the Magento Enterprise Edition (EE) upgrade documentation. If you're looking for something else, click here to go back to the Magento Knowledge Base.
+This article applies to the following Magento EE upgrades:
+If your upgrade is not in the preceding list, go back to Upgrading to and Verifying Magento Community Edition (CE) 1.8 and Enterprise Edition (EE) 1.13.
+This article discusses how to run the URL redirect script that creates HTTP 301 (Moved Permanently) redirects for any duplicate product URL keys. This enables Previous links in your web store to work, for example.
+ +To create redirects for your URLs, perform the following tasks in the order shown:
+It's very important to stop cron jobs from running until after the upgrade script completes. To do so, enter one of the following commands as a user with root privileges:
service crond stopservice cron stopTo change indexer settings:
+
This section discusses how to run the URL redirect script to create permanent redirects for any URLs that changed in EE 1.13.1.0.
+To run the script:
+root or the web server user), enter the following command:php -f shell/url_migration_to_1_13.php - thread-count+where
php -f shell/url_migration_to_1_13.php 7+
[INFO]: Initialization... +[INFO]: Renaming conflicting entities... +100% [#################################################################################] +[INFO]: Creating redirects from previous version... +100% [#################################################################################] +ETA HH:MM:SS
watch -n1 "ps ax | grep umt | grep -v grep"+This command helps you to determine if each thread behaves correctly. After each process finishes, a new process should start immediately. There should be no delays or "hangs" between processes.
If errors display, check [your Magento install dir]/shell/migration.log for exceptions and see the following table.
Troubleshooting
+| Symptom | +Suggested action | +
|---|---|
ERROR: Scope of attribute "url_key" is set to Global. This may cause DB inconsistency. Aborting. |
+ This error can be caused by either a product or category
|
+
| Other errors | +Try running the script again. If errors persist, contact Magento Support. | +
After successfully running the URL redirect script, enter the following command from the Magento root directory:
+php -f shell/indexer.php --reindexall+
This command runs a full reindex and it might take a long time, depending on the size of your database.
+After the reindex completes, enter the following command from your Magento installation directory:
+rm -rf var/cache var/full_page_cache var/locks+ +
As a result of running the URL redirect script, a list of redirects created for duplicate URL keys displays in the Admin Panel. To view these redirects:
+1.12.0.2-1.13.x migration redirect+The following figure shows an example.

Assuming all your post-upgrade issues are fixed, go to your web store and navigate the category tree. Click some products and make sure they display properly. Verify that all Previous and Back links work properly.
+ +Complete your upgrade:
+
+{% include v1x/eol_message.html %}
+
+This article is part of the Magento Enterprise Edition (EE) upgrade documentation. If you're looking for something else, click here to go back to the Magento Knowledge Base.
+This article applies to the following Magento EE upgrades:
+If your upgrade is not in the preceding list, skip this article and continue with Completing the Magento Upgrade.
+This article discusses how to run the URL redirect script that creates HTTP 301 (Moved Permanently) redirects for any duplicate product URL keys. This enables Previous links in your web store to work, for example.
+For more information about URL changes, see the EE 1.13.0.2 Release Notes. (Release Notes for the latest release are here.)
+To create redirects for your URLs, perform the following tasks in the order shown:
+ + +It's very important to stop cron jobs from running until after the upgrade script completes. To do so, enter one of the following commands as a user with root privileges:
+This section discusses how to run the URL redirect script to create permanent redirects for any URLs that changed in EE 1.13.1.0.
+Note: The time the script takes to run and the amount of memory it uses is directly proportional to the size of your database.
+To run the script:
+php -f shell/url_migration_from_1_13_0_0_to_1_13_0_2.php[INFO]: Initialization... +[INFO]: Start url rewrites processing from 1.13.0.0 to 1.13.0.2 ... +[INFO]: Start root category "Default Category" processing ... +[INFO]: Start root category "test" processing ... +[INFO]: Executed in time
Troubleshooting
+If errors display, check [your Magento install dir]/shell/migration.log for exceptions. Following are errors that might display when you run the migration script:
+If one of these displays, make sure you copied [your Magento install dir]/app/etc/local.xml from your development system to the production system. Edit it if necessary to reference the production database instance. After you copy and edit local.xml, run the URL redirect script again.
+Continue your upgrade with Completing the Magento Upgrade.
+
+{% include v1x/eol_message.html %}
+
+This article discusses how to upgrade to:
+The following table provides basic information about how you perform your upgrade. More detailed information is discussed later in this article.
+| Edition and version | +Upgrade path | +
|---|---|
| CE 1.4 or earlier | +Your current CE version > CE 1.7 > CE 1.9.0.0 | +
| CE 1.5 or later | +Your current CE version > CE 1.9.0.0 | +
| EE 1.7 or earlier | +Your current EE version > EE 1.12 > EE 1.14.0.0 | +
| EE 1.8 or later | +Your current EE version > EE 1.14.0.0 | +
Because of changes to URL rewrites, the upgrade to Magento EE 1.13.0.2 or later is more complex than other upgrades. (This includes upgrading to Magento EE 1.14.)
+Follow are the specific versions affected:
+For more information about these upgrades, see Understanding the Upgrade to EE 1.13.0.2 or EE 1.14.
+Unless you're upgrading from an older CE version, skip the remainder of this article and continue with Upgrade Roadmap for Community Edition (CE).
+ + +Provided you complete all tasks discussed in this article exactly as discussed, you can upgrade to Magento CE 1.9 or EE 1.14 from CE 1.5 or later or EE 1.8 or later.
+Important: Do not upgrade directly to this release if you're currently running CE 1.4 or earlier or EE 1.7 or earlier. A safer approach would be:
+To upgrade to CE 1.8, skip the remainder of this article and continue with Upgrading to and Verifying Magento Community Edition 1.8 and Enterprise Edition 1.13—Part 2.
+To upgrade from EE 1.13.0.2 to EE 1.13.1.0, skip the remainder of this article and continue with Upgrading to and Verifying Magento Community Edition 1.8 and Enterprise Edition 1.13—Part 2.
+ +The following sections apply only to the following Magento EE upgrades:
+This section discusses why the upgrade to EE 1.13.0.2 or later requires you to perform different tasks than previous upgrades.
+One of the results of the change to the way URL keys are handled is that URLs for the same products or categories might need to change from the URLs in the version you're upgrading from. Following are scenarios that might cause URL keys to change:
+nike-shoes, one of them is changed to a URL key like nike-shoes-1 by the URL redirect scripts. This also resolves any conflicts (for example, if you already had another product with key nike-shoes-1).shoes category with URL key shoes in English store view, schuhe in the German store view and schuhe in the Swiss store view, the upgrade scripts change one of the category's URL keys to something like schuhe-1.To ensure customers and search engines will be directed to the correct page, Magento provides a script that creates HTTP 301 (Moved Permanently) redirects for URLs that are changed.
+In other words, after the upgrade, all pre-upgrade URLs work but they might be different than they were before you upgraded.
+The way you upgrade depends on what EE version you're starting from. The following roadmaps provide a high-level overview of the upgrade process:
+ + +Following is a high-level roadmap to upgrade to EE 1.13.0.2 or later from EE 1.12 or earlier. This upgrade involves tasks not required for other Magento upgrades; these new tasks are indicated in the roadmap.
+media directory and subdirectories; all extensions and customizations; and all custom themes.media directory, extensions, themes, and other customizations to the development system.local.xml to [your Magento install dir]/app/etc and edit it if necessary to reference the production database instance.


cd [your Magento install dir] +php -f shell/url_migration_to_1_13.php - thread-count+thread-count is the number of CPU cores in your Magento server, minus 1, to a maximum of 15.

[your Magento install dir]/php -f shell/indexer.php -- --reindexall

[your Magento install dir]/var/cache /var/full_page_cache /var/locks
Step-by-step instructions for your upgrade start here.
+ +Following is a high-level roadmap to upgrade to EE 1.13.0.2 or later from EE 1.13.0.1. This upgrade involves tasks not required for other Magento upgrades; these new tasks are indicated in the roadmap.
+media directory and subdirectories; all extensions and customizations; and all custom themes.media directory, extensions, themes, and other customizations to the development system.local.xml to [your Magento install dir]/app/etc and edit it if necessary to reference the production database instance.

[your Magento install dir]/php -f shell/url_migration_from_1_13_0_0_to_1_13_0_2.php

[your Magento install dir]/php -f shell/indexer.php -- --reindexall

[your Magento install dir]/var/cache /var/full_page_cache /var/locks
Important:
+Step-by-step instructions for your upgrade start here.
+
+{% include v1x/eol_message.html %}
+
+
+
+by Alan Storm, updated for Magento 1.12
+ + + +What is Magento? It's the most powerful online eCommerce platform in the universe and is changing the face of eCommerce forever. :-)
+ +Of course, you already know that. What you may not realize is Magento's also an object-oriented PHP Framework that can be used to develop modern, dynamic web applications that tap into Magento's powerful eCommerce features.
+ +This is the first in a series of articles in which we're going to go on a whirlwind tour of Magento's programming framework features. Don't worry if you don't follow everything immediately. As you study the system more everything in this article will start to make sense, and you'll soon be the envy of your colleagues stuck working with more primitive PHP systems.
+ +Or for the more visually oriented Magento_MVC.pdf.
+ +Magento organizes its code into individual Modules. In a typical PHP Model-View-Controller (MVC) application, all the Controllers will be in one folder, all the Models in another, etc. In Magento, files are grouped together based on functionality, which are called modules in Magento.
+ +For example, you'll find Controllers, Models, Helpers, Blocks, etc. related to Magento's checkout functionality in
+app/code/core/Mage/Checkout+ +
You'll find Controllers, Models, Helpers, Blocks, etc. related to Magento's Google Checkout functionality in
+app/code/core/Mage/GoogleCheckout+ +
When you want to customize or extend Magento, rather than editing core files directly, or even placing your new Controllers, Models, Helpers, Blocks, etc. next to Magento code, you'll create your own Modules in
+app/code/local/Package/Modulename+ +
Package (also often referred to as a Namespace) is a unique name that identifies your company or organization. The intent is that each member of the world-wide Magento community will use their own Package name when creating modules in order to avoid colliding with another user's code.
+ +When you create a new Module, you need to tell Magento about it. This is done by adding an XML file to the folder:
+app/etc/modules+ +
There are two kinds of files in this folder, the first enables an individual Module, and is named in the form:
+Packagename_Modulename.xml + +The second is a file that will enable multiple Modules from a Package/Namespace, and is named in the form:
+Packagename_All.xml. Note it is only used by the core team with the file Mage_All.xml. It is not recommended to activate several modules in a single file, as this breaks the modularity of your modules. + + +Magento is a configuration-based MVC system. The alternative to this would a convention-based MVC system.
+ +In a convention-based MVC system, if you wanted to add, say, a new Controller or maybe a new Model, you'd just create the file/class, and the system would pick it up automatically.
+ +In a configuration-based system, like Magento, in addition to adding the new file/class to the codebase, you often need to explicitly tell the system about the new class, or new group of classes. In Magento, each Module has a file named config.xml. This file contains all the relevant configuration for a Magento Module. At runtime, all these files are loaded into one large configuration tree.
+ +For example, want to use Models in your custom Module? You'll need to add some code to config.xml that tells Magento you want to use Models, as well as what the base class name for all your Models should be.
+ ++ <models> + <packagename> + <class>Packagename_Modulename_Model</class> + </packagename> + </models> ++
The same goes for Helpers, Blocks, Routes for your Controllers, Event Handlers, and more. Almost anytime you want to tap into the power of the Magento system, you'll need to make some change or addition to your config file.
+ + +In any PHP system, the main PHP entry point remains a PHP file. Magento is no different, and that file is index.php.
+ +However, you never CODE in index.php. In an MVC system, index.php will contain code/calls to code that does the following:
+Examines the URL
Based on some set of rules, turns this URL into a Controller class and an Action method (called Routing)
Instantiates the Controller class and calls the Action method (called dispatching)
This means the practical entry point in Magento (or any MVC-based system) is a method in a Controller file. Consider the following URL:
+ +http://example.com/catalog/category/view/id/25+ +
Each portion of the path after the server name is parsed as follows.
+ +The first portion of the URL is called the front name. This, more or less, tells magento which Module it can find a Controller in. In the above example, the front name is catalog, which corresponds to the Module located at:
+app/code/core/Mage/Catalog+ +
The second portion of the URL tells Magento which Controller it should use. Each Module with Controllers has a special folder named 'controllers' which contains all the Controllers for a module. In the above example, the URL portion category is translated into the Controller file
+app/code/core/Mage/Catalog/controllers/CategoryController.php+ +
Which looks like
+
+class Mage_Catalog_CategoryController extends Mage_Core_Controller_Front_Action
+{
+}
+
+
+All Controllers in the Magento cart application extend from Mage_Core_Controller_Front_Action.
+ +Third in our URL is the action name. In our example, this is "view". The word "view" is used to create the Action Method. So, in our example, "view" would be turned into "viewAction"
+ +
+class Mage_Catalog_CategoryController extends Mage_Core_Controller_Front_Action
+{
+ public function viewAction()
+ {
+ //main entry point
+ }
+}
+
+
+People familiar with the Zend Framework will recognize the naming convention here.
+ +Any path portions after the action name will be considered key/value GET request variables. So, in our example, the "id/25" means there will get a GET variable named "id", with a value of "25".
+ +As previously mentioned, if you want your Module to use Controllers, you'll need to configure them. Below is the configuration chunk that enables Controllers for the Catalog Module
+ ++<frontend> + <routers> + <catalog> + <use>standard</use> + <args> + <module>Mage_Catalog</module> + <frontName>catalog</frontName> + </args> + </catalog> + </routers> +</frontend> ++ +
Don't worry too much about the specifics right now, but notice the
+ +<frontName>catalog</frontName> + + +This is what links a Module with a URL frontname. Most Magento core Modules choose a frontname that is the same as their Module name, but this is not required.
+ + +The routing described above is for the Magento cart application (often called the frontend). If Magento doesn't find a valid Controller/Action for a URL, it tries again, this time using a second set of Routing rules for the Admin application. If Magento doesn't find a valid Admin Controller/Action, it uses a special Controller named Mage_Cms_IndexController.
+ +The CMS Controller checks Magento's content Management system to see if there's any content that should be loaded. If it finds some, it loads it, otherwise the user will be presented with a 404 page.
+ +For example, the main magento "index" page is one that uses the CMS Controller, which can often throw newcomers for a loop.
+ + +Now that we're in our Action method entry point, we'll want to start instantiating classes that do things. Magento offers a special way to instantiate Models, Helpers and Blocks using static factory methods on the global Mage class. For example:
+ +
+Mage::getModel('catalog/product');
+Mage::helper('catalog/product');
+
+
+The string 'catalog/product' is called a Grouped Class Name. It's also often called a URI. The first portion of any Grouped Class Name (in this case, catalog), is used to lookup which Module the class resides in. The second portion ('product' above) is used to determine which class should be loaded.
+ +So, in both of the examples above, 'catalog' resolves to the Module app/code/core/Mage/Catalog.
+ +Meaning our class name will start with Mage_Catalog.
+ +Then, product is added to get the final class name
+ +
+Mage::getModel('catalog/product');
+Mage_Catalog_Model_Product
+
+Mage::helper('catalog/product');
+Mage_Catalog_Helper_Product
+
+
+These rules are bound by what's been setup in each Module's config file. When you create your own custom Module, you'll have your own grouped classnames (also calles classgroups) to work with Mage::getModel('myspecialprefix/modelname');.
+ +You don't have to use Grouped Class Names to instantiate your classes. However, as we'll learn later, there are certain advantages to doing so.
+ + + +Magento, like most frameworks these days, offers an Object Relational Mapping (ORM) system. ORMs get you out of the business of writing SQL and allow you to manipulate a datastore purely through PHP code. For example:
+ +
+$model = Mage::getModel('catalog/product')->load(27);
+$price = $model->getPrice();
+$price += 5;
+$model->setPrice($price)->setSku('SK83293432');
+$model->save();
+
+
+In the above example we're calling the methods "getPrice" and "setPrice" on our Product. However, the Mage_Catalog_Model_Product class has no methods with these names. That's because Magento's ORM uses PHP's magic __call method to implement getters and setters.
+ +Calling the method $product->getPrice(); will "get" the Model attribute "price".
+ +Calling $product->setPrice(); will "set" the Model attribute "price". All of this assumes the Model class doesn't already have methods named getPrice or setPrice. If it does, the magic methods will be bypassed. If you're interested in the implementation of this, checkout the Varien_Object class, which all Models inherit from.
+ +If you wanted to get all the available data on a Model, call $product->getData(); to get an array of all the attributes.
+ +You'll also notice it's possible to chain together several calls to the set method:
+$model->setPrice($price)->setSku('SK83293432'); + +That's because each set method returns an instance of the Model. This is a pattern you'll see used in much of the Magento codebase.
+ +Magento's ORM also contains a way to query for multiple Objects via a Collections interface. The following would get us a collection of all products that cost $5.00
+ +
+$products_collection = Mage::getModel('catalog/product')
+->getCollection()
+->addAttributeToSelect('*')
+->addFieldToFilter('price','5.00');
+
+
+Again, you'll notice Magento's implemented a chaining interface here. Collections use the PHP Standard Library to implement Objects that have array like properties.
+ +
+foreach($products_collection as $product)
+{
+ echo $product->getName();
+}
+
+
+You may be wondering what the "addAttributeToSelect" method is for. Magento has two broad types of Model objects. One is a traditional "One Object, One Table" Active Record style Model. When you instantiate these Models, all attributes are automatically selected.
+ +The second type of Model is an Entity Attribute Value (EAV) Model. EAV Models spread data across several different tables in the database. This gives the Magento system the flexibility to offer its flexible product attribute system without having to do a schema change each time you add an attribute. When creating a collection of EAV objects, Magento is conservative in the number of columns it will query for, so you can use addAttributeToSelect to get the columns you want, or addAttributeToSelect('*') to get all columns.
+ + +Magento's Helper classes contain utility methods that will allow you to perform common tasks on objects and variables. For example:
> +$helper = Mage::helper('catalog'); + +You'll notice we've left off the second part of the grouped class name. Each Module has a default Data Helper class. The following is equivalent to the above:
+$helper = Mage::helper('catalog/data'); + +Most Helpers inherit form Mage_Core_Helper_Abstract, which gives you several useful methods by default.
+
+$translated_output = $helper->__('Magento is Great'); //gettext style translations
+if($helper->isModuleOutputEnabled()): //is output for this module on or off?
+
+
+
+
+So, we've seen Controllers, Models, and Helpers. In a typical PHP MVC system, after we've manipulated our Models we would
+ +However, if you look at a typical Magento Controller action, you don't see any of this:
+ +
+/**
+ * View product gallery action
+ */
+public function galleryAction()
+{
+ if (!$this->_initProduct()) {
+ if (isset($_GET['store']) && !$this->getResponse()->isRedirect()) {
+ $this->_redirect('');
+ } elseif (!$this->getResponse()->isRedirect()) {
+ $this->_forward('noRoute');
+ }
+ return;
+ }
+ $this->loadLayout();
+ $this->renderLayout();
+}
+
+
+Instead, the Controller action ends with two calls
+ ++$this->loadLayout(); +$this->renderLayout(); ++ +
So, the "V" in Magento's MVC already differs from what you're probably used to, in that you need to explicitly kick off rendering the layout.
+ +The layout itself also differs. A Magento Layout is an object that contains a nested/tree collection of "Block" objects. Each Block object will render a specific bit of HTML. Block objects do this through a combination of PHP code, and including PHP .phtml template files.
+ +Blocks objects are meant to interact with the Magento system to retrieve data from Models, while the phtml template files will produce the HTML needed for a page.
+ +For example, the page header Block app/code/core/Mage/Page/Block/Html/Head.php uses the head.phtml file page/html/head.phtml.
+ +Another way of thinking about it is the Block classes are almost like little mini-controllers, and the .phtml files are the view.
+ +By default, when you call
+ ++$this->loadLayout(); +$this->renderLayout(); ++ +
Magento will load up a Layout with a skeleton site structure. There will be Structure Blocks to give you your html, head, and body, as well as HTML to setup single or multiple columns of Layout. Additionally, there will be a few Content Blocks for the navigation, default welcome message, etc.
+ +"Structure" and "Content" are arbitrary designations in the Layout system. A Block doesn't programmatically know if it's Structure or Content, but it's useful to think of a Block as one or the other.
+ +To add Content to this Layout you need to tell the Magento system something like
+ +"Hey, Magento, add these additional Blocks under the "content" Block of the skeleton"+ +or + +
"Hey, Magento, add these additional Blocks under the "left column" Block of the skeleton"+ +
This can be done programmatically in a Controller action
+ +
+public function indexAction()
+{
+ $this->loadLayout();
+ $block = $this->getLayout()->createBlock('adminhtml/system_account_edit')
+ $this->getLayout()->getBlock('content')->append($block);
+ $this->renderLayout();
+}
+
+
+but more commonly (at least in the frontend cart application), is use of the XML Layout system.
+ +The Layout XML files in a theme allow you, on a per Controller basis, to remove Blocks that would normally be rendered, or add Blocks to that default skeleton areas. For example, consider this Layout XML file:
+ ++<catalog_category_default> + <reference name="left"> + <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/> + </reference> +</catalog_category_default> ++ +
It's saying in the catalog Module, in the category Controller, and the default Action, insert the catalog/navigation Block into the "left" structure Block, using the catalog/navigation/left.phtml template.
+ +One last important thing about Blocks. You'll often see code in templates that looks like this:
+$this->getChildHtml('order_items') + +This is how a Block renders a nested Block. However, a Block can only render a child Block if the child Block is included as a nested Block in the Layout XML file. In the example above our catalog/navigation Block has no nested Blocks. This means any call to $this->getChildHtml() in left.phtml will render as blank.
+ +If, however, we had something like:
++<catalog_category_default> + <reference name="left"> + <block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"> + <block type="core/template" name="foobar" template="foo/baz/bar.phtml"/> + </block> + </reference> +</catalog_category_default> ++ +
From the catalog/navigation Block, we'd be able to call
+$this->getChildHtml('foobar');Like any good object-oriented system, Magento implements an Event/Observer pattern for end users to hook into. As certain actions happen during a Page request (a Model is saved, a user logs in, etc.), Magento will issue an event signal.
+ +When creating your own Modules, you can "listen" for these events. Say you wanted to get an email every time a certain customer logged into the store. You could listen for the "customer_login" event (setup in config.xml)
+ ++<events> + <customer_login> + <observers> + <unique_name> + <type>singleton</type> + <class>mymodule/observer</class> + <method>iSpyWithMyLittleEye</method> + </unique_name> + </observers> + </customer_login> +</events> ++ +
and then write some code that would run whenever a user logged in:
+ +
+class Packagename_Mymodule_Model_Observer
+{
+ public function iSpyWithMyLittleEye($observer)
+ {
+ $data = $observer->getData();
+ //code to check observer data for our user,
+ //and take some action goes here
+ }
+}
+
+
+
+Finally, the Magento System offers you the ability to replace Model, Helper and Block classes from the core modules with your own. This is a feature that's similar to "Duck Typing" or "Monkey Patching" in a language like Ruby or Python.
+ +Here's an example to help you understand. The Model class for a product is Mage_Catalog_Model_Product.
+ +Whenever the following code is called, a Mage_Catalog_Model_Product object is created
+ +$product = Mage::getModel('catalog/product');
+
+This is a factory pattern.
+ +What Magento's class override system does is allow you to tell the system
+ +"Hey, whenever anyone asks for a catalog/product, instead of giving them a Mage_Catalog_Model_Product, +give them a Packagename_Modulename_Model_Foobazproduct instead".+ +
Then, if you want, your Packagename_Modulename_Model_Foobazproduct class can extend the original product class
+ +
+class Packagename_Modulename_Model_Foobazproduct extends Mage_Catalog_Model_Product
+{
+}
+
+
+Which will allow you to change the behavior of any method on the class, but keep the functionality of the existing methods.
+ +class Packagename_Modulename_Model_Foobazproduct extends Mage_Catalog_Model_Product
+{
+ public function validate()
+ {
+ //add custom validation functionality here
+ return $this;
+ }
+
+}
+
+
+As you might expect, this overriding (or rewriting) is done in the config.xml file.
+ ++<models> + <!-- does the override for catalog/product--> + <catalog> + <rewrite> + <product>Packagename_Modulename_Model_Foobazproduct</product> + </rewrite> + </catalog> +</models> ++ +
One thing that's important to note here. Individual classes in your Module are overriding individual classes in other Modules. You are not, however, overriding the entire Module. This allows you to change specific method behavior without having to worry what the rest of the Module is doing.
+ + + +We hope you've enjoyed this whirlwind tour of some of the features the Magento eCommerce system offers to developers. It can be a little overwhelming at first, especially if this is your first experience with a modern, object-oriented PHP system. If you start to get frustrated, take a deep breath, remind yourself that this is new, and new things are hard, but at the end of the day it's just a different way of coding. Once you get over the learning curve you'll find yourself loath to return to other, less powerful systems.
+ +
+{% include v1x/eol_message.html %}
+
+by Alan Storm, updated for Magento 1.12
+ + + + + +The config is the beating heart of the Magento System. It describes, in whole, almost any module, model, class, template, etc. than you'll need to access. It's a level of abstraction that most PHP developers aren't used to working with, and while it adds development time in the form of confusion and head scratching, it also allows you an unprecedented amount of flexibility as far as overriding default system behaviors go.
+ +To start with, we're going to create a Magento module that will let us view the system config in our web browser. Follow along by copying and pasting the code below, it's worth going through on your own as a way to start getting comfortable with things you'll be doing while working with Magento, as well as learning key terminology.
+ +We're going to be creating a Magento module. A module is a group of php and xml files meant to extend the system with new functionality, or override core system behavior. This may meaning adding additional data models to track sales information, changing the behavior of existing classes, or adding entirely new features.
+ +It's worth noting that most of the base Magento system is built using the same module system you'll be using. If you look in
+ +app/code/core/Mage+ +
each folder is a separate module built by the Magento team. Together, these modules form the community shopping cart system you're using. Your modules should be placed in the following folder
+ +app/code/local/Packagename+ +
"Packagename" should be a unique string to Namespace/Package your code. It's an unofficial convention that this should be the name of your company. The idea is to pick a string that no one else in the world could possibly be using.
+ +app/code/local/Microsoft+ +
We'll use "Magentotutorial".
+ +So, to add a module to your Magento system, create the following directory structure
+ +app/code/local/Magentotutorial/Configviewer/Block +app/code/local/Magentotutorial/Configviewer/controllers +app/code/local/Magentotutorial/Configviewer/etc +app/code/local/Magentotutorial/Configviewer/Helper +app/code/local/Magentotutorial/Configviewer/Model +app/code/local/Magentotutorial/Configviewer/sql+ +
You won't need all these folder for every module, but setting them all up now is a smart idea.
+ +Next, there's two files you'll need to create. The first, config.xml, goes in the etc folder you just created.
+ +app/code/local/Magentotutorial/Configviewer/etc/config.xml+ +
The second file should be created at the following location
+ +app/etc/modules/Magentotutorial_Configviewer.xml+ +
The naming convention for this files is Packagename_Modulename.xml.
+ +The config.xml file should contain the following XML. Don't worry too much about what all this does for now, we'll get there eventually
+ ++<config> + <modules> + <Magentotutorial_Configviewer> + <version>0.1.0</version> + </Magentotutorial_Configviewer> + </modules> +</config> ++ +
Finally, Magentotutorial_Configviewer.xml should contain the following xml.
+ ++<config> + <modules> + <Magentotutorial_Configviewer> + <active>true</active> + <codePool>local</codePool> + </Magentotutorial_Configviewer> + </modules> +</config> ++ +
That's it. You now have a bare bones module that won't do anything, but that Magento will be aware of. To make sure you've done everything right, do the following: +
Congratulations, you've built your first Magento module!
+ + +Of course, this module doesn't do anything yet. When we're done, our module will +
First, we're going to add the following <global> section to our config.xml file.
+ ++<config> + <modules>...</modules> + <global> + <events> + <controller_front_init_routers> + <observers> + <Magentotutorial_configviewer_model_observer> + <type>singleton</type> + <class>Magentotutorial_Configviewer_Model_Observer</class> + <method>checkForConfigRequest</method> + </Magentotutorial_configviewer_model_observer> + </observers> + </controller_front_init_routers> + </events> + </global> +</config> ++ +
Then, create a file at
+ +Magentotutorial/Configviewer/Model/Observer.php+ +
and place the following code inside
+ +
+<?php
+ class Magentotutorial_Configviewer_Model_Observer {
+ const FLAG_SHOW_CONFIG = 'showConfig';
+ const FLAG_SHOW_CONFIG_FORMAT = 'showConfigFormat';
+
+ private $request;
+
+ public function checkForConfigRequest($observer) {
+ $this->request = $observer->getEvent()->getData('front')->getRequest();
+ if($this->request->{self::FLAG_SHOW_CONFIG} === 'true'){
+ $this->setHeader();
+ $this->outputConfig();
+ }
+ }
+
+ private function setHeader() {
+ $format = isset($this->request->{self::FLAG_SHOW_CONFIG_FORMAT}) ?
+ $this->request->{self::FLAG_SHOW_CONFIG_FORMAT} : 'xml';
+ switch($format){
+ case 'text':
+ header("Content-Type: text/plain");
+ break;
+ default:
+ header("Content-Type: text/xml");
+ }
+ }
+
+ private function outputConfig() {
+ die(Mage::app()->getConfig()->getNode()->asXML());
+ }
+ }
+
+
+That's it. Clear your Magento cache again and then load any Magento URL with a showConfig=true query string
+ +http://magento.example.com/?showConfig=true+ + +
You should be looking at a giant XML file. This describes the state of your Magento system. It lists all modules, models, classes, event listeners or almost anything else you could think of.
+ +For example, consider the config.xml file you created above. If you search the XML file in your browser for the text Configviewer_Model_Observer you'll find your class listed. Every module's config.xml file is parsed by Magento and included in the global config.
+ + +Right now this may seem esoteric, but this config is key to understanding Magento. Every module you'll be creating will add to this config, and anytime you need to access a piece of core system functionality, Magento will be referring back to the config to look something up.
+ +A quick example: As an MVC developer, you've likely worked with some kind of helper class, instantiated something like
+ ++$helper_sales = new HelperSales(); ++ +
One of the things Magento has done is abstract away PHP's class declaration. In Magento, the above code looks something like
+ +
+$helper_sales = Mage::helper('sales');
+
+
+In plain english, the static helper method will: +
While this seems like a lot of work (and it is), the key advantage is by always looking to the config file for class names, we can override core Magento functionality without changing or adding to the core code. This level of meta programming, not usually found in PHP, allows you to cleanly extend only the parts of the system you need to.
diff --git a/guides/v1.8/magefordev/mage-for-dev-3.html b/guides/v1.8/magefordev/mage-for-dev-3.html new file mode 100644 index 0000000000..3376414223 --- /dev/null +++ b/guides/v1.8/magefordev/mage-for-dev-3.html @@ -0,0 +1,318 @@ +--- +--- + + + + + + + + + +
+{% include v1x/eol_message.html %}
+
+
+
+by Alan Storm, updated for Magento 1.12
+ + +The Model-View-Controller (MVC) architecture traces its origins back to the Smalltalk Programming language and Xerox Parc. Since then, there have been many systems that describe their architecture as MVC. Each system is slightly different, but all have the goal of separating data access, business logic, and user-interface code from one another.
+ +The architecture of most PHP MVC frameworks will looks something like this.
+ +While this pattern was a great leap forward from the "each php file is a page" pattern established early on, for some software engineers, it's still an ugly hack. Common complaints are:
+ +As you've probably guessed, the Magento team shares this world view and has created a more abstract MVC pattern that looks something like this:. + +
We'll eventually touch on each part of this request, but for now we're concerned with the Front Controller -> Routers -> Action Controller section. + +
Enough theory, it's time for Hello World. We're going to
+First, we'll create a directory structure for this module. Our directory structure should look as follows: + +
app/code/local/Magentotutorial/Helloworld/Block +app/code/local/Magentotutorial/Helloworld/controllers +app/code/local/Magentotutorial/Helloworld/etc +app/code/local/Magentotutorial/Helloworld/Helper +app/code/local/Magentotutorial/Helloworld/Model +app/code/local/Magentotutorial/Helloworld/sql ++ +
Then create a configuration file for the module (at path app/code/local/Magentotutorial/Helloworld/etc/config.xml): +
+<config> + <modules> + <Magentotutorial_Helloworld> + <version>0.1.0</version> + </Magentotutorial_Helloworld> + </modules> +</config> ++ +
Then create a file to activate the module (at path app/etc/modules/Magentotutorial_Helloworld.xml): +
+<config> + <modules> + <Magentotutorial_Helloworld> + <active>true</active> + <codePool>local</codePool> + </Magentotutorial_Helloworld> + </modules> +</config> ++ +
Finally, we ensure the module is active: +
Next, we're going to configure a route. A route will turn a URL into an Action Controller and a method. Unlike other convention based PHP MVC systems, with Magento you need to explicitly define a route in the global Magento config. + +
In your config.xml file(at path app/code/local/Magentotutorial/Helloworld/etc/config.xml), add the following section: + +
+<config> + ... + <frontend> + <routers> + <helloworld> + <use>standard</use> + <args> + <module>Magentotutorial_Helloworld</module> + <frontName>helloworld</frontName> + </args> + </helloworld> + </routers> + </frontend> + ... +</config> ++ +
We have a lot of new terminology here, let's break it down.
+ +The <frontend> tag refers to a Magento Area. For now, think of Areas as individual Magento applications. The "frontend" Area is the public facing Magento shopping cart application. The "admin" Area is the private administrative console application. The "install" Area is the application you use to run though installing Magento the first time.
+ +There's a famous quote about computer science, often attributed to Phil Karlton:
+++ +"There are only two hard things in Computer Science: cache invalidation and naming things"
+
Magento, like all large systems, suffers from the naming problem in spades. You'll find there are many places in the global config, and the system in general, where the naming conventions seem unintuitive or even ambiguous. This is one of those places. Sometimes the <routers> tag will enclose configuration information about routers, other times it will enclose configuration information about the actual router objects that do the routing. This is going to seem counter intuitive at first, but as you start to work with Magento more and more, you'll start to understand its world view a little better. (Or, in the words of Han Solo, "Hey, trust me!").
+ +When a router parses a URL, it gets separated as follows
+ +http://example.com/frontName/actionControllerName/actionMethod/+ +
So, by defining a value of "helloworld" in the <frontName> tags, we're telling Magento that we want the system to respond to URLs in the form of
+ +http://example.com/helloworld/*+ +
Many developers new to Magento confuse this frontName with the Front Controller object. They are not the same thing. The frontName belongs solely to routing.
+ +This tag should be the lowercase version of you module name. Our module name is Helloworld, this tag is helloworld. Technically this tag defines our route name
+ +You'll also notice our frontName matches our module name. It's a loose convention to have frontNames match the module names, but it's not a requirement. In your own modules, it's probably better to use a route name that's a combination of your module name and package name to avoid possible namespace collisions.
+ +This module tag should be the full name of your module, including its package/namespace name. This will be used by the system to locate your Controller files.
+ +One last step to go, and we'll have our Action Controller. Create a file at + +
app/code/local/Magentotutorial/Helloworld/controllers/IndexController.php+ +
That contains the following + +
+<?php
+class Magentotutorial_Helloworld_IndexController extends Mage_Core_Controller_Front_Action {
+ public function indexAction() {
+ echo 'Hello World';
+ }
+}
+
+
+Clear your config cache, and load the following URL
+ +http://example.com/helloworld/index/index+ +
You should also be able to load
+ +http://example.com/helloworld/index/ +http://example.com/helloworld/+ +
You should see a blank page with the text "Hello World". Congratulations, you've setup your first Magento Controller!
+ + +Action Controllers should be placed in a module's controllers (lowercase c) folder. This is where the system will look for them.
+ +Remember the <module> tag back in config.xml? +
+<module>Magentotutorial_Helloworld</module> ++ +
An Action Controller's name will +
All Action Controllers need Mage_Core_Controller_Front_Action as an ancestor.
+ +As we previously mentioned, Magento URLs are routed (by default) as follows +
http://example.com/frontName/actionControllerName/actionMethod/+ +
So in the URL +
http://example.com/helloworld/index/index+ +
the URI portion "helloworld" is the frontName, which is followed by index (The Action Controller name), which is followed by another index, which is the name of the Action Method that will be called. (an Action of index will call the method public function indexAction(){...}.
+ +If a URL is incomplete, Magento uses "index" as the default, which is why the following URLs are equivalent. +
+http://example.com/helloworld/index +http://example.com/helloworld ++ +
If we had a URL that looked like this
+http://example.com/checkout/cart/add+ +
Magento would
+Let's try adding a non-default method to our Action Controller. Add the following code to IndexController.php
+ +
+public function goodbyeAction() {
+ echo 'Goodbye World!';
+}
+
+
+And then visit the URL to test it out: +
http://example.com/helloworld/index/goodbye+ +
Because we're extending the Mage_Core_Controller_Front_Action class, we get some methods for free. For example, additional URL elements are automatically parsed into key/value pairs for us. Add the following method to your Action Controller. + +
+public function paramsAction() {
+ echo '<dl>';
+ foreach($this->getRequest()->getParams() as $key=>$value) {
+ echo '<dt><strong>Param:</strong>'.$key.'</dt>';
+ echo '<dt><strong>Value: </strong>'.$value.'</dt>';
+ }
+ echo '</dl>';
+}
+
+
+and visit the following URL
+http://example.com/helloworld/index/params?foo=bar&baz=eof+ +
You should see each parameter and value printed out.
+ +Finally, what would we do if we wanted a URL that responded at +
http://example.com/helloworld/messages/goodbye+ +
Here our Action Controller's name is messages, so we'd create a file at +
app/code/local/Magentotutorial/Helloworld/controllers/MessagesController.php+ +
with an Action Controller named Magentotutorial_Helloworld_MessagesController and an Action Method that looked something like +
+public function goodbyeAction()
+{
+ echo 'Another Goodbye';
+}
+
+
+And that, in a nutshell, is how Magento implements the Controller portion of MVC. While it's a little more complicated than other PHP MVC framework's, it's a highly flexible system that will allow you build almost any URL structure you want.
diff --git a/guides/v1.8/magefordev/mage-for-dev-4.html b/guides/v1.8/magefordev/mage-for-dev-4.html new file mode 100644 index 0000000000..358391e48d --- /dev/null +++ b/guides/v1.8/magefordev/mage-for-dev-4.html @@ -0,0 +1,487 @@ +--- +--- + + + + + + + + + + +
+{% include v1x/eol_message.html %}
+
+
+
+by Alan Storm, updated for Magento 1.12
+ + + + + + +Developers new to Magento are often confused by the Layout and View system. This article will take a look at Magento's Layout/Block approach, and show you how it fits into Magento MVC worldview.
+ +Unlike many popular MVC systems, Magento's Action Controller does not pass a data object to the view or set properties on the view object (with a few exceptions). Instead, the View component directly references system models to get the information it needs for display.
+ +One consequence of this design decision is that the View has been separated into Blocks and Templates. Blocks are PHP objects, Templates are "raw" PHP files (with a .phtml extension) that contain a mix of HTML and PHP (where PHP is used as a templating language). Each Block is tied to a single Template file. Inside a phtml file, PHP's $this keyword will contain a reference to the Template's Block object.
+Take a look at the default product Template at the file at
+ +app/design/frontend/base/default/template/catalog/product/list.phtml+ +
You'll see the following PHP template code.
+ +
+<?php $_productCollection=$this->getLoadedProductCollection() ?>
+<?php if(!$_productCollection->count()): ?> <div class="note-msg">
+ <?php echo $this->__("There are no products matching the selection.") ?>
+</div> <?php else: ?>
+...
+
+
+The getLoadedProductCollection method can be found in the Template's Block class, Mage_Catalog_Block_Product_List as shown: + +
File: app/code/core/Mage/Catalog/Block/Product/List.php+ +
+...
+public function getLoadedProductCollection()
+{
+ return $this->_getProductCollection();
+}
+...
+
+
+The block's _getProductCollection then instantiates models and reads their data, returning a result to the template.
+ +The real power of Blocks/Templates come with the getChildHtml method. This allows you to include the contents of a secondary Block/Template inside of a primary Block/Template.
+ +Blocks calling Blocks calling Blocks is how the entire HTML layout for your page is created. Take a look at the one column layout Template.
+ +File: app/design/frontend/base/default/template/page/1column.phtml+ +
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>" lang="<?php echo $this->getLang() ?>">
+<head>
+<?php echo $this->getChildHtml('head') ?>
+</head>
+<body class="page-popup <?php echo $this->getBodyClass()?$this->getBodyClass():'' ?>">
+ <?php echo $this->getChildHtml('content') ?>
+ <?php echo $this->getChildHtml('before_body_end') ?>
+ <?php echo $this->getAbsoluteFooter() ?>
+</body>
+
+
+The template itself is only 28 lines long. However, each call to $this->getChildHtml(...) will include and render another Block. These Blocks will, in turn, use getChildHtml to render other Blocks. It's Blocks all the way down.
+ +So, Blocks and Templates are all well and good, but you're probably wondering
+ +This is where the Layout Object enters the picture. The Layout Object is an XML object that will define which Blocks are included on a page, and which Block(s) should kick off the rendering process.
+ +Last time we were echoing content directly from our Action Methods. This time let's create a simple HTML template for our Hello World module.
+ +First, create a file at
+ +app/design/frontend/base/default/layout/local.xml+ +
with the following contents
+ ++<layout version="0.1.0"> + <default> + <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" /> + </default> +</layout> ++ +
Then, create a file at
+ +app/design/frontend/base/default/template/magentotutorial/helloworld/simple_page.phtml+ +
with the following contents +
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Hello World</title>
+ <style type="text/css">
+ body {
+ background-color:#f00;
+ }
+ </style>
+</head>
+<body>
+
+</body>
+</html>
+
+
+Finally, each Action Controller is responsible for kicking off the layout process. We'll need to add two method calls to the Action Method.
+ +
+public function indexAction() {
+ //remove our previous echo
+ //echo 'Hello Index!';
+ $this->loadLayout();
+ $this->renderLayout();
+}
+
+
+Clear your Magento cache and reload your Hello World controller page. You should now see a website with a bright red background and an HTML source that matches what's in simple_page.phtml.
+ +So, that's a lot of voodoo and cryptic incantations. Let's take a look at what's going on.
+ +First, you'll want to install the Layoutviewer module. This is a module similar to the Configviewer module you built in the Hello World article that will let us peek at some of Magento's internals.
+ +Once you've installed the module (similar to how you setup the Configviewer module), go to the following URL
+ +http://example.com/helloworld/index/index?showLayout=page+ +
This is the layout xml for your page/request. It's made up of <block />, <reference /> and <remove /> tags. When you call the loadLayout method of your Action Controller, Magento will
+ +Generate this Layout XML
Instantiate a Block class for each <block /> tag, looking up the class using the tag's type attribute as a global config path and store it in the internal _blocks array of the layout object, using the tag's name attribute as the array key.
If the <block /> tag contains an output attribute, its value is added to the internal _output array of the layout object.
Then, when you call the renderLayout method in your Action Controller, Magento will iterate over all the Blocks in the _output array, using the value of the output attribute as a callback method. This is always toHtml, and means the starting point for output will be that Block's Template.
+ +The following sections will cover how Blocks are instantiated, how this layout file is generated, and finishes up with kicking off the output process.
+ +So, within a Layout XML file, a <block /> has a "type" that's actually a Grouped Class Name URI
++<block type="page/html" ... +<block type="page/template_links" ... ++ +
The URI references a location in the (say it with me) global config. The first portion of the URI (in the above examples page) will be used to query the global config to find the page class name. The second portion of the URI (in the two examples above, html and template_links) will be appended to the base class name to create the class name Magento should instantiate.
+ +We'll go through page/html as an example. First, Magento looks for the global config node at file
+ +app/code/core/Mage/Page/etc/config.xml+ +
and finds +
+<page> + <class>Mage_Page_Block</class> +</page> ++ +
This gives us our base class prefix Mage_Page_Block. Then, the second part of the URI (html) is appended to the class name to give us our final Block class name Mage_Page_Block_Html. This is the class that will be instantiated.
+ +If we create a block with the same name as an already existing block, the new block instance will replace the original instance. This is what we've done in our local.xml file from above.
+ ++<layout version="0.1.0"> + <default> + <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" /> + </default> +</layout> ++ +
The Block named root has been replaced with our Block, which points at a different phtml Template file.
+ +<reference name="" /> will hook all contained XML declarations into an existing block with the specified name. Contained <block /> nodes will be assigned as child blocks to the referenced parent block.
+ ++<layout version="0.1.0"> + <default> + <block type="page/html" name="root" output="toHtml" template="page/2columns-left.phtml"> + <!-- ... sub blocks ... --> + </block> + </default> +</layout> ++ +
In a different layout file:
+ ++<layout version="0.1.0"> + <default> + <reference name="root"> + <!-- ... another sub block ... --> + <block type="page/someothertype" name="some.other.block.name" template="path/to/some/other/template" /> + </reference> + </default> +</layout> ++ +
Even though the root block is declared in a separate layout XML file, the new block is added as a child block. Magento initially creates a page/html Block named root. Then, when it later encounters the reference with the same name (root), it will assign the new block some.other.block.name as a child of the root block. +
+ +So, we have a slightly better understanding of what's going on with the Layout XML, but where is this XML file coming from? To answer that question, we need to introduce two new concepts; Handles and the Package Layout.
+ +Each page request in Magento will generate several unique Handles. The Layoutview module can show you these Handles by using a URL something like
+ +http://example.com/helloworld/index/index?showLayout=handles+ +
You should see a list similar to the following (depending on your configuration)
+ +Each of these is a Handle. Handles are set in a variety of places within the Magento system. The two we want to pay attention to are default and helloworld_index_index. The default Handle is present in every request into the Magento system. The helloworld_index_index Handle is created by combining the route name (helloworld), Action Controller name (index), and Action Controller Action Method (index) into a single string. This means each possible method on an Action Controller has a Handle associated with it.
+ +Remember that "index" is the Magento default for both Action Controllers and Action Methods, so the following request
+ +http://example.com/helloworld/?showLayout=handles+ +
Will also produce a Handle named helloworld_index_index
+ +You can think of the Package Layout similar to the global config. It's a large XML file that contains every possible layout configuration for a particular Magento install. Let's take a look at it using the Layoutview module
+ +http://example.com/helloworld/index/index?showLayout=package+ +
This may take a while to load. If your browser is choking on the XML rendering, try the text format
+ +http://example.com/helloworld/index/index?showLayout=package&showLayoutFormat=text+ +
You should see a very large XML file. This is the Package Layout. This XML file is created by combining the contents of all the XML layout files for the current theme (or package). For the default install, this is at
+ +app/design/frontend/base/default/layout/+ +
Behind the scenes there are <frontend><layout><updates /> and <adminhtml><layout><updates /> sections of the global config that contains nodes with all the file names to load for the respective area. Once the files listed in the config have been combined, Magento will merge in one last xml file, local.xml. This is the file where you're able to add your customizations to your Magento install.
+ +So, if you look at the Package Layout, you'll see some familiar tags such as <block /> and <reference />, but they're all surrounded by tags that look like
++<default /> +<catalogsearch_advanced_index /> +etc... ++ +
These are all Handle tags. The Layout for an individual request is generated by grabbing all the sections of the Package Layout that match any Handles for the request. So, in our example above, our layout is being generated by grabbing tags from the following sections
+ ++<default /> +<STORE_bare_us /> +<THEME_frontend_default_default /> +<helloworld_index_index /> +<customer_logged_out /> ++ +
There's one additional tag you'll need to be aware of in the Package Layout. The <update /> tag allows you to include another Handle's tags. For example
+ ++<customer_account_index> + <!-- ... --> + <update handle="customer_account"/> + <!-- ... --> +</customer_account_index> ++ +
Is saying that requests with a customer_account_index Handle should include <blocks />s from the <customer_account /> Handle.
+ + +OK, that's a lot of theory. Lets get back to what we did earlier. Knowing what we know now, adding
++<layout version="0.1.0"> + <default> + <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" /> + </default> +</layout> ++ +
to local.xml means we've overridden the "root" tag. with a different Block. By placing this in the <default /> Handle we've ensured that this override will happen for every page request in the system. That's probably not what we want.
+ + +If you go to any other page in your Magento site, you'll notice they're either blank white, or have the same red background that your hello world page does. Let's change your local.xml file so it only applies to the hello world page. We'll do this by changing default to use the full action name handle (helloworld_index_index).
+ ++<layout version="0.1.0"> + <helloworld_index_index> + <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml" /> + </helloworld_index_index> +</layout> ++ +
Clear your Magento cache, and the rest of your pages should be restored.
+ +Right now this only applies to our index Action Method. Let's add it to the goodbye Action Method as well. In your Action Controller, modify the goodbye action so it looks like
+
+public function goodbyeAction() {
+ $this->loadLayout();
+ $this->renderLayout();
+}
+
+
+If you load up the following URL, you'll notice you're still getting the default Magento layout.
+ +http://example.com/helloworld/index/goodbye+ +
We need to add a Handle for the full action name (helloworld_index_goodbye) to our local.xml file. Rather than specify a new <block />, lets use the update tag to include the helloworld_index_index Handle.
+ ++<layout version="0.1.0"> + <!-- ... --> + <helloworld_index_goodbye> + <update handle="helloworld_index_index" /> + </helloworld_index_goodbye> +</layout> ++ +
Loading the following pages (after clearing your Magento cache) should now produce identical results.
+ +http://example.com/helloworld/index/index +http://example.com/helloworld/index/goodbye+ +
In a standard configuration, output starts on the Block named root (because it has an output attribute). We've overridden root's Template with our own
+ +template="magentotutorial/helloworld/simple_page.phtml"+ +
Templates are referenced from the root folder of the current theme. In this case, that's
+ +app/design/frontend/base/default+ +
so we need to drill down to our custom page. Most Magento Templates are stored in
+ +app/design/frontend/base/default/templates+ +
Combining this gives us the full path
+ +app/design/frontend/base/default/templates/magentotutorial/helloworld/simple_page.phtml+ +
A simple red page is pretty boring. Let's add some content to this page. Change your <helloworld_index_index /> Handle in local.xml so it looks like the following
+ ++<helloworld_index_index> + <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml"> + <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/> + </block> +</helloworld_index_index> ++ +
We're adding a new Block nested within our root. This is a Block that's distributed with Magento, and will display a customer registration form. By nesting this Block within our root Block, we've made it available to be pulled into our simple_page.html Template. Next, we'll use the Block's getChildHtml method in our simple_page.phtml file. Edit simple_page.html so it looks like this
+ +
+<body>
+ <?php echo $this->getChildHtml('customer_form_register'); ?>
+</body>
+
+
+Clear your Magento cache and reload the page and you should see the customer registration form on your red background. Magento also has a Block named top.links. Let's try including that. Change your simple_page.html file so it reads
+ +
+<body>
+ <h1>Links</h1>
+ <?php echo $this->getChildHtml('top.links'); ?>
+</body>
+
+
+When you reload the page, you'll notice that your <h1>Links</h1> title is rendering, but nothing is rendering for top.links. That's because we didn't add it to local.xml. The getChildHtml method can only include Blocks that are specified as sub-Blocks in the Layout. This allows Magento to only instantiate the Blocks it needs, and also allows you to set difference Templates for Blocks based on context.
+ +Let's add the top.links Block to our local.xml
+ ++<helloworld_index_index> + <block type="page/html" name="root" output="toHtml" template="magentotutorial/helloworld/simple_page.phtml"> + <block type="page/template_links" name="top.links"/> + <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/> + </block> +</helloworld_index_index> ++ +
Clear your cache and reload the page. You should now see the top.links module.
+ +There is one more important concept to cover before we wrap up this lesson, and that is the <action /> tag. Using the <action /> tag enables us to call public PHP methods of the block classes. So instead of changing the template of the root block by replacing the block instance with our own, we can use a call to setTemplate instead.
+ ++<layout version="0.1.0"> + <helloworld_index_index> + <reference name="root"> + <action method="setTemplate"> + <template>magentotutorial/helloworld/simple_page.phtml</template> + </action> + <block type="page/template_links" name="top.links"/> + <block type="customer/form_register" name="customer_form_register" template="customer/form/register.phtml"/> + </reference> + </helloworld_index_index> +</layout> ++ +
This layout XML will first set the template property of the root block, and then will add the two blocks we use as child blocks. Once we clear the cache, the result should look just as before. The benefit of using the <action /> is the same block instance is used that was created earlier, and all other parent/child associations still exist. For that reason this is a more upgrade proof way of implementing our changes.
+ +All arguments to the action's method need to be wrapped in an individual child node of the <action /> tag. The name of that node doesn't matter, only the order of the nodes. We could have written the action node from the previous example as follows with the same effect. +
+ ++<action method="setTemplate"> + <some_new_template>magentotutorial/helloworld/simple_page.phtml</some_new_template> +</action> ++ +
This is just to illustrate that the action's argument node names are arbitrary.
+ +That covers Layout fundamentals. We have covered the tags <block />, <reference />, <update /> and <action />, and also layout update handles like <default /> and <cms_index_index />. These make up most of the layout configuration used in Magento. If you found it somewhat daunting, don't worry, you'll rarely need to work with layouts on such a fundamental level. Magento provides a number of pre-built layouts which can be modified and skinned to meet the needs of your store. Understanding how the entire Layout system works can be a great help when you're trouble shooting Layout issues, or adding new functionality to an existing Magento system.
diff --git a/guides/v1.8/magefordev/mage-for-dev-5.html b/guides/v1.8/magefordev/mage-for-dev-5.html new file mode 100644 index 0000000000..8fa7cdefe1 --- /dev/null +++ b/guides/v1.8/magefordev/mage-for-dev-5.html @@ -0,0 +1,458 @@ +--- +--- + + + + + + + + + + +
+{% include v1x/eol_message.html %}
+
+by Alan Storm, updated for Magento 1.12
+ + + + + + +The implementation of a "Models Tier" is a huge part of any MVC framework. It represents the data of your application, and most applications are useless without data. Magento Models play an even bigger role, as they typically contain the "Business Logic" that's often relegated to the Controller or Helper methods in other PHP MVC frameworks.
+ +If the definition of MVC is somewhat fuzzy, the definition of a Model is even fuzzier. Prior to the wide adoption of the MVC pattern by PHP developers, data access was usually raw SQL statements and/or an SQL abstraction layer. Developers would write queries and not think too much about what objects they were modeling.
+ +In this day and age, raw SQL is mostly frowned upon, but many PHP frameworks are still SQL centric. Models will be objects that provide some layer of abstraction, but behind the scenes developers are still writing SQL and/or calling SQL like abstraction methods to read and write-down their data.
+ +Other frameworks eschew SQL and take the Object Relational Mapping (ORM) approach. Here, a developer is dealing strictly with Objects. Properties are set, and when a save method is called on the Object, the data is automatically written to the database. Some ORMs will attempt to divine object properties from the database, others require the user to specify them in some way, (usually in an abstract data language such as YAML). One of the most famous and popular implementations of this approach is ActiveRecord.
+ +This definition of ORM should suffice for now, but like everything Computer Science these days, the strict definition of ORM has blurred over the years. It's beyond the scope of this article to settle that dispute, but suffice it say we're generalizing a bit.
+ +It should be no surprise that Magento takes the ORM approach. While the Zend Framework SQL abstractions are available, most of your data access will be via the built in Magento Models, and Models you build yourself. It should also come as no surprise that Magento has a highly flexible, highly abstract, concept of what a Model is.
+ +Most Magento Models can be categorized in one of two ways. There's a basic, ActiveRecord-like/one-object-one-table Model, and there's also an Entity Attribute Value (EAV) Model. Each Model also gets a Model Collection. Collections are PHP objects used to hold a number of individual Magento Model instances. The Magento team has implemented the PHP Standard Library interfaces of IteratorAggregate and Countable to allow each Model type to have it's own collection type. If you're not familiar with the PHP Standard Library, think of Model Collections as arrays that also have methods attached.
+ +Magento Models don't contain any code for connecting to the database. Instead, each Model uses a modelResource class, that is used to communicate with the database server (via one read and one write adapter object). By decoupling the logical Model and the code that talks to the database, it's theoretically possible to write new resource classes for a different database schemas and platforms while keeping your Models themselves untouched.
+ +Something you should do in development—but never in production—is to enable Magento's developer mode which, among other things, displays exceptions in your browser. It's useful for debugging your code.
+Enable developer mode in any of the following ways:
+.htaccess in the Magento root directory file to add SetEnv MAGE_IS_DEVELOPER_MODE "true"To begin, we're going to create a basic Magento Model. PHP MVC tradition insists we model a weblog post. The steps we'll need to take are
+ +You should be an old hat at creating empty modules at this point, so we'll skip the details and assume you can create an empty module named Weblog. After you've done that, we'll setup a route for an index Action Controller with an action named "testModel". As always, the following examples assume a Package Name of "Magentotutorial".
+ +In `Magentotutorial/Weblog/etc/config.xml`, setup the following route
+ ++<frontend> + <routers> + <weblog> + <use>standard</use> + <args> + <module>Magentotutorial_Weblog</module> + <frontName>weblog</frontName> + </args> + </weblog> + </routers> +</frontend> ++ +
And then add the following Action Controller in
+
+class Magentotutorial_Weblog_IndexController extends Mage_Core_Controller_Front_Action {
+ public function testModelAction() {
+ echo 'Setup!';
+ }
+}
+
+
+at Magentotutorial/Weblog/controllers/IndexController.php. Clear your Magento cache and load the following URL to ensure everything's been setup correctly.
+ +http://example.com/weblog/index/testModel+ +
You should see the word "Setup" on a white background.
+ +Magento has a system for automatically creating and changing your database schemas, but for the time being we'll just manually create a table for our Model.
+ +Using the command-line or your favorite MySQL GUI application, create a table with the following schema
++CREATE TABLE `blog_posts` ( + `blogpost_id` int(11) NOT NULL auto_increment, + `title` text, + `post` text, + `date` datetime default NULL, + `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, + PRIMARY KEY (`blogpost_id`) +) ++ +
And then populate it with some data
+ +INSERT INTO `blog_posts` VALUES (1,'My New Title','This is a blog post','2010-07-01 00:00:00','2010-07-02 23:12:30');+ +
There are three individual things we need to setup for a Model in our config.
+ +When you instantiate a Model in Magento, you make a call like this
+ +$model = Mage::getModel('weblog/blogpost');
+
+The first part of the URI you pass into get Model is the Model Group Name. Because it is a good idea to follow conventions, this should be the (lowercase) name of your module, or to be safeguarded against conflicts use the packagename and modulename (also in lowercase). The second part of the URI is the lowercase version of your Model name.
+ +So, let's add the following XML to our module's `config.xml`.
++<global> + <!-- ... --> + <models> + <weblog> + <class>Magentotutorial_Weblog_Model</class> + <!-- + need to create our own resource, can't just + use core_resource + --> + <resourceModel>weblog_resource</resourceModel> + </weblog> + </models> + <!-- ... --> +</global> ++ +
The outer <weblog /> tag is your Group Name, which should match your module name. <class /> is the BASE name all Models in the weblog group will have, also called Class Prefix. The <resourceModel /> tag indicates which Resource Model that weblog group Models should use. We talk more about this later on in this page. For now, remember your Group Name and the literal string "resource".
+ +So, we're not done yet, but let's see what happens if we clear our Magento cache and attempt to instantiate a blogpost Model. In your `testModelAction` method, use the following code
+
+ public function testModelAction() {
+ $blogpost = Mage::getModel('weblog/blogpost');
+ echo get_class($blogpost);
+ }
+
+
+and reload your page. You should see an error like the following:
+ ++include(Magentotutorial/Weblog/Model/Blogpost.php) [function.include]: failed to open stream: No such file or directory ++ +
By attempting to retrieve a weblog/blogpost Model, you told Magento to instantiate a class with the name
+ ++Magentotutorial_Weblog_Model_Blogpost ++ +
Magento is trying to __autoload include this Model, but can't find the file. Let's create it! Create the following class at the following location
+ +File: app/code/local/Magentotutorial/Weblog/Model/Blogpost.php+
+class Magentotutorial_Weblog_Model_Blogpost extends Mage_Core_Model_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('weblog/blogpost');
+ }
+}
+
+
+Reload your page, and the exception should be replaced with the name of your class.
+ +All basic Models that interact with the database should extend the Mage_Core_Model_Abstract class. This abstract class forces you to implement a single method named _construct (NOTE: this is not PHP's constructor __construct). This method should call the class's _init method with the same identifying URI you'll be using in the Mage::getModel method call.
+ +So, we've setup our Model. Next, we need to setup our Model Resource. Model Resources contain the code that actually talks to our database. In the last section, we included the following in our config.
+ ++<resourceModel>weblog_resource</resourceModel> ++ +
The value in <resourceModel /> will be used to instantiate a Model Resource class. Although you'll never need to call it yourself, when any Model in the weblog group needs to talk to the database, Magento will make the following method call to get the Model resource
+ +
+Mage::getResourceModel('weblog/blogpost');
+
+
+Again, weblog is the Group Name, and blogpost is the Model. The Mage::getResourceModel method will use the weblog/blogpost URI to inspect the global config and pull out the value in <resourceModel> (in this case, weblog_resource). Then, a model class will be instantiated with the following URI
+ ++weblog_resource/blogpost ++ +
So, if you followed that all the way, what this means is, resource models are configured in the same section of the XML config as normal Models. This can be confusing to newcomers and old-hands alike.
+ +So, with that in mind, let's configure our resource. In our <models> section add
+ ++<global> + <!-- ... --> + <models> + <!-- ... --> + <weblog_resource> + <class>Magentotutorial_Weblog_Model_Resource</class> + </weblog_resource> + </models> +</global> ++ +
You're adding the <weblog_resource /> tag, which is the value of the <resourceModel /> tag you just setup. The value of <class /> is the base name that all your resource models will have, and should be named with the following format
+ ++Packagename_Modulename_Model_Resource ++ +
So, we have a configured resource, let's try loading up some Model data. Change your action to look like the following
+ +
+public function testModelAction() {
+ $params = $this->getRequest()->getParams();
+ $blogpost = Mage::getModel('weblog/blogpost');
+ echo("Loading the blogpost with an ID of ".$params['id']);
+ $blogpost->load($params['id']);
+ $data = $blogpost->getData();
+ var_dump($data);
+}
+
+
+And then load the following URL in your browser (after clearing your Magento cache)
+ +http://example.com/weblog/index/testModel/id/1+ +
You should see an exception something like the following
+ +Warning: include(Magentotutorial/Weblog/Model/Resource/Blogpost.php) [function.include]: failed to open stream: No such file ....+ +
As you've likely intuited, we need to add a resource class for our Model. Every Model has its own resource class. Add the following class at the following location
+ +File: app/code/local/Magentotutorial/Weblog/Model/Resource/Blogpost.php+
+class Magentotutorial_Weblog_Model_Resource_Blogpost extends Mage_Core_Model_Resource_Db_Abstract{
+ protected function _construct()
+ {
+ $this->_init('weblog/blogpost', 'blogpost_id');
+ }
+}
+
+
+Again, the first parameter of the init method is the URL used to identify the Model. The second parameter is the database field that uniquely identifies any particular column. In most cases, this should be the primary key. Clear your cache, reload, and you should see
+ +Can't retrieve entity config: weblog/blogpost+ +
Another exception! When we use the Model URI weblog/blogpost, we're telling Magento we want the Model Group weblog, and the blogpost Entity. In the context of simple Models that extend Mage_Core_Model_Resource_Db_Abstract, an entity corresponds to a table. In this case, the table named blog_post that we created above. Let's add that entity to our XML config.
+ ++ <models> + <!-- ... ---> + <weblog_resource> + <class>Magentotutorial_Weblog_Model_Resource</class> + <entities> + <blogpost> + <table>blog_posts</table> + </blogpost> + </entities> + </weblog_resource> + </models> ++ +
We've added a new <entities /> section to the resource Model section of our config. This, in turn, has a section named after our entity (<blogpost />) that specifies the name of the database table we want to use for this Model.
+ +Clear your Magento cache, cross your fingers, reload the page and ...
+ +Loading the blogpost with an ID of 1 + +array + 'blogpost_id' => string '1' (length=1) + 'title' => string 'My New Title' (length=12) + 'post' => string 'This is a blog post' (length=19) + 'date' => string '2009-07-01 00:00:00' (length=19) + 'timestamp' => string '2009-07-02 16:12:30' (length=19) ++ +
Eureka! We've managed to extract our data and, more importantly, completely configure a Magento Model.
+ +All Magento Models inherit from the Varien_Object class. This class is part of the Magento system library and not part of any Magento core module. You can find this object at
+ +lib/Varien/Object.php+ +
Magento Models store their data in a protected _data property. The Varien_Object class gives us several methods we can use to extract this data. You've already seen getData, which will return an array of key/value pairs. This method can also be passed a string key to get a specific field.
+ +
+$model->getData();
+$model->getData('title');
+
+
+There's also a getOrigData method, which will return the Model data as it was when the object was initially populated, (working with the protected _origData method).
+ +
+$model->getOrigData();
+$model->getOrigData('title');
+
+
+The Varien_Object also implements some special methods via PHP's magic __call method. You can get, set, unset, or check for the existence of any property using a method that begins with the word get, set, unset or has and is followed by the camel cased name of a property.
+ +
+$model->getBlogpostId();
+$model->setBlogpostId(25);
+$model->unsBlogpostId();
+if($model->hasBlogpostId()){...}
+
+
+For this reason, you'll want to name all your database columns with lower case characters and use underscores to separate characters.
+ +Magento Models support the basic Create, Read, Update, and Delete functionality of CRUD with load, save, and delete methods. You've already seen the load method in action. When passed a single parameter, the load method will return a record whose id field (set in the Model's resource) matches the passed in value.
+ +$blogpost->load(1);+ +
The save method will allow you to both INSERT a new Model into the database, or UPDATE an existing one. Add the following method to your Controller
+ +
+public function createNewPostAction() {
+ $blogpost = Mage::getModel('weblog/blogpost');
+ $blogpost->setTitle('Code Post!');
+ $blogpost->setPost('This post was created from code!');
+ $blogpost->save();
+ echo 'post with ID ' . $blogpost->getId() . ' created';
+}
+
+
+and then execute your Controller Action by loading the following URL
+ +http://example.com/weblog/index/createNewPost+ +
You should now see an additional saved post in your database table. Next, try the following to edit your post
+ +
+public function editFirstPostAction() {
+ $blogpost = Mage::getModel('weblog/blogpost');
+ $blogpost->load(1);
+ $blogpost->setTitle("The First post!");
+ $blogpost->save();
+ echo 'post edited';
+}
+
+
+And finally, you can delete your post using very similar syntax.
+ +
+public function deleteFirstPostAction() {
+ $blogpost = Mage::getModel('weblog/blogpost');
+ $blogpost->load(1);
+ $blogpost->delete();
+ echo 'post removed';
+}
+
+
+So, having a single Model is useful, but sometimes we want to grab list of Models. Rather than returning a simple array of Models, each Magento Model type has a unique collection object associated with it. These objects implement the PHP IteratorAggregate and Countable interfaces, which means they can be passed to the count function, and used in for each constructs.
+ +We'll cover Collections in full in a later article, but for now let's look at basic setup and usage. Add the following action method to your Controller, and load it in your browser.
+ +
+public function showAllBlogPostsAction() {
+ $posts = Mage::getModel('weblog/blogpost')->getCollection();
+ foreach($posts as $blogpost){
+ echo '<h3>'.$blogpost->getTitle().'</h3>';
+ echo nl2br($blogpost->getPost());
+ }
+}
+
+
+Load the action URL,
+ +http://example.com/weblog/index/showAllBlogPosts+ +
and you should see a (by now) familiar exception.
+ +Warning: include(Magentotutorial/Weblog/Model/Resource/Blogpost/Collection.php) [function.include]: failed to open stream+ +
You're not surprised, are you? We need to add a PHP class file that defines our Blogpost collection. Every Model has a protected property named _resourceCollectionName that contains a URI that's used to identify our collection.
+ ++ protected '_resourceCollectionName' => string 'weblog/blogpost_collection' ++ +
By default, this is the same URI that's used to identify our Resource Model, with the string "_collection" appended to the end. Magento considers Collections part of the Resource, so this URI is converted into the class name.
+ +Magentotutorial_Weblog_Model_Resource_Blogpost_Collection+ +
Add the following PHP class at the following location
+File: app/code/local/Magentotutorial/Weblog/Model/Resource/Blogpost/Collection.php+
+class Magentotutorial_Weblog_Model_Resource_Blogpost_Collection extends Mage_Core_Model_Resource_Db_Collection_Abstract {
+ protected function _construct()
+ {
+ $this->_init('weblog/blogpost');
+ }
+}
+
+
+Just as with our other classes, we need to init our Collection with the Model URI. (weblog/blogpost). Rerun your Controller Action, and you should see your post information.
+ +Congratulations, you've created and configured your first Magento Model. In a later article we'll take a look at Magento's Entity Attribute Value Models (EAV), which expand on what we've learned here.
+ + \ No newline at end of file diff --git a/guides/v1.8/magefordev/mage-for-dev-6.html b/guides/v1.8/magefordev/mage-for-dev-6.html new file mode 100644 index 0000000000..6ceb527cde --- /dev/null +++ b/guides/v1.8/magefordev/mage-for-dev-6.html @@ -0,0 +1,408 @@ +--- +--- + + + + + + + + + + +
+{% include v1x/eol_message.html %}
+
+by Alan Storm, updated for Magento 1.12
+ + + + + + +On any fast paced software development project, the task of keeping the development and production databases in sync become a sticky wicket. Magento offers a system to create versioned resource migration scripts that can help your team deal with this often contentious part of the development process.
+ +In the ORM article we created a model for a weblog post. At the time, we ran our CREATE TABLE statements directly against the database. This time, we'll create a Setup Resource for our module that will create the table for us. We'll also create an upgrade script for our module that will update an already installed module. The steps we'll need to take are
+ +So, let's continue with the weblog module we created last time. In our <global /> section, add the following
+ ++<global> + <!-- ... --> + <resources> + <weblog_setup> + <setup> + <module>Magentotutorial_Weblog</module> + <class>Magentotutorial_Weblog_Model_Resource_Setup</class> + </setup> + </weblog_setup> + </resources> + <!-- ... --> +</global> ++ +
The <weblog_setup> tag will be used to uniquely identify this Setup Resource. It's encouraged, but not necessary, that you use the modelname_setup naming convention. The <module>Magentotutorial_Weblog</module> tag block should contain the Packagename_Modulename of your module. Finally, <class>Magentotutorial_Weblog_Model_Resource_Setup</class> should contain the name of the class we'll be creating for our Setup Resource. For basic setup scripts it's not necessary to create a custom class, but by doing it now you'll give yourself more flexibility down the line.
+ +After adding the above section to your config, clear your Magento cache and try to load any page of your Magento site. You'll see an exception something like
+ +Fatal error: Class 'Magentotutorial_Weblog_Model_Resource_Setup' not found in+ +
Magento just tried to instantiate the class you specified in your config, but couldn't find it. You'll want to create the following file, with the following contents.
+ +File: app/code/local/Magentotutorial/Weblog/Model/Resource/Setup.php
+
+class Magentotutorial_Weblog_Model_Resource_Setup extends Mage_Core_Model_Resource_Setup {
+}
+
+
+Now, reload any page of your Magento site. The exception should be gone, and your page should load as expected.
+ +Next, we'll want to create our installer script. This is the script that will contain any CREATE TABLE or other SQL code that needs to be run to initialize our module.
+ +First, take a look at your config.xml file
+ ++<modules> + <Magentotutorial_Weblog> + <version>0.1.0</version> + </Magentotutorial_Weblog> +</modules> ++ +
This section is required in all config.xml files, and identifies the module as well as the its version number. Your installer script's name will be based on this version number. The following assumes the current version of your module is 0.1.0.
+ +Create the following file at the following location
+ +File: app/code/local/Magentotutorial/Weblog/sql/weblog_setup/mysql4-install-0.1.0.php
+
+echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";
+die("Exit for now");
+
+
+The weblog_setup portion of the path should match the tag you created in your config.xml file (<weblog_setup />). The 0.1.0 portion of the filename should match the starting version of your module. Clear your Magento cache and reload any page in your Magento site and you should see something like
+ ++Running This Upgrade: Magentotutorial_Weblog_Model_Resource_Setup +Exit for now + ... ++ +
Which means your update script ran. Eventually we'll put our SQL update scripts here, but for now we're going to concentrate on the setup mechanism itself. Remove the "die" statement from your script so it looks like the following
+ +echo 'Running This Upgrade: '.get_class($this)."\n <br /> \n";+ +
Reload your page. You should see your upgrade message displayed at the top of the page. Reload again, and your page should be displayed as normal.
+ +Magento's Setup Resources allow you to simply drop your install scripts (and upgrade scripts, which we'll get to in a bit) onto the server, and have the system automatically run them. This allows you to have all your database migrations scripts stored in the system in a consistent format.
+ +Using your favorite database client, take a look at the core_setup table
+ +mysql> select * from core_resource; + +-------------------------+------------+--------------+ + | code | version | data_version | + +-------------------------+------------+--------------+ + | adminnotification_setup | 1.6.0.0 | 1.6.0.0 | + | admin_setup | 1.6.1.0 | 1.6.1.0 | + | api2_setup | 1.0.0.0 | 1.0.0.0 | + | api_setup | 1.6.0.0 | 1.6.0.0 | + | backup_setup | 1.6.0.0 | 1.6.0.0 | + | bundle_setup | 1.6.0.0.1 | 1.6.0.0.1 | + | captcha_setup | 1.7.0.0.0 | 1.7.0.0.0 | + | catalogindex_setup | 1.6.0.0 | 1.6.0.0 | + | cataloginventory_setup | 1.6.0.0.2 | 1.6.0.0.2 | + | catalogrule_setup | 1.6.0.3 | 1.6.0.3 | + | catalogsearch_setup | 1.6.0.0 | 1.6.0.0 | + | catalog_setup | 1.6.0.0.14 | 1.6.0.0.14 | + | checkout_setup | 1.6.0.0 | 1.6.0.0 | + | cms_setup | 1.6.0.0.1 | 1.6.0.0.1 | + | compiler_setup | 1.6.0.0 | 1.6.0.0 | + | contacts_setup | 1.6.0.0 | 1.6.0.0 | + | core_setup | 1.6.0.2 | 1.6.0.2 | + | cron_setup | 1.6.0.0 | 1.6.0.0 | + | customer_setup | 1.6.2.0.1 | 1.6.2.0.1 | + | dataflow_setup | 1.6.0.0 | 1.6.0.0 | + | directory_setup | 1.6.0.1 | 1.6.0.1 | + | downloadable_setup | 1.6.0.0.2 | 1.6.0.0.2 | + | eav_setup | 1.6.0.0 | 1.6.0.0 | + | giftmessage_setup | 1.6.0.0 | 1.6.0.0 | + | googleanalytics_setup | 0.1.0 | 0.1.0 | + | googlecheckout_setup | 1.6.0.1 | 1.6.0.1 | + | importexport_setup | 1.6.0.2 | 1.6.0.2 | + | index_setup | 1.6.0.0 | 1.6.0.0 | + | log_setup | 1.6.0.0 | 1.6.0.0 | + | moneybookers_setup | 1.6.0.0 | 1.6.0.0 | + | newsletter_setup | 1.6.0.1 | 1.6.0.1 | + | oauth_setup | 1.0.0.0 | 1.0.0.0 | + | paygate_setup | 1.6.0.0 | 1.6.0.0 | + | payment_setup | 1.6.0.0 | 1.6.0.0 | + | paypaluk_setup | 1.6.0.0 | 1.6.0.0 | + | paypal_setup | 1.6.0.2 | 1.6.0.2 | + | persistent_setup | 1.0.0.0 | 1.0.0.0 | + | poll_setup | 1.6.0.0 | 1.6.0.0 | + | productalert_setup | 1.6.0.0 | 1.6.0.0 | + | rating_setup | 1.6.0.0 | 1.6.0.0 | + | reports_setup | 1.6.0.0.1 | 1.6.0.0.1 | + | review_setup | 1.6.0.0 | 1.6.0.0 | + | salesrule_setup | 1.6.0.3 | 1.6.0.3 | + | sales_setup | 1.6.0.7 | 1.6.0.7 | + | sendfriend_setup | 1.6.0.0 | 1.6.0.0 | + | shipping_setup | 1.6.0.0 | 1.6.0.0 | + | sitemap_setup | 1.6.0.0 | 1.6.0.0 | + | tag_setup | 1.6.0.0 | 1.6.0.0 | + | tax_setup | 1.6.0.3 | 1.6.0.3 | + | usa_setup | 1.6.0.1 | 1.6.0.1 | + | weblog_setup | 0.1.0 | 0.1.0 | + | weee_setup | 1.6.0.0 | 1.6.0.0 | + | widget_setup | 1.6.0.0 | 1.6.0.0 | + | wishlist_setup | 1.6.0.0 | 1.6.0.0 | + | xmlconnect_setup | 1.6.0.0 | 1.6.0.0 | + +-------------------------+------------+--------------+ + 55 rows in set (0.00 sec) ++ +
This table contains a list of all the installed modules, along with the installed version number. You can see our module near the end
+ +| weblog_setup | 0.1.0 | 0.1.0 |+ +
This is how Magento knows not to re-run your script on the second, and on all successive, page loads. The weblog_setup is already installed, so it won't be updated. If you want to re-run your installer script (useful when you're developing), just delete the row for your module from this table. Let's do that now, and actually add the SQL to create our table. So first, run the following SQL.
+ +DELETE from core_resource where code = 'weblog_setup';+ +
We'll also want to drop the table we manually created in the ORM article.
+ +DROP TABLE blog_posts;+ +
Then, add the following code to your setup script.
+ +$installer = $this;
+$installer->startSetup();
+$installer->run("
+ CREATE TABLE `{$installer->getTable('weblog/blogpost')}` (
+ `blogpost_id` int(11) NOT NULL auto_increment,
+ `title` text,
+ `post` text,
+ `date` datetime default NULL,
+ `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP,
+ PRIMARY KEY (`blogpost_id`)
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+ INSERT INTO `{$installer->getTable('weblog/blogpost')}` VALUES (1,'My New Title','This is a blog post','2009-07-01 00:00:00','2009-07-02 23:12:30');
+");
+$installer->endSetup();
+
+
+Clear your Magento cache and reload any page in the system. You should have a new blog_posts table with a single row.
+ +So, let's go over the script line-by-line. First, there's this (or is that $this?)
+ +$installer = $this;+ +
Each installer script is run from the context of a Setup Resource class, the class you created above. That means any reference to $this from within the script will be a reference to an object instantiated from this class. While not necessary, most setup scripts in the core modules will alias $this to a variable called installer, which is what we've done here. While not necessary, it is the convention and it's always best to follow the convention unless you have a good reason for breaking it.
+ +Next, you'll see our queries are bookended by the following two method calls.
+ +$installer->startSetup(); +//... +$installer->endSetup(); ++ +
If you take a look at the Mage_Core_Model_Resource_Setup class in app/code/core/Mage/Core/Model/Resource/Setup.php (which your setup class inherits from) you can see that these methods do some basic SQL setup
+ +
+ public function startSetup()
+ {
+ $this->getConnection()->startSetup()
+ return $this;
+ }
+
+ public function endSetup()
+ {
+ $this->getConnection()->endSetup();
+ return $this;
+ }
+
+
+You can look into Varien_Db_Adapter_Pdo_Mysql in lib/Varien/Db/Adapter/Pdo/Mysql.php to find the real SQL setup executed for MySQL connections in the startSetup() and endSetup() methods.
+ +Finally, there's the call to the run method
+ +$installer->run(...);+ +
which accepts a string containing the SQL needed to setup your database table(s). You may specify any number of queries, separated by a semi-colon. You also probably noticed the following
+ +$installer->getTable('weblog/blogpost')
+
+The getTable method allows you to pass in a Magento Model URI and get its table name. While not necessary, using this method ensures that your script will continue to run, even if someone changes the name of their table in the config file. The Mage_Core_Model_Resource_Setup class contains many useful helper methods like this. The best way to become familiar with everything that's possible is to study the installer scripts used by the core Magento modules.
+ +Since version 1.6, Magento (in theory) supports more database backends then only MySQL. Since our setup script contains raw SQL statements, it may not run correctly on a different database system, say MSSQL. For that reason the setup script name is prefixt with the string mysql4-
+ +In order to make setup scripts cross-database compatible, Magento offers a DDL (Data Definition Language) Table object. Here is an alternative version of our setup script that would run on any supported RDBMS.
+ +File: app/code/local/Magentotutorial/Weblog/sql/weblog_setup/mysql4-install-0.1.0.php
+$installer = $this;
+$installer->startSetup();
+$table = $installer->getConnection()->newTable($installer->getTable('weblog/blogpost'))
+ ->addColumn('blogpost_id', Varien_Db_Ddl_Table::TYPE_INTEGER, null, array(
+ 'unsigned' => true,
+ 'nullable' => false,
+ 'primary' => true,
+ 'identity' => true,
+ ), 'Blogpost ID')
+ ->addColumn('title', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
+ 'nullable' => false,
+ ), 'Blogpost Title')
+ ->addColumn('post', Varien_Db_Ddl_Table::TYPE_TEXT, null, array(
+ 'nullable' => true,
+ ), 'Blogpost Body')
+ ->addColumn('date', Varien_Db_Ddl_Table::TYPE_DATETIME, null, array(
+ ), 'Blogpost Date')
+ ->addColumn('timestamp', Varien_Db_Ddl_Table::TYPE_TIMESTAMP, null, array(
+ ), 'Timestamp')
+ ->setComment('Magentotutorial weblog/blogpost entity table');
+$installer->getConnection()->createTable($table);
+
+$installer->endSetup();
+
+
+As you can see, there is no raw SQL in this version of the setup script. So which version should you use? If you want your Modules to run on any RDBMS backend, use the new DDL style upgrade scripts. If you are concerned about backward compatibility, use the raw SQL flavor, that is still supported by Magento 1.6 and 1.7 (and probably will be supported by any 1.x Magento release).
+ +So, that's how you create a script that will setup your initial database tables, but what if you want to alter the structure of an existing module? Magento's Setup Resources support a simple versioning scheme that will let you automatically run scripts to upgrade your modules.
+ +Once Magento runs an installer script for a module, it will never run another installer for that module again (short of manually deleting the reference in the core_resource table). Instead, you'll need to create an upgrade script. Upgrade scripts are very similar to installer scripts, with a few key differences.
+ +To get started, we'll create a script at the following location, with the following contents
+ +File: app/code/local/Magentotutorial/Weblog/sql/weblog_setup/upgrade-0.1.0-0.2.0.php:
++echo 'Testing our upgrade script (upgrade-0.1.0-0.2.0.php) and halting execution to avoid updating the system version number+ +
'; +die(); +
Upgrade scripts are placed in the same folder as your installer script, but named slightly differently. First, and most obviously, the file name contains the word upgrade. Secondly, you'll notice there are two version numbers, separated by a "-". The first (0.1.0) is the module version that we're upgrading from. The second (0.2.0) is the module version we're upgrading to.
+ +If we cleared our Magento cache and reloaded a page, our script wouldn't run. We need to update the version number in our module's config.xml file to trigger the upgrade
+ ++<modules> + <Magentotutorial_Weblog> + <version>0.2.0</version> + </Magentotutorial_Weblog> +</modules> ++ +
With the new version number in place, we'll need to clear our Magento cache and load any page in our Magento site. You should now see output from your upgrade script.
+ +By the way, we also could have names our upgrade script mysql4-upgrade-0.1.0-0.2.0.php. This would indicate our upgrade would contain MySQL specific SQL.
+ +Before we continue and actually implement the upgrade script, there's one important piece of behavior you'll want to be aware of. Create another upgrade file at the following location with the following contents.
+ +File: app/code/local/Magentotutorial/Weblog/sql/weblog_setup/upgrade-0.1.0-0.1.5.php:
++echo 'Testing our upgrade script (upgrade-0.1.0-0.1.5.php) and NOT halting execution <br />'; ++ +
If you reload a page, you'll notice you see BOTH messages. When Magento notices the version number of a module has changed, it will run through all the setup scripts needed to bring that version up to date. Although we never really created a version 0.1.5 of the Weblog module, Magento sees the upgrade script, and will attempt to run it. Scripts will be run in order from lowest to highest. If you take a peek at the core_resource table,
+ +mysql> select * from core_resource where code = 'weblog_setup'; ++--------------+---------+--------------+ +| code | version | data_version | ++--------------+---------+--------------+ +| weblog_setup | 0.1.5 | 0.1.5 | ++--------------+---------+--------------+ +1 row in set (0.00 sec) ++ +
you'll notice Magento considers the version number to be 1.5. That's because we completed executing the 1.0 to 1.5 upgrade, but did not complete execution of the 1.0 to 2.0 upgrade.
+ +So, with all that out of the way, writing our actual upgrade script is identical to writing an installer script. Let's change the 0.1.0-0.2.0 script to read
+ +
+$installer = $this;
+$installer->startSetup();
+$installer->getConnection()
+ ->changeColumn($installer->getTable('weblog/blogpost'), 'post', 'post', array(
+ 'type' => Varien_Db_Ddl_Table::TYPE_TEXT,
+ 'nullable' => false,
+ 'comment' => 'Blogpost Body'
+ )
+);
+$installer->endSetup();
+die("You'll see why this is here in a second");
+
+
+Try refreshing a page in your Magento site and ... nothing. The upgrade script didn't run. The post field in our table still allows null values, and more importantly, the call to die() did not halt execution. Here's what happened
+ +The correct way to achieve what we wanted would have been to name our scripts as follows
+ +upgrade-0.1.0-0.1.5.php #This goes from 0.1.0 to 0.1.5 +upgrade-0.1.5-0.2.0.php #This goes 0.1.5 to 0.2.0+ +
Magento is smart enough to run both scripts on a single page load. You can go back in time and give this a try by updating the core_resource table
+ +UPDATE core_resource SET version = '0.1.0', data_version = '0.1.0' WHERE code = 'weblog_setup'; +...+ +
It's one of the odd quirks of the Magento system that the updates will run as previously configured. This means you'll want to be careful with multiple developers adding update scripts to the system. You'll either want a build-meister/deployment-manager type in charge of the upgrade scripts or (heaven forbid) developers will need to talk to one another.
+ +You should now know the basics of how to use Magento Setup Resources to create versioned database migration scripts, as well as understand the scripts provided in the core modules. Beyond having a standard way for developers to write migration scripts, Setup Resources become much more important when creating and modifying Entity Attribute Value models.
+ +
+{% include v1x/eol_message.html %}
+
+by Alan Storm, updated for Magento 1.12
+ + + + + + +In the first ORM article we told you there were two kinds of Models in Magento. Regular, or "simple" Models, and Entity Attribute Value (or EAV) Models. We also told you this was a bit of a fib. Here's where we come clean.
+ +ALL Magento Models interacting with the database inherit from the Mage_Core_Model_Abstract / Varien_Object chain. What makes something either a simple Model or an EAV Model is its Model Resource. While all resources extend the base Mage_Core_Model_Resource_Abstract class, simple Models have a resource that inherits from Mage_Core_Model_Resource_Db_Abstract, and EAV Models have a resource that inherits from Mage_Eav_Model_Entity_Abstract
+ +If you think about it, this makes sense. As the end-programmer-user of the system you want a set of methods you can use to talk to and manipulate your Models. You don't care what the backend storage looks like, you just want to get properties and invoke methods that trigger business rules.
+ +Entity-Attribute-Value model (EAV), also known as object-attribute-value model and open schema is a data model that is used in circumstances where the number of attributes (properties, parameters) that can be used to describe a thing (an "entity" or "object") is potentially very vast, but the number that will actually apply to a given entity is relatively modest. In mathematics, this model is known as a sparse matrix.+ +
Another metaphor that helps me wrap my head around it is "EAV brings some aspects of normalization to the database table schema". In a traditional database, tables have a fixed number of columns
+ ++------------------+ +| products | ++------------------+ +| product_id | +| name | +| price | +| etc.. | ++------------------+ + ++------------+----------------+------------------+---------+ +| product_id | name | price | etc... | ++------------+----------------+------------------+---------+ +| 1 | Widget A | 11.34 | etc... | ++------------+----------------+------------------+---------+ +| 2 | Dongle B | 6.34 | etc... | ++------------+----------------+------------------+---------+ ++ +
Every product has a name, every product has a price, etc.
+ +In an EAV Model, each "entity" (product) being modeled has a different set of attributes. EAV makes a lot of sense for a generic eCommerce solution. A store that sells laptops (which have a CPU speed, color, ram amount, etc) is going to have a different set of needs than a store that sells yarn (yarn has a color, but no CPU speed, etc.). Even within our hypothetical yarn store, some products will have length (balls of yarn), and others will have diameter (knitting needles).
+ +There aren't many open source or commercial databases that use EAV by default. There are none that are available on a wide variety of web hosting platforms. Because of that, the Magento engineers have built an EAV system out of PHP objects that use MySQL as a data-store. In other words, they've built an EAV database system on top of a traditional relational database.
+ +In practice this means any Model that uses an EAV resource has its attributes spread out over a number of MySQL tables.
+
+
+
The above diagram is a rough layout of the database tables Magento consults when it looks up an EAV record for the catalog_product entity. Each individual product has a row in catalog_product_entity. All the available attributes in the entire system (not just for products) are stored in eav_attribute, and the actual attribute values are stored in tables with names like catalog_product_entity_varchar, catalog_product_entity_decimal, catalog_product_entity_etc..
+ +Beyond the mental flexibility an EAV system gives you, there's also the practical benefit of avoiding ALTER TABLE statements. When you add a new attribute for your products, a new row is inserted into eav_attribute. In a traditional relational database/single-table system, you'd need to ALTER the actual database structure, which can be a time consuming/risky proposition for tables with large data-sets.
+ +The downside is there's no one single simple SQL query you can use to get at all your product data. Several single SQL queries or one large join need to be made.
+ +That's EAV in a nutshell. The rest of this articles is a run-through of what's needed to create a new EAV Model in Magento. It's the hairiest thing you'll read about Magento and it's something that 95% of people working with the system will never need to do. However, understanding what it takes to build an EAV Model Resource will help you understand what's going on with the EAV Resources that Magento uses.
+ +Because the EAV information is so dense, we're going to assume you're already very familiar with Magento's MVC and grouped class name features. We'll help you along the way, but training wheels are off.
+ +We're going to create another Model for a weblog post, but this time using an EAV Resource. To start with, setup and create a new module which responds at the following URL
+ +http://example.com/complexworld+ +
If you're unsure how to do this, be sure you've mastered the concepts in the previous tutorials.
+ +Next, we'll create a new Model named Weblogeav. Remember, it's the Resource that's considered EAV. We design and configure our Model the exact same way, so let's configure a Model similar to one we created in the first ORM article.
+ ++<global> + <!-- ... --> + <models> + <!-- ... --> + <complexworld> + <class>Magentotutorial_Complexworld_Model</class> + <resourceModel>complexworld_resource</resourceModel> + </complexworld> + <!-- ... --> + </models> + <!-- ... --> +</global> ++ +
You'll notice so far there is no difference to setting up a regular Model and flat table resource Model.
+ +We'll still need to let Magento know about this resource. Similar to basic Models, EAV Resources are configured in the same <model/> node with everything else.
+ ++<global> + <!-- ... --> + <models> + <!-- ... --> + <complexworld_resource> + <class>Magentotutorial_Complexworld_Model_Resource</class> + <entities> + <eavblogpost> + <table>eavblog_posts</table> + </eavblogpost> + </entities> + </complexworld_resource> + <!-- ... --> + </models> + <!-- ... --> +</global> ++ +
Again, so far this is setup similar to our regular Model Resource. We provide a <class/> that configures a PHP class, as well as an <entities/> section that will let Magento know the base table for an individual Model we want to create. The <eavblogpost/> tag is the name of the specific Model we want to create, and its inner <table/> tag specifies the base table this Model will use (more on this later).
+ +Until wide adoption of PHP 5.3 and namespaces, one of the trickier (and tedious) parts of Magento will remain remembering how <classname/>s relate to file paths, and then ensuring you create the correctly named directory structure and class files. After configuring any <classname/>s or URIs, you may find it useful to attempt to instantiate an instance of the class in a controller without first creating the class files. This way PHP will throw an exception telling me it can't find a file, along with the file location. Give the following a try in your Index Controller.
+ +
+public function indexAction() {
+ $weblog2 = Mage::getModel('complexworld/eavblogpost');
+ $weblog2->load(1);
+ var_dump($weblog2);
+}
+
+
+As predicted, a warning should be thrown
+ ++Warning: include(Magentotutorial/Complexworld/Model/Eavblogpost.php) [function.include]: +failed to open stream: No such file or directory in /Users/username/Sites/magento.dev/lib/Varien/Autoload.php on line 93 ++ +
In addition to telling us the path where we'll need to define the new resource class this also serves as a configuration check. If we'd been warned with the following
+ ++Warning: include(Mage/Complexworld/Model/Eavblogpost.php) [function.include]: +failed to open stream: No such file or directory in /Users/username/Sites/magento.dev/lib/Varien/Autoload.php on line 93 ++ +
we'd know our Model was misconfigured, as Magento was looking for the Model in code/core/Mage instead of code/local/Magentotutorial.
+ +So, lets create our Model class
+File: app/code/local/Magentotutorial/Complexworld/Model/Eavblogpost.php:
+
+class Magentotutorial_Complexworld_Model_Eavblogpost extends Mage_Core_Model_Abstract {
+ protected function _construct()
+ {
+ $this->_init('complexworld/eavblogpost');
+ }
+}
+
+
+Remember, the Model itself is resource independent. A regular Model and an EAV Model both extend from the same class. It's the resource that makes them different.
+ +Clear your Magento cache, reload your page, and you should see a new warning.
+ +Warning: include(Magentotutorial/Complexworld/Model/Resource/Eavblogpost.php)+ +
As expected, we need to create a class for our Model's resource. Let's do it!
+ +File: app/code/local/Magentotutorial/Complexworld/Model/Resource/Eavblogpost.php: +
+class Magentotutorial_Complexworld_Model_Resource_Eavblogpost extends Mage_Eav_Model_Entity_Abstract
+{
+ protected function _construct()
+ {
+ $resource = Mage::getSingleton('core/resource');
+ $this->setType('complexworld_eavblogpost');
+ $this->setConnection(
+ $resource->getConnection('complexworld_read'),
+ $resource->getConnection('complexworld_write')
+ );
+ }
+}
+
+
+So, already we're seeing a few differences between a simple Model Resource and an EAV Model Resource. First off, we're extending the Mage_Eav_Model_Entity_Abstract class. While Mage_Eav_Model_Entity_Abstract uses the same _construct concept as a regular Model Resource, there's no _init method. Instead, we need to handle the init ourselves. This means telling the resource what connection-resources it should use, and passing a unique identifier into the setType method of our object.
+ +Another difference in Mage_Eav_Model_Entity_Abstract is _construct is not an abstract method, primarily for reasons of backwards compatibility with older versions of the system.
+ +So, with that, let's clear the Magento cache and reload the page. You should see a new exception which reads
+ +Invalid entity_type specified: complexworld_eavblogpost+ +
Magento is complaining that it can't find a entity_type named complexworld_eavblogpost. This is the value you set above
+ +$this->setType('complexworld_eavblogpost');
+
+Every entity has a type. Types will, among other things, let the EAV system know which attributes a Model uses, and allow the system to link to tables that store the values for attributes. We'll need to let Magento know that we're adding a new entity type. Take a look in the MySQL table named eav_entity_type.
+ ++mysql> select * from eav_entity_type; +*************************** 1. row *************************** + entity_type_id: 1 + entity_type_code: customer + entity_model: customer/customer + attribute_model: + entity_table: customer/entity + value_table_prefix: + entity_id_field: + is_data_sharing: 1 + data_sharing_key: default +default_attribute_set_id: 1 + increment_model: eav/entity_increment_numeric + increment_per_store: 0 + increment_pad_length: 8 + increment_pad_char: 0 +*************************** 2. row *************************** + entity_type_id: 2 + entity_type_code: customer_address + entity_model: customer/customer_address + attribute_model: + entity_table: customer/address_entity + value_table_prefix: + entity_id_field: + is_data_sharing: 1 + data_sharing_key: default +default_attribute_set_id: 2 + increment_model: + increment_per_store: 0 + increment_pad_length: 8 + increment_pad_char: 0 ++ +
This table contains a list of all the entity_types in the system. The unique identifier complexworld_eavblogpost corresponds to the entity_type_code column.
+ +This illustrates the single most important Magento concept, one that many people struggle to learn.
+ +Consider the computer in front of you. The OS (Mac OS X, Windows, Linux, etc.) is the software system. Your web browser (Firefox, Safari, IE, Opera) is the application. Magento is a system first, and an application second. You build eCommerce applications using the Magento system. What gets confusing is, there's a lot of places in Magento where the system code is exposed in a really raw form to the application code. The EAV system configuration living in the same database as your store's data is an example of this.
+ +If you're going to get deep into Magento, you need to treat it like it's an old Type 650 machine. That is to say, it's the kind of thing you can't effectively program applications in unless unless you have a deep understanding of the system itself.
+ +So, it's theoretically possible to manually insert the rows you'll need into the Magento database to get your Model working, but it's not recommended. Fortunately, Magento provides a specialized Setup Resource that provides a number of helper method that will automatically create the needed records to get the system up and running.
+ +So, for starters, configure the Setup Resource like you would any other.
+ ++<global> + <!-- ... --> + <resources> + <complexworld_setup> + <setup> + <module>Magentotutorial_Complexworld</module> + <class>Magentotutorial_Complexworld_Model_Resource_Setup</class> + </setup> + </complexworld_setup> + </resources> + <!-- ... --> +</global> ++ +
Next, create its class file.
+ +File: app/code/local/Magentotutorial/Complexworld/Model/Resource/Setup.php: +
+class Magentotutorial_Complexworld_Model_Resource_Setup extends Mage_Eav_Model_Entity_Setup {
+}
+
+
+Take note that we're extending from Mage_Eav_Model_Entity_Setup rather than Mage_Core_Model_Resource_Setup.
+ +Finally, we'll set up our installer script. If you're not familiar with the naming conventions here, you'll want to review the setup resource tutorial on Setup Resources.
+ +File: app/code/local/Magentotutorial/Complexworld/sql/complexworld_setup/install-0.1.0.php: +
+<?php
+$installer = $this;
+throw new Exception("This is an exception to stop the installer from completing");
+
+
+Clear your Magento Cache, reload you page, and the above exception should be thrown, meaning you've correctly configured your Setup Resource.
+ +NOTE: We'll be building up our install script piece by piece. If you've read the previous tutorial, you'll know you need to remove the setup's row from the core_resource table and clear your cache to make an installer script re-run. For the remainder of this tutorial, please remember that anytime we add or remove an item from our installer and re-run it, you'll need to remove this row from the database and clear your Magento cache. Normally you would create this file and run it once, a tutorial is something of an edge case.
+ +To begin, add the following to your Setup Resource installer script, and then run the script by loading any page (after removing the above exception)
+ +
+$installer = $this;
+$installer->startSetup();
+$installer->addEntityType('complexworld_eavblogpost', array(
+ //entity_mode is the URI you'd pass into a Mage::getModel() call
+ 'entity_model' => 'complexworld/eavblogpost',
+
+ //table refers to the resource URI complexworld/eavblogpost
+ //<complexworld_resource>...<eavblogpost><table>eavblog_posts</table>
+ 'table' =>'complexworld/eavblogpost',
+));
+$installer->endSetup();
+
+
+We're calling the addEntityType method on our installer object. This method allows us to pass in the entity type (complexworld_eavblogpost) along with a list of parameters to set its default values. If you've run this script, you'll notice new rows in the eav_attribute_group, eav_attribute_set, and eav_entity_type tables.
+ +So, with that in place, if we reload our complexworld page, we'll get a new error.
+ +SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.eavblog_posts' doesn't exist+ +
So, we've told Magento about our new entity type. Next, we need to add the MySQL tables that will be used to store all the entity values, as well as configure the system so it knows about these tables.
+ +Our EAV Setup Resource has a method named createEntityTables which will automatically setup the tables we need, as well as add some configuration rows to the system. Let's add the following line to our setup resource.
+ +
+$installer->createEntityTables(
+ $this->getTable('complexworld/eavblogpost')
+);
+
+
+The createEntityTables method accepts two parameters. The first is the base table name, the second is a list of options. We're using the Setup Resource's getTable method to pull the table name from our config. If you've been following along, you know this should resolve to the string eavblog_posts. We've omitted the second parameter which is an array of options you'll only need to used it for advanced situations that are beyond the scope of this tutorial.
+ +After running the above script, you should have the following new tables in your database
+ ++eavblog_posts +eavblog_posts_char +eavblog_posts_datetime +eavblog_posts_decimal +eavblog_posts_int +eavblog_posts_text +eavblog_posts_varchar ++ +
You'll also have an additional row in the eav_attribute_set table
+ +mysql> select * from eav_attribute_set order by attribute_set_id DESC LIMIT 1 \G +*************************** 1. row *************************** + attribute_set_id: 65 + entity_type_id: 37 +attribute_set_name: Default + sort_order: 6 ++ +
So, let's go back to our page and reload.
+ +http://example.com/complexworld+ +
Success! You should see no errors or warnings, and a dumped Magentotutorial_Complexworld_Model_Eavblogpost --- with no data.
+ +The last step we need to take in our Setup Resource is telling Magento what attributes we want our EAV Model to have. This would be equivalent to adding new columns in a single database table setup. Again, the Setup Resource will help us. The method we're interested in is addAttribute.
+ +The code from the previous section was simply telling Magento about a type of entity that we add to the system. These next bits of code are what will actually add possible attributes for our new type to the system.
+ +We do that with the method addAttribute. When we call addAttribute, Magento will need to do several things to install your entities.
+ +To start with, we'll give our Eavblogpost a single attribute named title.
+ +
+/* ... */
+$this->addAttribute('complexworld_eavblogpost', 'title', array(
+ //the EAV attribute type, NOT a MySQL varchar
+ 'type' => 'varchar',
+ 'label' => 'Title',
+ 'input' => 'text',
+ 'class' => '',
+ 'backend' => '',
+ 'frontend' => '',
+ 'source' => '',
+ 'required' => true,
+ 'user_defined' => true,
+ 'default' => '',
+ 'unique' => false,
+));
+/* ... */
+
+
+All right, that's a small pile of code. Let's break it apart.
+ +The first argument to addAttribute is the entity type code. It has to match the code specified when calling addEntityType. It tells Magento which entity we are adding the attribute to, in our example it is our complexworld_eavblogpost entity. To see other available entities that come shipped with Magento, remember you can look into the eav_entity_type table at the entity_type_code column.
+ +The second argument to addAttribute is the attribute code. It has to be unique within the given entity.
+ +The third argument is where it get real interesting. This is an array of key value pairs, describing the attribute properties. For the sake of simplicity we've chose to define a single attribute, but you could go on to define as many as you'd like, by adding additional addAttribute calls to the setup script.
+ +Finally, we have a long list of attribute properties.
+ ++//the EAV attribute type, NOT a MySQL varchar +'type' => 'varchar', +'label' => 'Title', +'input' => 'text', +'class' => '', +'backend' => '', +'frontend' => '', +'source' => '', +'required' => true, +'user_defined' => true, +'default' => '', +'unique' => false, ++ +
Most of these define how Magento would build a backend form element for this attribute, and probably you'll won't have to deal with the,. That said, the one important property you'll want to make note of is
++'type' => 'varchar' ++ +
This defines the type of the value that the attribute will contain. You'll recall that we added table for each attribute type
+ ++eavblog_posts_datetime +eavblog_posts_decimal +eavblog_posts_int +eavblog_posts_text +eavblog_posts_varchar ++ +
While these do not refer to the MySQL column types, (but instead the EAV attribute types), their names (varchar, datetime, etc.) are indicative of the values they'll hold.
+ +All of these attribute properties are optional, if we wouldn't have specified them, Magento would have used a default value. These default values are defined in the _prepareValues method of the Mage_Eav_Model_Entity_Setup class (inherited by our setup class).
+ +
+// Mage_Eav_Model_Entity_Setup
+protected function _prepareValues($attr)
+{
+ $data = array(
+ 'backend_model' => $this->_getValue($attr, 'backend'),
+ 'backend_type' => $this->_getValue($attr, 'type', 'varchar'),
+ 'backend_table' => $this->_getValue($attr, 'table'),
+ 'frontend_model' => $this->_getValue($attr, 'frontend'),
+ 'frontend_input' => $this->_getValue($attr, 'input', 'text'),
+ 'frontend_label' => $this->_getValue($attr, 'label'),
+ 'frontend_class' => $this->_getValue($attr, 'frontend_class'),
+ 'source_model' => $this->_getValue($attr, 'source'),
+ 'is_required' => $this->_getValue($attr, 'required', 1),
+ 'is_user_defined' => $this->_getValue($attr, 'user_defined', 0),
+ 'default_value' => $this->_getValue($attr, 'default'),
+ 'is_unique' => $this->_getValue($attr, 'unique', 0),
+ 'note' => $this->_getValue($attr, 'note'),
+ 'is_global' => $this->_getValue($attr, 'global',
+ Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
+ ),
+ );
+
+ return $data;
+}
+
+
+The second argument to the method calls to _getValue is the array key from our addAttribute argument array, and the third is the default value. So by default Magento would assume you are adding a varchar attribute with a text input.
+ +Lets add attributes for the blog post content and the post date. This is what the complete install script looks like.
+ +
+ $installer = $this;
+ $installer->startSetup();
+
+ $installer->addEntityType('complexworld_eavblogpost', array(
+ //entity_mode is the URI you'd pass into a Mage::getModel() call
+ 'entity_model' => 'complexworld/eavblogpost',
+
+ //table refers to the resource URI complexworld/eavblogpost
+ //<complexworld_resource>...<eavblogpost><table>eavblog_posts</table>
+ 'table' =>'complexworld/eavblogpost',
+ ));
+
+ $installer->createEntityTables(
+ $this->getTable('complexworld/eavblogpost')
+ );
+
+ $this->addAttribute('complexworld_eavblogpost', 'title', array(
+ //the EAV attribute type, NOT a MySQL varchar
+ 'type' => 'varchar',
+ 'label' => 'Title',
+ 'input' => 'text',
+ 'class' => '',
+ 'backend' => '',
+ 'frontend' => '',
+ 'source' => '',
+ 'required' => true,
+ 'user_defined' => true,
+ 'default' => '',
+ 'unique' => false,
+ ));
+ $this->addAttribute('complexworld_eavblogpost', 'content', array(
+ 'type' => 'text',
+ 'label' => 'Content',
+ 'input' => 'textarea',
+ ));
+ $this->addAttribute('complexworld_eavblogpost', 'date', array(
+ 'type' => 'datetime',
+ 'label' => 'Post Date',
+ 'input' => 'datetime',
+ 'required' => false,
+ ));
+
+ $installer->endSetup();
+
+
+So, now that we have everything in place, lets refresh things one last time to run our installer script. After calling addAttribute, we should have
+ +This is clearly the lamest.blogmodel.ever, but lets try adding some rows and iterating through a collection and get the heck out of here before our heads explode. Add the following two actions to your Index Controller.
+ +
+public function populateEntriesAction() {
+ for ($i=0;$i<10;$i++) {
+ $weblog2 = Mage::getModel('complexworld/eavblogpost');
+ $weblog2->setTitle('This is a test '.$i);
+ $weblog2->setContent('This is test content '.$i);
+ $weblog2->setDate(now());
+ $weblog2->save();
+ }
+
+ echo 'Done';
+}
+
+public function showCollectionAction() {
+ $weblog2 = Mage::getModel('complexworld/eavblogpost');
+ $entries = $weblog2->getCollection()
+ ->addAttributeToSelect('title')
+ ->addAttributeToSelect('content');
+ $entries->load();
+ foreach($entries as $entry)
+ {
+ // var_dump($entry->getData());
+ echo '<h2>' . $entry->getTitle() . '</h2>';
+ echo '<p>Date: ' . $entry->getDate() . '</p>';
+ echo '<p>' . $entry->getContent() . '</p>';
+ }
+ echo '</br>Done</br>';
+}
+
+
+Let's populate some entries! Load up the following URL
+ +http://magento.dev/index.php/complexworld/index/populateEntries+ +
If you take a look at your database, you should see 10 new rows in the eavblog_posts table.
+ ++mysql> SELECT * FROM eavblog_posts ORDER BY entity_id DESC; ++-----------+----------------+------------------+--------------+-----------+----------+---------------------+---------------------+-----------+ +| entity_id | entity_type_id | attribute_set_id | increment_id | parent_id | store_id | created_at | updated_at | is_active | ++-----------+----------------+------------------+--------------+-----------+----------+---------------------+---------------------+-----------+ +| 10 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 9 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 8 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 7 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 6 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 5 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 4 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 3 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 2 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | +| 1 | 31 | 0 | | 0 | 0 | 2009-12-06 08:36:41 | 2009-12-06 08:36:41 | 1 | ++-----------+----------------+------------------+--------------+-----------+----------+---------------------+---------------------+-----------+ ++ +
as well as 10 new rows in the eavblog_posts_varchar table.
+ ++mysql> SELECT * FROM eavblog_posts_varchar ORDER BY value_id DESC; ++----------+----------------+--------------+----------+-----------+------------------+ +| value_id | entity_type_id | attribute_id | store_id | entity_id | value | ++----------+----------------+--------------+----------+-----------+------------------+ +| 10 | 31 | 933 | 0 | 10 | This is a test 9 | +| 9 | 31 | 933 | 0 | 9 | This is a test 8 | +| 8 | 31 | 933 | 0 | 8 | This is a test 7 | +| 7 | 31 | 933 | 0 | 7 | This is a test 6 | +| 6 | 31 | 933 | 0 | 6 | This is a test 5 | +| 5 | 31 | 933 | 0 | 5 | This is a test 4 | +| 4 | 31 | 933 | 0 | 4 | This is a test 3 | +| 3 | 31 | 933 | 0 | 3 | This is a test 2 | +| 2 | 31 | 933 | 0 | 2 | This is a test 1 | +| 1 | 31 | 933 | 0 | 1 | This is a test 0 | ++----------+----------------+--------------+----------+-----------+------------------+ ++ +
Notice that eavblog_posts_varchar is linked to eavblog_posts by the entity_id column.
+ +Finally, let's pull our Models back out. Load the following URL in your browser
+ +http://magento.dev/index.php/complexworld/index/showCollection+ +
This should give us a
+ +Warning: include(Magentotutorial/Complexworld/Model/Resource/Eavblogpost/Collection.php) [function.include]: + failed to open stream: No such file or directory in /Users/username/Sites/magento.dev/lib/Varien/Autoload.php on line 93+ +
So Close! We didn't make a class for our collection object! Fortunately, doing so is just as easy as with a regular Model Resource. Add the following file with the following contents
+ +File: Magentotutorial/Complexworld/Model/Resource/Eavblogpost/Collection.php: +
+class Magentotutorial_Complexworld_Model_Resource_Eavblogpost_Collection extends Mage_Eav_Model_Entity_Collection_Abstract
+{
+ protected function _construct()
+ {
+ $this->_init('complexworld/eavblogpost');
+ }
+}
+
+
+This is just a standard Magento _construct method to initialize the Model. With this in place, reload the page, and we'll see all the titles and the content outputted. But notice, the date value is missing!
+ +Those of you with sharp eyes may have noticed something slightly different about the collection loading.
+ +
+$entries = $weblog2->getCollection()
+ ->addAttributeToSelect('title')
+ ->addAttributeToSelect('content');
+
+
+Because querying for EAV data can be SQL intensive, you'll need to specify which attributes it is you want your Models to fetch for you. This way the system can make only the queries it needs. If you're willing to suffer the performance consequences, you can use a wild card to grab all the attributes
+ +$entries = $weblog2->getCollection()->addAttributeToSelect('*');
+
+So, that should give you enough information to be dangerous, or at least enough information so you're not drowning the next time you're trying to figure out why the yellow shirts aren't showing up in your store. There's still plenty to learn about EAV; here's a few topics I would have liked to cover in greater detail, and may talk about in future articles
+ +EAV Models are, without a doubt, the most complicated part of the Magento system that an ecommerce web developer will need to deal with. Remember to take deep breaths and that, at the end of the day, its just programming. Everything happens for a concrete reason, you just need to figure out why.
\ No newline at end of file diff --git a/guides/v1.8/magefordev/mage-for-dev-8.html b/guides/v1.8/magefordev/mage-for-dev-8.html new file mode 100644 index 0000000000..aa284c008c --- /dev/null +++ b/guides/v1.8/magefordev/mage-for-dev-8.html @@ -0,0 +1,524 @@ +--- +--- + + + + + + + + + + +
+{% include v1x/eol_message.html %}
+
+by Alan Storm, updated for Magento 1.12
+ + + + + + + +Originally, as a PHP programmer, if you wanted to collect together a group of related variables you had one choice, the venerable Array. While it shares a name with C's array of memory addresses, a PHP array is a general purpose dictionary like object combined with the behaviors of a numerically indexed mutable array.
+ +In other languages the choice isn't so simple. You have multiple data structures to chose from, each offering particular advantages in storage, speed and semantics. The PHP philosophy was to remove this choice from the client programmer and give them one useful data structure that was "good enough".
+ +All of this is galling to a certain type of software developer, and PHP 5 set out to change the status quo by offering built-in classes and interfaces that allow you to create your own data structures.
+ +
+$array = new ArrayObject();
+class MyCollection extends ArrayObject{...}
+$collection = new MyCollection();
+$collection[] = 'bar';
+
+
+While this is still galling to a certain type of software developer, as you don't have access to low level implementation details, you do have the ability to create array-like Objects with methods that encapsulate specific functionality. You can also setup rules to offer a level of type safety by only allowing certain kinds of Objects into your Collection.
+ +It should come as no surprise that Magento offers you a number of these Collections. In fact, every Model object that follows the Magento interfaces gets a Collection type for free. Understanding how these Collections work is a key part to being an effective Magento programmer. We're going to take a look at Magento Collections, starting from the bottom and working our way up. Set up a controller action where you can run arbitrary code, and let's get started.
+ +First, we're going to create a few new Objects.
+ +
+$thing_1 = new Varien_Object();
+$thing_1->setName('Richard');
+$thing_1->setAge(24);
+
+$thing_2 = new Varien_Object();
+$thing_2->setName('Jane');
+$thing_2->setAge(12);
+
+$thing_3 = new Varien_Object();
+$thing_3->setName('Spot');
+$thing_3->setLastName('The Dog');
+$thing_3->setAge(7);
+
+
+The Varien_Object class defines the object all Magento Models inherit from. This is a common pattern in object oriented systems, and ensures you'll always have a way to easily add methods/functionally to every object in your system without having to edit every class file.
+ +Any Object that extends from Varien_Object has magic getter and setters that can be used to set data properties. Give this a try
+ +var_dump($thing_1->getName());+ +
If you don't know what the property name you're after is, you can pull out all the data as an array
+ +var_dump($thing_3->getData());+ +
The above will give you an array something like
+ + ++array +'name' => string 'Spot' (length=4) +'last_name' => string 'The Dog' (length=7) +'age' => int 7 ++ +
Notice the property named "last_name"? If there's an underscore separated property, you camel case it if you want to use the getter and setter magic.
+ +$thing_1->setLastName('Smith');
+
+The ability to do these kinds of things is part of the power of PHP5, and the development style a certain class of people mean when they say "Object Oriented Programming".
+ +So, now that we have some Objects, let's add them to a Collection. Remember, a Collection is like an Array, but is defined by a PHP programmer.
+ ++$collection_of_things = new Varien_Data_Collection(); +$collection_of_things + ->addItem($thing_1) + ->addItem($thing_2) + ->addItem($thing_3); ++ +
The Varien_Data_Collection is the Collection that most Magento data Collections inherit from. Any method you can call on a Varien_Data_Collection you can call on Collections higher up the chain (We'll see more of this later)
+ +What can we do with a Collection? For one, with can use foreach to iterate over it
+ +
+foreach($collection_of_things as $thing)
+{
+ var_dump($thing->getData());
+}
+
+
+There are also shortcuts for pulling out the first and last items
+ ++var_dump($collection_of_things->getFirstItem()->getData()); +var_dump($collection_of_things->getLastItem()->getData()); ++ +
Want your Collection data as XML? There's a method for that
+ +var_dump( $collection_of_things->toXml() );+ +
Only want a particular field?
+ +var_dump($collection_of_things->getColumnValues('name'));
+
+The team at Magento have even given us some rudimentary filtering capabilities.
+ +var_dump($collection_of_things->getItemsByColumnValue('name','Spot'));
+
+Neat stuff.
+ +So, this is an interesting exercise, but why do we care?
+ +We care because all of Magento's built in data Collections inherit from this object. That means if you have, say, a product Collection you can do the same sort of things. Let's take a look
+ +
+public function testAction()
+{
+ $collection_of_products = Mage::getModel('catalog/product')->getCollection();
+ var_dump($collection_of_products->getFirstItem()->getData());
+}
+
+
+Most Magento Model objects have a method named getCollection which will return a collection that, by default, is initialized to return every Object of that type in the system.
+ +A Quick Note: Magento's Data Collections contain a lot of complicated logic that handles when to use an index or cache, as well as the logic for the EAV entity system. Successive method calls to the same Collection over its life can often result in unexpected behavior. Because of that, all the of the following examples are wrapped in a single method action. I'd recommend doing the same while you're experimenting. Also, XDebug's var_dump is a godsend when working with Magento Objects and Collections, as it will (usually) intelligently short circuit showing hugely recursive Objects, but still display a useful representation of the Object structure to you.
+ +The products Collection, as well as many other Magento Collections, also have the Varien_Data_Collection_Db class in their ancestor chain. This gives us a lot of useful methods. For example, if you want to see the select statement your Collection is using
+ +
+public function testAction()
+{
+ $collection_of_products = Mage::getModel('catalog/product')->getCollection();
+ var_dump($collection_of_products->getSelect()); //might cause a segmentation fault
+}
+
+
+The output of the above will be
+ ++object(Varien_Db_Select)[94] + protected '_bind' => + array + empty + protected '_adapter' => +... ++ +
Whoops! Since Magento is using the Zend database abstraction layer, your Select is also an Object. Let's see that as a more useful string.
+ +
+public function testAction()
+{
+ $collection_of_products = Mage::getModel('catalog/product')->getCollection();
+ //var_dump($collection_of_products->getSelect()); //might cause a segmentation fault
+ var_dump(
+ (string) $collection_of_products->getSelect()
+ );
+}
+
+
+Sometimes this is going to result in a simple select
+ +'SELECT `e`.* FROM `catalog_product_entity` AS `e`'+ +
Other times, something a bit more complex
+ ++string 'SELECT `e`.*, `price_index`.`price`, `price_index`.`final_price`, IF(`price_index`.`tier_price`, +LEAST(`price_index`.`min_price`, `price_index`.`tier_price`), `price_index`.`min_price`) AS `minimal_price`, +`price_index`.`min_price`, `price_index`.`max_price`, `price_index`.`tier_price` FROM `catalog_product_entity` +AS `e` INNER JOIN `catalog_product_index_price` AS `price_index` ON price_index.entity_id = e.entity_id AND +price_index.website_id = '1' AND price_index.customer_group_id = 0' ++ +
The discrepancy depends on which attributes you're selecting, as well as the aforementioned indexing and cache. If you've been following along with the other articles in this series, you know that many Magento models (including the Product Model) use an EAV system. By default, a EAV Collection will not include all of an Object's attributes. You can add them all by using the addAttributeToSelect method
+ +
+$collection_of_products = Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addAttributeToSelect('*'); //the asterisk is like a SQL SELECT * FROM ...
+
+
+Or, you can add just one
+ +
+//or just one
+$collection_of_products = Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addAttributeToSelect('meta_title');
+
+
+or chain together several
+ +
+//or just one
+$collection_of_products = Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addAttributeToSelect('meta_title')
+ ->addAttributeToSelect('price');
+
+
+One thing that will trip up PHP developers new to Magento's ORM system is when Magento makes its database calls. When you're writing literal SQL, or even when you're using a basic ORM system, SQL calls are often made immediately when instantiating an Object.
+ ++$model = new Customer(); +//SQL Calls being made to Populate the Object +echo 'Done'; //execution continues ++ +
Magento doesn't work that way. Instead, the concept of Lazy Loading is used. In simplified terms, Lazy loading means that no SQL calls are made until the client-programmer needs to access the data. That means when you do something something like this
+ +
+$collection_of_products = Mage::getModel('catalog/product')
+ ->getCollection();
+
+
+Magento actually hasn't gone out to the database yet. You can safely add attributes later
+ +
+$collection_of_products = Mage::getModel('catalog/product')
+ ->getCollection();
+$collection_of_products->addAttributeToSelect('meta_title');
+
+
+and not have to worry that Magento is making a database query each time a new attribute is added. The database query will not be made until you attempt to access an item in the Collection.
+ +In general, try not to worry too much about the implementation details in your day to day work. It's good to know that there's s SQL backend and Magento is doing SQLy things, but when you're coding up a feature try to forget about it, and just treat the objects as block boxes that do what you need.
+ +The most important method on a database Collection is addFieldToFilter. This adds your WHERE clauses to the SQL query being used behind the scenes. Consider this bit of code, run against the sample data database (substitute your own SKU is you're using a different set of product data)
+ +
+public function testAction()
+{
+ $collection_of_products = Mage::getModel('catalog/product')
+ ->getCollection();
+ $collection_of_products->addFieldToFilter('sku','n2610');
+
+ //another neat thing about collections is you can pass them into the count //function. More PHP5 powered goodness
+ echo "Our collection now has " . count($collection_of_products) . ' item(s)';
+ var_dump($collection_of_products->getFirstItem()->getData());
+}
+
+
+The first parameter of addFieldToFilter is the attribute you wish to filter by. The second is the value you're looking for. Here's we're adding a sku filter for the value n2610.
+ +The second parameter can also be used to specify the type of filtering you want to do. This is where things get a little complicated, and worth going into with a little more depth.
+ +So by default, the following
+ +$collection_of_products->addFieldToFilter('sku','n2610');
+
+is (essentially) equivalent to
+ +WHERE sku = "n2610"+ +
Take a look for yourself. Running the following
+ +
+public function testAction()
+{
+ var_dump(
+ (string)
+ Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addFieldToFilter('sku','n2610')
+ ->getSelect());
+}
+
+
+will yield
+ +SELECT `e`.* FROM `catalog_product_entity` AS `e` WHERE (e.sku = 'n2610')'+ +
Keep in mind, this can get complicated fast if you're using an EAV attribute. Add an attribute
+ +
+var_dump(
+ (string)
+ Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addAttributeToSelect('*')
+ ->addFieldToFilter('meta_title','my title')
+ ->getSelect()
+);
+
+
+and the query gets gnarly.
+ ++SELECT `e`.*, IF(_table_meta_title.value_id>0, _table_meta_title.value, _table_meta_title_default.value) AS `meta_title` +FROM `catalog_product_entity` AS `e` +INNER JOIN `catalog_product_entity_varchar` AS `_table_meta_title_default` + ON (_table_meta_title_default.entity_id = e.entity_id) AND (_table_meta_title_default.attribute_id='103') + AND _table_meta_title_default.store_id=0 +LEFT JOIN `catalog_product_entity_varchar` AS `_table_meta_title` + ON (_table_meta_title.entity_id = e.entity_id) AND (_table_meta_title.attribute_id='103') + AND (_table_meta_title.store_id='1') +WHERE (IF(_table_meta_title.value_id>0, _table_meta_title.value, _table_meta_title_default.value) = 'my title') ++ +
Not to belabor the point, but try not to think too much about the SQL if you're on deadline.
+ +I'm sure you're wondering "what if I want something other than an equals by query"? Not equal, greater than, less than, etc. The addFieldToFilter method's second parameter has you covered there as well. It supports an alternate syntax where, instead of passing in a string, you pass in a single element Array.
+ +The key of this array is the type of comparison you want to make. The value associated with that key is the value you want to filter by. Let's redo the above filter, but with this explicit syntax
+ +public function testAction()
+{
+ var_dump(
+ (string)
+ Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addFieldToFilter('sku', array('eq'=>'n2610'))
+ ->getSelect()
+ );
+}
+
+
+Calling out our filter
+ +addFieldToFilter('sku',array('eq'=>'n2610'))
+
+As you can see, the second parameter is a PHP Array. Its key is eq, which stands for equals. The value for this key is n2610, which is the value we're filtering on.
+ +Magento has a number of these english language like filters that will bring a tear of remembrance (and perhaps pain) to any old perl developers in the audience.
+ +Listed below are all the filters, along with an example of their SQL equivalents.
+ +
+array("eq"=>'n2610')
+WHERE (e.sku = 'n2610')
+
+array("neq"=>'n2610')
+WHERE (e.sku != 'n2610')
+
+array("like"=>'n2610')
+WHERE (e.sku like 'n2610')
+
+array("nlike"=>'n2610')
+WHERE (e.sku not like 'n2610')
+
+array("is"=>'n2610')
+WHERE (e.sku is 'n2610')
+
+array("in"=>array('n2610'))
+WHERE (e.sku in ('n2610'))
+
+array("nin"=>array('n2610'))
+WHERE (e.sku not in ('n2610'))
+
+array("notnull"=>true)
+WHERE (e.sku is NOT NULL)
+
+array("null"=>true)
+WHERE (e.sku is NULL)
+
+array("gt"=>'n2610')
+WHERE (e.sku > 'n2610')
+
+array("lt"=>'n2610')
+WHERE (e.sku < 'n2610')
+
+array("gteq"=>'n2610')
+WHERE (e.sku >= 'n2610')
+
+array("moreq"=>'n2610') //a weird, second way to do greater than equal (Doesn't work on > 1.8 CE EDITION do the same as eq)
+WHERE (e.sku >= 'n2610')
+
+array("lteq"=>'n2610')
+WHERE (e.sku <= 'n2610')
+
+array("finset"=>array('n2610'))
+WHERE (find_in_set('n2610',e.sku))
+
+array('from'=>'10','to'=>'20')
+WHERE e.sku >= '10' and e.sku <= '20'
+
+
+Most of these are self explanatory, but a few deserve a special callout
+ +The in, nin and finset conditionals allow you to pass in an Array of values. That is, the value portion of your filter array is itself allowed to be an array.
+ +
+array("in"=>array('n2610','ABC123')
+WHERE (e.sku in ('n2610','ABC123'))
+
+
+The keyword NULL is special in most flavors of SQL. It typically won't play nice with the standard equality (=) operator. Specifying notnull or null as your filter type will get you the correct syntax for a NULL comparison while ignoring whatever value you pass in
+ +
+array("notnull"=>true)
+WHERE (e.sku is NOT NULL)
+
+
+This is another special format that breaks the standard rule. Instead of a single element array, you specify a two element array. One element has the key from, the other element has the key to. As the keys indicated, this filter allows you to construct a from/to range without having to worry about greater than and less than symbols
+ +
+public function testAction
+{
+ var_dump(
+ (string)
+ Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addFieldToFilter('price',array('from'=>'10','to'=>'20'))
+ ->getSelect()
+ );
+}
+
+
+The above yields
+WHERE (_table_price.value >= '10' and _table_price.value <= '20')'+ +
Finally, we come to the boolean operators. It's the rare moment where we're only filtering by one attribute. Fortunately, Magento's Collections have us covered. You can chain together multiple calls to addFieldToFilter to get a number of "AND" queries.
+ +
+function testAction()
+{
+ echo
+ (string)
+ Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addFieldToFilter('sku',array('like'=>'a%'))
+ ->addFieldToFilter('sku',array('like'=>'b%'))
+ ->getSelect();
+}
+
+
+By chaining together multiple calls as above, we'll produce a where clause that looks something like the following
+ +WHERE (e.sku like 'a%') AND (e.sku like 'b%')+ +
To those of you that just raised your hand, yes, the above example would always return 0 records. No sku can begin with BOTH an a and a b. What we probably want here is an OR query. This brings us to another confusing aspect of addFieldToFilter's second parameter.
+ +If you want to build an OR query, you need to pass an Array of filter Arrays in as the second parameter. I find it's best to assign your individual filter Arrays to variables
+ +
+public function testAction()
+{
+ $filter_a = array('like'=>'a%');
+ $filter_b = array('like'=>'b%');
+}
+
+
+and then assign an array of all my filter variables
+
+public function testAction()
+{
+ $filter_a = array('like'=>'a%');
+ $filter_b = array('like'=>'b%');
+ echo
+ (string)
+ Mage::getModel('catalog/product')
+ ->getCollection()
+ ->addFieldToFilter('sku', array($filter_a, $filter_b))
+ ->getSelect();
+}
+
+
+In the interest of being explicit, here's the aforementioned array of filter arrays.
+array($filter_a, $filter_b)+ +
This will gives us a WHERE clause that looks something like the following
+ +WHERE (((e.sku like 'a%') or (e.sku like 'b%')))+ +
You're now a Magento developer walking around with some serious firepower. Without having to write a single line of SQL you now know how to query Magento for any Model your store or application might need.
diff --git a/guides/v1.8/other/appsec-900_addhandler.html b/guides/v1.8/other/appsec-900_addhandler.html new file mode 100644 index 0000000000..b19abed7fd --- /dev/null +++ b/guides/v1.8/other/appsec-900_addhandler.html @@ -0,0 +1,98 @@ +--- +title: 'Discover credit card validation issue: Magento EE 1.9.1.1—.13.1.0 and CE 1.4.2.0—1.8.1.0' +layout: v1x +--- + +We recently identified potential exploits that:
+Creating files with a .csv extension can lead to executing files like php.csv (only under circumstances discussed in this article). The ability to run code with a .csv extension is dangerous itself and could be combined with other attacks; for example, targeting other software installed on the server.
+You can resolve this issue by changing your server's configuration as discussed in Resolving the File System Vulnerability.
+Although Magento code is protected by a hash value, the possibility of a successful exploit cannot be eliminated because of the low entropy of the hash secret value.
+We strongly recommend you to take precautions discussed in this article and apply a patch for your version of Magento Enterprise Edition or Community Edition.
+ +Magento software versions affected: The issue affects all shipping versions of Magento Community Edition (CE) and Enterprise Edition (EE).
+Operating system versions affected:
+The following table shows the patch you should get for your version of CE or EE.
+| Version | +Patch | +
|---|---|
| EE 1.13 and 1.14, CE 1.8 and 1.9 | +SUPEE-1533_EE_1.13.x_v1.patch | +
| EE 1.12, CE 1.7 | +SUPEE-1533_EE_1.12.x_v1.patch | +
| EE 1.11, CE 1.6 | +SUPEE-1533_EE_1.11.x_v1.patch + |
| EE 1.10.1, CE 1.5.1 | +SUPEE-1533_EE_1.10.1.x_v1.patch | +
| EE 1.10.0.1, CE 1.5.0.1 | +SUPEE-1533_EE_1.10.0.x_v1.patch | +
| EE 1.9 | +SUPEE-1533_EE_1.9.x_v1.patch |
To get and apply your patch, see How to Apply and Revert Magento Patches.
+To determine if you're vulnerable to execution of PHP code with a non-PHP extension, search your web server configuration file for the following string:
+AddHandler application/x-httpd-php .php+
The Apache configuration file is typically /etc/httpd/conf/httpd.conf
+To confirm you're vulnerable:
+<?php +phpinfo()

To resolve this vulnerability, you must log in to the Magento server as a user with root privileges or as a user with permissions to change the web server configuration.
+To resolve the vulnerability:
+# AddHandler application/x-httpd-php .php
<FilesMatch \.php$> +SetHandler application/x-httpd-php +</FilesMatch>+ Some operating systems, like Red Hat Enterprise, might require different syntax such as: +
<FilesMatch \.php$> + SetHandler php5-script +</FilesMatch>+ The regular expression in this setting matches .php only to the final extension in the file name, applying the handler only to PHP files and preventing PHP from executing. +
Magento has fixed an issue that prevented some Discover credit cards from validating properly. The issue was that certain Discover credit card number ranges were not recognized as being valid. As a result of the fix, all Discover cards should validate properly.
+This fix applies to:
+To get the patch for Magento CE, submit a Magento CE help request.
+ + +To get the patch for Magento EE:
+We'd like to draw your attention to new patches that were recently posted to the Partner Portal and Support Center. These patches deliver important improvements, such as improving security of the Magento Connect Manager and making it easier to install community-created translation packages.
+ +Patch name:
+Result of applying this patch:
+To get this patch:
+Patch name: PATCH_SUPEE-3630_EE_1.12.x_v1.sh for EE 1.12.x. After applying this patch, your search engine returns search results to users on the web store while reindexing is underway. We recommend you install this patch if you're using the Solr search engine. This patch can result in slower performance if you're using the default MySQL Full Text search engine.
+To get this patch, contact Magento Support.
+ +Customers of traditional stores and online web stores love coupons. Typically, a merchant sends coupons to customers who input them when checking out. The coupon saves the customer money and hopefully entices the customer to visit the store more frequently. In addition, the merchant can track coupon codes to individual customers to target market those customers.
+ +Magento CE 1.7 introduced a new method of creating coupon codes—auto generation. Auto generating coupons means Magento programmatically creates several coupon codes at one time quickly and easily. However, if Magento generates the coupon codes, you'd have to manually distribute them to customers.
+Magento's REST API is extensible and can easily be called by an outside program to auto generate coupon codes. You can use this feature, for example, to e-mail coupon codes to your top 100 customers.
+No programming is necessary to implement the extension module discussed in this guide; however, basic familiarity with Magento modules and PHP programming is desirable.
+The Coupon AutoGen API enables any authorized external program to instruct Magento to:
+.php fileThis guide discusses how to use coupon auto generation and a web service to dynamically call the Magento REST API to generate a series of codes. The web service instantiates the underlying Magento sales rule (salesrule/rule) coupon code generator and creates a pool of new codes. These codes returned to the caller as a JSON string.
For more information about the Magento REST API, see Introduction to REST API. To extend the REST API to add a web service for generating and retrieving coupon codes, this guide discusses the following:
+.xml files and one .php file to create the web service.To implement and test the Coupon AutoGen API, you must have all of the following:
+phpmyadmin, which makes it easier to view and manipulate the Magento database. You can use phpmyadmin for convenience to get the OAuth key and shared secret later in this guide.This section discusses how to install the pecl OAuth extension on Ubuntu. Consult the pecl.php.net documentation for installation instructions on other operating systems.
+The pecl OAuth extension requires the PEAR installer. The following sections discuss the installation in detail:
+root privileges.Before you begin, create a phpinfo.php file, if you have not already done so, to determine if you already have OAuth running.
To create phpinfo.php:
phpinfo.php anywhere on the web server's docroot:
+<?php +// Show all information, defaults to INFO_ALL +phpinfo();
http://host-or-ip[:port]/path-to-phpinfo/phpinfo.php
www.example.com and you put phpinfo.php in the web server's docroot, enter:
+http://www.example.com/phpinfo.php
OAuth.
The pecl OAuth extension requires both PEAR (which enables you to install the package) and libpcre3-dev, which enables the OAuth package to be compiled.
To install the packages and confirm that OAuth is enabled:
+apt-get install php-pear +apt-get install libpcre3-dev +pecl install oauth
root privileges.Wait while each package is installed. The message Build process completed successfully displays to indicate OAuth installed successfully.
+
Error: `make' failed displays after you enter pecl install oauth, see OAuth Package Installation Error: `make' failed.php.ini file to find the OAuth library:
+configuration option "php_ini" is not set to php.ini location +You should add "extension=oauth.so" to php.ini
php.ini in a text editor.phpinfo.php page output.
+Add the following anywhere in php.ini:
+[OAuth] +extension=oauth.so
php.ini and exit the text editor.service apache2 restart
If your phpinfo.php page is still open in a web browser, press Control+R to force a refresh; otherwise, enter the URL shown in Creating a phpinfo File to view it.
The following figure shows an example of a properly set up OAuth extension.
+
+To define a Magento coupon code generation rule:
+
| Item | +Description | +
|---|---|
| Rule Name | +Enter Generate Coupons. |
+
| Description | +Enter an optional description of the rule, such as Rule that generates a sequence of coupon codes. |
+
| Status | +From the list, click Active. | +
| Websites | +Click the websites on which you want the coupons to display. Hold down the Shift key and click the names of all items to select them. | +
| Customer Groups | +Hold down the Shift key and click the names of all items to select them. | +
| Coupon | +Click Specific Coupon | +
| Coupon Code | +Leave the field blank. | +
| CE only. Auto Generation | +Select the Use Auto Generation checkbox. | +
| CE only. Uses per Coupon | +Enter 10. |
+
| Uses per Customer | +Enter 1. |
+
| From Date | +Select today's date. | +
| To Date | +Select any date in the future. | +
| Priority | +Enter 0. |
+
| Public In RSS Feed | +Click No. | +
The rule has been saved displays at the top of the page to indicate that Magento successfully saved the rule you just created.
| Item | +Description | +
|---|---|
| Apply | +From the list, click Percent of product price discount. | +
| Discount Amount | +Enter 10. |
+
| Maximum Qty Discount is Applied To | +Enter 1. |
+
| Discount Qty Step (Buy X) | +Enter 1. |
+
| Apply to Shipping Amount | +From the list, click No. | +
| Free Shipping | +From the list, click No. | +
| Stop Further Rules Processing | +From the list, click Yes. | +
| EE only Add Reward Points | +Enter 0. |
+
The rule has been saved displays to indicate that Magento saved the rule action options you just entered. Notice that this page now has a row for the Generate Coupons rule you just defined.
Now that you've created a rule, this section discusses how to use the rule to manually generate a sequence of coupon codes.
+| Item | +Description | +
|---|---|
| Coupon Qty | +Enter 3. |
+
| Code Length | +Enter 12. |
+
| Code Format | +Click Alphanumeric. | +
| Coupon Prefix | +Enter TEST-. |
+
| Coupon Suffix | +Enter -TEST. |
+
| Dash Every X Characters | +Enter 0. |
+

In the preceding section, you created a Shopping Cart Price Rule named Generate Coupons that manually generates a set of coupon codes. To use those codes, you could export them to a file, and then import them into any external program you want; however, this is a time-consuming procedure!
+Fortunately, you can automate this process by adding a coupon code auto-generate API to Magento's existing REST API. Using this API, an external program can automatically get the coupon codes it needs.
+The following sections discuss how to extend Magento's REST API to include the Coupon AutoGen API:
+While you're implementing the Coupon AutoGen API, you must disable Magento's caching so Magento will find and use your new code immediately.
+To disable the cache:
+
This section discusses how to create a module (also referred to as an extension). The module consists of configuration files that create a web service that extends the Magento REST API to take input from an external program. This program uses HTTP POST and OAuth calls to auto-generate coupon codes.
+In this guide, the external program is a PHP script; however, it could be any application that uses OAuth and REST calls.
+For more information about Magento module development, see developer documentation on Magento Connect.
+root and change the permissions appropriately later. Consult an IT administrator if you're not sure how to proceed.+magento-install-dir/app/code/community/CouponDemo +magento-install-dir/app/code/community/CouponDemo/AutoGen +magento-install-dir/app/code/community/CouponDemo/AutoGen/etc +magento-install-dir/app/code/community/CouponDemo/AutoGen/Model +magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2 +magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon +magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon/Rest +magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon/Rest/Admin+For example, if Magento is installed in
/var/www/magento, create the following directories:
++/var/www/magento/app/code/community/CouponDemo +/var/www/magento/app/code/community/CouponDemo/AutoGen/etc +/var/www/magento/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon/Rest/Admin
The following figure shows an example.
+
magento-install-dir/app/etc/modules directory.CouponDemo_AutoGen.xml and have the following contents.
+<?xml version="1.0"?>
+<config>
+ <modules>
+ <CouponDemo_AutoGen>
+ <active>true</active>
+ <codePool>community</codePool>
+ </CouponDemo_AutoGen>
+ </modules>
+</config>
+
+CouponDemo_AutoGen.xml and exit the text editor.magento-install-dir/app/code/community/CouponDemo/AutoGen/etc directory.config.xml with the following contents.
+<?xml version="1.0"?>
+<config>
+ <modules>
+ <CouponDemo_AutoGen>
+ <version>0.1.0</version>
+ </CouponDemo_AutoGen>
+ </modules>
+ <global>
+ <models>
+ <autogen>
+ <class>CouponDemo_AutoGen_Model</class>
+ </autogen>
+ </models>
+ </global>
+</config>
+
+api2.xml with the following contents.
+<config>
+ <api2>
+ <resource_groups>
+ <autogen translate="title" module="CouponDemo_AutoGen">
+ <title>CouponDemo API</title>
+ <sort_order>10</sort_order>
+ </autogen>
+ </resource_groups>
+ <resources>
+ <autogen translate="title" module="CouponDemo_AutoGen">
+ <group>autogen</group>
+ <model>autogen/api2_coupon</model>
+ <title>Coupon Code Auto Generation</title>
+ <sort_order>10</sort_order>
+ <privileges>
+ <admin>
+ <create>1</create>
+ <retrieve>1</retrieve>
+ </admin>
+ </privileges>
+ <attributes>
+ <coupon_id>Coupon ID</coupon_id>
+ <code>Code</code>
+ <qty>Quantity</qty>
+ <length>Length</length>
+ <format>Format</format>
+ </attributes>
+ <routes>
+ <route>
+ <route>/coupondemo/rules/:rule_id/codes</route>
+ <action_type>collection</action_type>
+ </route>
+ </routes>
+ <versions>1</versions>
+ </autogen>
+ </resources>
+ </api2>
+</config>
+
+api2.xml and exit the text editor.magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2 directory.Coupon.php with the following contents.
+<?php
+class CouponDemo_AutoGen_Model_Api2_Coupon extends Mage_Api2_Model_Resource
+{
+}
+
+Coupon.php and exit the text editor.magento-install-dir/app/code/community/CouponDemo/AutoGen/Model/Api2/Coupon/Rest/Admin directory.V1.php with the following contents.
+<?php
+/* Coupon AutoGen REST API
+*
+* @category CouponDemo
+* @package CouponDemo_AutoGen
+* @author Chuck Hudson (used with permission). For more recipes, see Chuck's book http://shop.oreilly.com/product/0636920023968.do
+*/
+class CouponDemo_AutoGen_Model_Api2_Coupon_Rest_Admin_V1 extends CouponDemo_AutoGen_Model_Api2_Coupon
+{
+ /**
+ * Generate one or more coupon codes using the Generate Coupons rule defined in Magento.
+ * Expected parameters are:
+ * {
+ * 'qty': int, - number of coupon codes to instruct Magento to generate
+ * 'length': int, - length of each generated coupon code
+ * 'format': string, - alphanum (for alphanumeric codes), alpha (for alphabetical codes), and num (for numeric codes)
+ * }
+ *
+ * @param array $couponData
+ * @return string|void
+ */
+ protected function _create($couponData)
+ {
+ $ruleId = $this->getRequest()->getParam('rule_id');
+ $couponData['rule_id'] = $ruleId;
+ $rule = $this->_loadSalesRule($ruleId);
+ // Reference the MassGenerator on this rule.
+ /** @var Mage_SalesRule_Model_Coupon_Massgenerator $generator */
+ $generator = $rule->getCouponMassGenerator();
+ // Validate the generator
+ if (!$generator->validateData($couponData)) {
+ $this->_critical(Mage::helper('salesrule')->__('Coupon AutoGen API: Invalid parameters passed in.'),
+ Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
+ } else {
+ // Set the data for the generator
+ $generator->setData($couponData);
+ // Generate a pool of coupon codes for the Generate Coupons rule
+ $generator->generatePool();
+ }
+ }
+ /**
+ * Retrieve list of coupon codes.
+ *
+ * @return array
+ */
+ protected function _retrieveCollection()
+ {
+ $ruleId = $this->getRequest()->getParam('rule_id');
+ $rule = $this->_loadSalesRule($ruleId);
+ /** @var Mage_SalesRule_Model_Resource_Coupon_Collection $collection */
+ $collection = Mage::getResourceModel('salesrule/coupon_collection');
+ $collection->addRuleToFilter($rule);
+ $this->_applyCollectionModifiers($collection);
+ $data = $collection->load()->toArray();
+ return $data['items'];
+ }
+ /**
+ * Load sales rule by ID.
+ *
+ * @param int $ruleId
+ * @return Mage_SalesRule_Model_Rule
+ */
+ protected function _loadSalesRule($ruleId)
+ {
+ if (!$ruleId) {
+ $this->_critical(Mage::helper('salesrule')
+ ->__('Rule ID not specified.'), Mage_Api2_Model_Server::HTTP_BAD_REQUEST);
+ }
+ $rule = Mage::getModel('salesrule/rule')->load($ruleId);
+ if (!$rule->getId()) {
+ $this->_critical(Mage::helper('salesrule')
+ ->__('Rule was not found.'), Mage_Api2_Model_Server::HTTP_NOT_FOUND);
+ }
+ return $rule;
+ }
+}
+
+V1.php and exit the text editor.File permissions and ownership are important for any Linux application. Magento provides general guidelines for permission and ownership although following them are not a requirement for this guide. The configuration files and directories can be owned by root or other users and it won't prevent the procedures discussed in this guide from completing successfully.
Consult your network administrator if you are not sure how to set file permissions and ownership. The procedure that follows is a suggestion only.
+The Magento guidelines discussed in the following procedure are taken from this Magento Wiki article and set the following:
+your-login-name:apache-user-group.ps -ef | grep apache2. The following procedure assumes it is www-data.To optionally set permissions and ownership according to Magento guidelines:
+root privileges, enter the following commands in the order shown to change ownership of the files and directories you created as discussed in this guide:cd magento-install-dir/app/code/community
+chown -R your-login-name:www-data CouponDemo
+find . -type f -exec chmod 644 {} +
+find . -type d -exec chmod 755 {} +root privileges, enter the following commands in the order shown to change the permissions and ownership of CouponDemo_AutoGen.xmlcd magento-install-dir/app/etc/modules +chown your-login-name:www-data CouponDemo_AutoGen.xml +chmod 644 CouponDemo_AutoGen.xml
For security reasons, Magento allows only authorized external programs to call the Magento REST API.
+The following sections discuss how to enable the test script (discussed in the next section) to call the Coupon AutoGen API:
+To use the Magento Admin Panel to create a role for the Coupon AutoGen API:
+Coupon Auto Generate Demo.Select the checkbox next to the node labeled CouponDemo API.
+Magento automatically checks the child checkboxes as the following figure shows.
+
Now that you have a role, you must add users to give them permission to call the Coupon AutoGen API as follows:
+
This section discusses how to enable any user with a REST Admin role to use the Coupon AutoGen API.
+To set REST attributes for the REST Admin role:
+
This section discusses how to create a consumer so you can test the Coupon AutoGen API before you deploy it in a production system. After successfully testing the API, you can remove this user.
+
Coupon AutoGen Test Driver.oauth_consumer. It might be more convenient for you to use phpmyadmin or database tools to retrieve them from the database after you save the role.This section discusses how to create a simple PHP file that acts as an external program and, with permissions you granted the OAuth consumer, enables the program to use the HTTP POST method to auto generate coupon codes.
+You can use any type of OAuth/REST call, in fact, such as using the Firefox REST Client plug-in as discussed here.
+The following sections discuss how to create and run the test script:
+ + +The test script you create calls the Coupon AutoGen API, thereby causing Magento to generate the specified coupon codes and return them to the caller (rest_test.php) in the form of a JSON-encoded string. Finally, the server responds to the browser's request with an HTML page containing the generated coupon codes.
The PHP code that follows:
+consumerKey and consumerSecret to set up the OAuth client.$couponGenerationData. The data should include the following:
+fetch command with the resourceUrl for the web service call.Finally, the server responds to the browser's request with an HTML page containing the generated coupon codes.
+To create the test script, named rest_test.php:
magento-install-dir/rest_test.php with the following contents.
+
+<?php
+/********************************************************************
+File name: rest_test.php
+Description:
+A PHP test script that calls the Coupon AutoGen extension
+to Magento's REST API.
+The Coupon AutoGen API takes:
+-- the rule ID of the "Generate Coupons" rule to execute
+-- the number of coupon codes to generate
+-- the length of each coupon code
+-- the format of each coupon code
+The API returns the generated coupon codes, in JSON-encoded form
+ ********************************************************************/
+// Replace <<...>> below with the key and secret values generated for the Coupon AutoGen Test Driver
+$consumerKey = '<<YOUR CONSUMER KEY>>'; // from Admin Panel's "REST - OAuth Consumers page"
+$consumerSecret = '<<YOUR CONSUMER SECRET>>'; // from Admin Panel's "REST - OAuth Consumers page"
+
+// Set the OAuth callback URL to this script since it contains the logic
+// to execute *after* the user authorizes this script to use the Coupon AutoGen API
+$callbackUrl = "http://<<host-or-ip:port>>/<<path>>/rest_test.php";
+
+// Set the URLs below to match your Magento installation
+$temporaryCredentialsRequestUrl = "http://<<host-or-ip:port>>/<<path>>/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
+$adminAuthorizationUrl = 'http://<<host-or-ip:port>>/<<path>>/admin/oauth_authorize';
+$accessTokenRequestUrl = 'http://<<host-or-ip:port>>/<<path>>/oauth/token';
+$apiUrl = 'http://<<host-or-ip:port>>/<<path>>/api/rest';
+
+session_start();
+if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
+ $_SESSION['state'] = 0;
+}
+try {
+ $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
+ $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
+ $oauthClient->enableDebug();
+ if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
+ $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
+ $_SESSION['secret'] = $requestToken['oauth_token_secret'];
+ $_SESSION['state'] = 1;
+ header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
+ exit;
+ } else if ($_SESSION['state'] == 1) {
+ $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
+ $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
+ $_SESSION['state'] = 2;
+ $_SESSION['token'] = $accessToken['oauth_token'];
+ $_SESSION['secret'] = $accessToken['oauth_token_secret'];
+ header('Location: ' . $callbackUrl);
+ exit;
+ } else {
+ // We have the OAuth client and token. Now, let's make the API call.
+ $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
+ // Set the array of params to send with the request
+ $ruleId = <<RULE_ID>>; // Set to the rule ID of the Generate Coupons rule
+ $couponGenerationData = array();
+ $couponGenerationData['qty'] = 2; // Number of coupons codes to create
+ $couponGenerationData['length'] = 7; // Length of each coupon code
+ // Options for format include:
+ // alphanum (for alphanumeric codes), alpha (for alphabetical codes), and num (for numeric codes)
+ $couponGenerationData['format'] = "alphanum"; // Use alphanumeric for the coupon code format
+ // Generate coupon codes via POST
+ $resourceUrl = "$apiUrl/coupondemo/rules/{$ruleId}/codes";
+ $oauthClient->fetch($resourceUrl, json_encode($couponGenerationData), OAUTH_HTTP_METHOD_POST, array(
+ 'Accept' => 'application/json',
+ 'Content-Type' => 'application/json',
+ ));
+ // Retrieve list of created coupons via GET
+ $collectionFilters = array('limit' => $couponGenerationData['qty'], 'order' => 'coupon_id', 'dir' => 'dsc');
+ $oauthClient->fetch($resourceUrl, $collectionFilters, OAUTH_HTTP_METHOD_GET, array(
+ 'Accept' => 'application/json',
+ 'Content-Type' => 'application/json',
+ ));
+ $coupons = json_decode($oauthClient->getLastResponse(), true);
+ // Display the newly generated codes to demonstrate that the Coupon AutoGen API works
+ // In reality, you might put these codes in emails to customers, store them in a database, etc.
+ echo "New coupon codes:
";
+ foreach ($coupons as $coupon) {
+ echo " --> " . $coupon['code'] . "
";
+ }
+ }
+} catch (OAuthException $e) {
+ print_r($e->getMessage());
+ echo "
";
+ print_r($e->lastResponse);
+}
+
+| String to change | +How to change it | +
|---|---|
| <<YOUR CONSUMER KEY>> | +Coupon AutoGen Test Driver OAuth consumer's key. +You can view this in the Admin Panel: System > Web Services > REST - OAuth Consumers or you can get the value from the |
+
| <<YOUR CONSUMER SECRET>> | +Coupon AutoGen Test Driver OAuth consumer's secret. +You can view this in the Admin Panel: System > Web Services > REST - OAuth Consumers or you can get the value from the |
+
| <<host-or-ip:port>>/<<path>> | +Your Magento instance's fully qualified hostname or IP address and port, if you are using a port other than 80, and the path to your Magento installation. If you are running Magento on localhost, enter For example, if your Magento server's hostname is |
+
| <<RULE_ID>> | +Generate Coupons rule ID. +Get this value by clicking Promotions > Shopping Cart Price Rules . |
+
To run the test script:
+http://magento-server-host-or-ip[:port]/rest_test.php


To optionally see these codes in the Admin Panel:
+
Only after successfully completing the test, you should re-enable Magento's caching system, so performance returns to normal.
+
To re-enable the Magento cache:
+Enable from the Actions list.Refresh from the Actions list.Congratulations! You have successfully added the Coupon AutoGen API to Magento's REST API. Following the same procedure, you can expose lots of Magento functionality to external programs.
+ +The following sections discuss solutions to issues you might encounter when setting up this demonstration:
+Problem: OAuth package installation fails with the error ERROR: `make' failed.
Description: In some cases, the pecl install oauth command does not install a C compiler. If you encounter the following error, you must install the make package; otherwise, OAuth won't compile:
1: make: not found +ERROR: `make' failed+
Solution:
+root privileges:
+apt-get install make +pecl install oauth
Build process completed successfully displays to indicate OAuth compiled successfully.php.ini file to find the OAuth library:
+configuration option "php_ini" is not set to php.ini location +You should add "extension=oauth.so" to php.ini
php.ini in a text editor.phpinfo.php page output.
+Add the following anywhere in php.ini:
+[OAuth] +extension=oauth.so
php.ini and exit the text editor.service apache2 restart+
Problem: After setting up the CouponDemo configuration files, the CouponDemo API Calls checkboxes do not display in the Admin Panel. A sample is shown in a figure earlier in this guide.
+Description: The CouponDemo API Calls checkboxes display to indicate you set up the module correctly. If they don't display, either the Magento cache hasn't been entirely cleared or there's something wrong with the directory structure or configuration files.
+Solution: Use the following steps to isolate and correct the issue:
+rm -r magento-install-dir/var/cache +rm -r magento-install-dir/var/session
.xml configuration files to make sure there is no leading white space (that is, there are no blank lines at the beginning of the files..xml files.The following sections discuss issues you might encounter when you run rest_test.php in a web browser:
The following error displays in the web browser:
+Invalid auth/bad request (got a 401, expected HTTP/1.1 20X or a redirect)
+{"messages":{"error":[{"code":401,"message":"oauth_problem=consumer_key_rejected"}]}}
+Description: Your OAuth authentication attempt failed because the credentials are incorrect.
+Solution: Open rest_test.php in a text editor and verify the values of the following:
$consumerKey = 'value'; +$consumerSecret = 'value';+
You can find these values in the oauth_consumer database table or in the Admin Panel: System > Web Services > REST - OAuth Consumers.
After verifying the correct values, save your changes to rest_test.php and try again.
The following error displays in the web browser:
+Invalid auth/bad request (got a 404, expected HTTP/1.1 20X or a redirect)
+{"messages":{"error":[{"code":404,"message":"Rule was not found."}]}}
+Description: The shopping cart promotion rule could not be found.
+Solution: Open rest_test.php in a text editor and verify the value of the following:
$ruleId = value;+
You can find this value in the Admin Panel: Promotions > Shopping Cart Price Rules.
+Change the value in rest_test.php, save it, and try again.
The following error displays in the web browser:
+Invalid auth/bad request (got a 404, expected HTTP/1.1 20X or a redirect) +Not Found +The requested URL /magento/oauth/initiate was not found on this server.+
Description: The HTTP redirect failed, most likely because web server rewrites are not properly enabled.
+Solution: Make sure web server rewrites are enabled. The procedure you use depends on your web server and operating system. An example for Ubuntu can be found here.
+ +Refer to Magento APIs—REST for documentation explaining how the Magento's REST API framework works.
+ diff --git a/guides/v1.8/other/ht_install-patches.html b/guides/v1.8/other/ht_install-patches.html new file mode 100644 index 0000000000..e6aee0a2a5 --- /dev/null +++ b/guides/v1.8/other/ht_install-patches.html @@ -0,0 +1,150 @@ +--- +layout: v1x +title: How to Apply and Revert Magento Patches +--- + + + +This article discusses how to apply and revert Magento patches you get in any of the following ways: +
If you don't already have a patch, contact Magento Support.
+.sh. If your patch file name ends in .patch or something else, contact Magento Support before proceeding.For more step-by-step details that are provided here, see one of the following:
+ + +Magento Support provides some patches for Magento CE and EE on magentocommerce.com. This section discusses how to get those patches.
+If Magento Support provided a patch to you, skip this section and continue with How to Apply a Magento Patch.
+See one of the following sections for specific information about Magento CE or EE:
+ + +To get patches for Magento CE:
+To get patches for Magento EE:
+
To apply a Magento patch:
+.sh file to your Magento installation root directory..sh. If your patch file name ends in .patch or something else, contact Magento Support before proceeding./var/www/html/magento.root):
+ chmod +x <patch-file-name>.sh +./<patch-file-name>.sh+ A message such as the following displays to confirm the patch installed successfully: +
Patch was applied/reverted successfully.
ps -o "user group command" -C httpd,apache2apache and the Apache web server user on Ubuntu is www-data.root privileges, enter the following command from the Magento installation directory:
+ chown -R web-server-user-name .+ For example, on Ubuntu where Apache usually runs as
www-data, enter
+ chown -R www-data .
We released a security patch in October, 2016 that might cause issues for some users. This section applies to you if any of the following is true:
+PATCH_SUPEE-8788_<magento version>_v1.)We recommend the following:
+To replace SUPEE-7877 version 1 with version 2 or later:
+<your Magento install dir>/app/etc/applied.patches.list in a text editor.PATCH_SUPEE-8788_<magento version>_v1 in the name.test_oauth.php from your Magento base directory.skin/adminhtml/default/default/media/flex.swf +skin/adminhtml/default/default/media/uploader.swf +skin/adminhtml/default/default/media/uploaderSingle.swf+ + If the files are present, delete them to avoid a potential security exploit. As of Magento CE 1.9.0.0 and Magento EE 1.14.0.0, we no longer distribute
.swf files with the Magento software.To apply patch SUPEE-8788:
+<your Magento install dir>/app/etc/applied.patches.list in a text editor.test_oauth.php from your Magento base directory.skin/adminhtml/default/default/media/flex.swf +skin/adminhtml/default/default/media/uploader.swf +skin/adminhtml/default/default/media/uploaderSingle.swf+ + If the files are present, delete them to avoid a potential security exploit. As of Magento CE 1.9.0.0 and Magento EE 1.14.0.0, we no longer distribute
.swf files with the Magento software.If you're not sure which patches are already applied, open <your Magento install dir>/app/etc/applied.patches.list.
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
+root):sh patch-file-name.sh -R
If you get an error when you run the patch, use the following suggestions:
+/var/www/magento/var/www/html/magentoroot privileges.Magento Enterprise Edition (EE) versions 1.8.0.0 and later enable you to configure either of the following as a + catalog search engine:
+Solr enables you to provide your web store users with a powerful full-text search engine that includes:
+See one of the following sections for more information:
+This guide is intended for Magento EE administrators and systems integrators who have some familiarity with search + engines—ideally, who also have Solr configuration experience. No programming is required to perform the tasks + discussed in this guide.
+This guide discusses a simple Solr configuration that uses the example Solr configuration provided with Solr, default + Solr integration options provided with Magento EE, and also explains how to configure Magento EE to use Solr. Advanced + configuration tasks—such as setting up dictionaries—are beyond the scope of this guide.
+The following table provides a quick comparison between Magento with the default MySQL full text search and Magento + with Solr search.
+| Feature | +Magento with MySQL full-text search | +Magento with Solr search | +
|---|---|---|
| Full text search | +
+ Yes and also supports two additional search modes: +
| Yes† | +
| Search recommendations | +Yes | +Yes | +
| Faceted search (used in layered navigation) | +Yes | +Yes | +
| Range (such as price range) | +Yes | +Yes | +
| Sort-by options (for example, sort by relevance) | +Yes | +Yes | +
| Zero results tips or results correction | +No | +Yes | +
| Suggestions | +No | +Yes | +
| Clustering | +No | +Yes | +
| Attribute weight based on attribute settings | +No | +Yes | +
| Search localized characters | +No | +Yes | +
| Word delimiter (for example, searching for spider man or spiderman + return spider-man) | +No | +Yes | +
The following table summarizes what versions of Magento EE work with what versions of Solr.
+| Magento EE version | +Compatible Solr version(s) | +Comment | +
|---|---|---|
| EE 1.14.x.x | +Any version + up to 3.6.2. | +No patch is required to use EE 1.14.x.x with Solr 3.6.2. Click here to browse the list of all + available Solr versions. | +
| EE 1.13.x.x | +Any version + up to 3.6.2. | +Click here to + browse the list of all available Solr versions. | +
| EE 1.12.0.x | +Any version + up to 3.5.0 | +
+ If you use a later version, such as 3.6.x, see Information About + Enterprise Edition (EE) Patches for Apache Solr to get a patch. +Click here to browse the list of + all available Solr versions. + |
+
| EE 1.8.0.0 to 1.11.0.2 | +Any version + up to 3.4.0. + | +
+ To use a Solr version later than 1.4.x, see Information About + Enterprise Edition (EE) Patches for Apache Solr to get a patch. + Click here to browse the list of all + available Solr versions. + |
+
Solr runs as a standalone full-text search server in a servlet container such as Jetty (which is used by the Solr + example configuration) and Tomcat.
+Solr uses the Lucene Java search library for full-text indexing and search. Your applications interact with Solr + using HTTP POST (in JSON, + XML, CSV, or binary formats) to index + documents and using HTTP + GET to retrieve search results back as JSON, XML, or a + variety of other formats (Python, Ruby, PHP, CSV, binary, and so on). If you're a programmer, try the Solr tutorial. Whether + you're a programmer or not, read the Solr FAQ.
+No programming is required to implement Solr as discussed in this guide.
+Solr's powerful external configuration allows it to be tailored to almost any type of application without Java + coding, and it has an extensive plug-in architecture when more advanced customization is required. Solr is highly + scalable, providing distributed search and index replication.
+In this guide, you'll use the example configuration provided with Solr and Magento's provided Solr configuration to + implement a simple, quick integration with Solr.
+Some reasons to use Solr with Magento include:
+Following is a simple comparison of the default MySQL full-text search and Solr search using Magento EE 1.14.0.0 and + Solr 3.6.2. Magento EE catalog content is provided by sample data you can download from Magento.
+Among the many options Solr gives you is the option to suggest names of products in the event the user + enters an incomplete or incorrect search term in your Magento store's Search field.
+ +Using the default MySQL full-text search, if a user enters an incorrect search term (such as shirrt instead + of shirt, no results display as the following figure shows.
+
+
+Using Solr, if a user enters an incorrect search term, suggestions display as the following figure shows.
+
+In addition, if a user enters an incomplete search term, Magento provides dictionary-based suggestions as the + following figure shows.
+
+
+The tasks discussed in this guide require the following:
+java -version+ If the message java: command not found displays, you must install the Java SDK as discussed in the next + section. If Java is installed, make sure it's version 1.6 or later.
The following sections discuss how to install the prerequisite software:
+ + +To install the Java 6 SDK, enter the following command as a user with root privileges:
+apt-get install openjdk-6-jdk+
To install Java 7, enter the following command as a user with root privileges:
+apt-get install openjdk-7-jdk+
The Apache Solr package installs both Solr and Jetty. If Jetty is already installed, see the Solr with Jetty Wiki for more information.
+To install Solr and Jetty:
+If you're not sure what version of Solr to use, see Support Matrix for Solr and + Magento EE.
+cd empty-directory +wget http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz
wget http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz +--2012-11-01 16:20:16-- http://archive.apache.org/dist/lucene/solr/3.6.2/apache-solr-3.6.2.tgz +Resolving archive.apache.org... 140.211.11.131 +Connecting to archive.apache.org|140.211.11.131|:80... connected. +HTTP request sent, awaiting response... 200 OK +Length: 78673382 (75M) [application/x-tar] +Saving to: `apache-solr-3.6.2.tgz' + +100%[======================================>] 78,673,382 1.41M/s in 36s + +2012-11-01 16:20:52 (2.08 MB/s) - `apache-solr-3.6.2.tgz' saved [78673382/78673382]+
tar -xvf apache-solr-3.6.2.tgz+
The following topics discuss how to configure Solr to work with Magento EE:
+Magento comes packaged with a sample Solr configuration you can use and customize. To get started, you'll copy the + Magento configuration to Solr, replacing any existing files. After that you can start Solr and begin configuring + Magento to work with it.
+To copy the Magento Solr configuration:
+cd [your Solr install dir]/example/solr/conf +cp -R [your Magento install dir]/lib/Apache/Solr/conf/* .
cd /etc/solr/apache-solr-3.6.2/example/solr/conf +cp -R /var/www/magento/lib/Apache/Solr/conf/* .
<dataDir>${solr.data.dir:./solr/data}</dataDir>
+ Change it to:<dataDir>${solr.data.dir:}</dataDir>
+ java -jar [your Solr install dir]/example/start.jar
This section discusses how to configure Magento EE to use the Solr search engine.
+To configure Magento to work with Solr:
+| Option | +Description | +
|---|---|
| Search Engine | +Click Solr | +
| Solr Server Hostname | +Enter the fully qualified hostname or IP address of the machine running Solr. (If + Solr is running on the same host as Magento, you can optionally use 127.0.0.1.) | +
| Solr Server Port | +Enter Solr's listen port. (The example Jetty servlet container uses 8983. The + default for Tomcat is usually 8080.) | +
| Solr Server Username | +Optional. Enter a username for Solr authentication, if desired. + | +
| Solr Server Password | +Optional. Enter the user's password, if desired. | +
| Solr Server Timeout | +Enter a connection timeout value, in seconds. | +
| Solr Server Path | +
+
+ Specifies the path and name of the Solr web application. The path used by the example Solr + configuration is solr. +If you customized Solr, the value you enter in this field must exactly match the value of + webapp_name=value in [your Solr install + dir]/example/solr/conf/scripts.conf. + |
+
| Indexation Mode | +
+ Specifies how Solr processes indexed content. +From the Indexation Mode list, click one of the following: +
|
+
+ | Button state | +Meaning | +
|---|---|
![]() |
+ The test connection succeeded. Click Save Config and continue + with the next section. | +
![]() |
+ The test connection failed. Try the following:
+
|
+
This section discusses how to configure Magento to work with Solr using options in the Admin Panel. Although + additional Solr customization is possible, it is beyond the scope of this guide.
+To configure Magento to work with Solr:
+| Option | +Description | +
|---|---|
| Minimal Query Length | +Enter the minimum number of characters permitted for a catalog search. | +
| Maximum Query Length | +Enter the maximum number of characters permitted for a catalog search. | +
| Search Engine + Solr Server Hostname + Solr Server Port + Solr Server Username + Solr Server Password + Solr Server Timeout + Solr Server Path + Indexation Mode + |
+ Discussed in Configuring Solr to Work With Magento. + | +
| Enable Search Suggestions | +
+ Suggestions are the native Solr mechanism of advising users in the event they enter + incomplete or incorrect user input. Suggestions, when enabled, are automatically provided as part of + any search request. +Solr completes incomplete or incorrect input using a dictionary that is based on the main index (and + can be customized using configuration files to use any other arbitrary dictionary). Suggestions + display with default text "Did you mean:" in the search results page if needed. +Notes: +
|
+
| Search Suggestions Count | +Enter the maximum number of suggestions to return. | +
| Show Results Count for Each Suggestion | +
+ The default option, No, displays only the suggestion and not the number of results + for each suggestion. +Click Yes to display the number of results for each suggestion. + |
+
| Enable Search Recommendations | +
+ Recommendations display terms related to a requested word or phrase on the search results + page. +This functionality is not based on third party engine functionality, but is implemented as part of + the Enterprise_Search module and can be shown with the Solr search suggestions block. +By default, Magento uses the Enterprise_Search_Model_Adapter_HttpStream module for + recommendations. If you install the Apache + Solr PHP extension, Magento automatically uses the + Enterprise_Search_Model_Adapter_PhpExtension adapter instead. Both adapters function in the + same way with no difference in performance. However, the PhpExtension adapter is not tested + by Magento so you must thoroughly test any modifications you make to it before deploying it in a + production environment. + |
+
| Search Recommendations Count | +Enter the maximum number of recommendations to return. | +
| Show Results Count for Each Recommendation | +
+ The default option, No, displays only the recommendation and not the number of + results for each recommendation. +Click Yes to display the number of results for each recommendation. + |
+
| Enable Solr Engine for Catalog Navigation | +
+ Click Yes (the default) to use Solr to enable layered navigation in the category view. +Click No to use the database for layered navigation in the category view. + |
+
After you change the Solr configuration, you must reindex the catalog search index and refresh the full page + cache as follows:
+
+ cd /var/www/html/magento/shell+
php indexer.php --reindex catalogsearch_fulltext
In a production environment, you should start and stop Solr using a script.
+Create a script named /etc/init.d/solr with options similar to the following:
+#!/bin/sh
+
+#Starts, stops, and restarts Apache Solr.
+#chkconfig: 35 92 08
+#description: Starts and stops Apache Solr
+
+SOLR_DIR="[your Solr install dir]"
+JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=jetty-stop-port -DSTOP.KEY=jetty-stop-key -jar start.jar"
+LOG_FILE="path-to-solr-log-file"
+JAVA="java_home"
+
+case $1 in
+start)
+echo -n "Starting Solr"
+cd $SOLR_DIR
+$JAVA $JAVA_OPTIONS 2> $LOG_FILE &
+;;
+stop)
+echo -n "Stopping Solr"
+cd $SOLR_DIR
+$JAVA $JAVA_OPTIONS --stop
+;;
+restart)
+$0 stop
+sleep 1
+$0 start
+;;
+*)
+echo "Usage: $0 {start|stop|restart}" >&2
+exit 1
+;;
+esac
+ All parameters shown in the following table are required.
+| Value | +Description | +
|---|---|
| [your Solr install dir] | +The absolute file system path to your Solr installation. (For example, + /etc/solr/apache-solr-3.6.2 | +
| jetty-stop-port + jetty-stop-key |
+
+ Security parameters used to prevent malicious attempts to stop Jetty. +For -DSTOP.PORT=, specify any unused port. +For -DSTOP.KEY=, specify a string. If you omit a value for -DSTOP.KEY=, Jetty + generates a random key you must enter to stop Jetty. +For more information, see Securing Jetty. + |
+
| path-to-solr-log-file | +Absolute file system path to the Solr log file. (For example, + /var/log/solr.log) | +
| java_home | +Absolute file system path to your Java executable. (For example, + /usr/bin/java) | +
An example follows:
+#!/bin/sh
+
+#Starts, stops, and restarts Apache Solr.
+#chkconfig: 35 92 08
+#description: Starts and stops Apache Solr
+
+SOLR_DIR="/etc/solr/apache-solr-3.6.2/example"
+JAVA_OPTIONS="-Xmx1024m -DSTOP.PORT=8079 -DSTOP.KEY=mykey -jar start.jar"
+LOG_FILE="/var/log/solr.log"
+JAVA="/usr/bin/java"
+
+case $1 in
+start)
+echo -n "Starting Solr"
+cd $SOLR_DIR
+$JAVA $JAVA_OPTIONS 2> $LOG_FILE &
+;;
+stop)
+echo -n "Stopping Solr"
+cd $SOLR_DIR
+$JAVA $JAVA_OPTIONS --stop
+;;
+restart)
+$0 stop
+sleep 1
+$0 start
+;;
+*)
+echo "Usage: $0 {start|stop|restart}" >&2
+exit 1
+;;
+esac
+ To complete the script:
+chmod +x /etc/init.d/solr+
For additional information about Solr, see the following:
+
+{% include v1x/eol_message.html %}
+
+
+
+
+This guide helps you create and configure an iOS app for Magento MobileConnect. Your app enables customers to view and make purchases for your store.
+We provide you with a sample app in the MagentoMobile extension package that you can open as an XCode project to do the customization.
+ +Before you begin:
+To create the iOS app:
+MagentoShop/MagentoShop.xcodeproj in Xcode.Configuration.plist.serverURL to your store's base URL (for example, http://mystore.example.com).applicationCode to the application code displayed in the Magento Admin Panel. The following sections discuss how you can customize your Magento MobileConnect iOS app.
+ +Launch images are located in MagentoShop/Resources/Images/LaunchImages.xcassets.
Refer to Apple's Human Interface Guidelines for details.
+ +App icons are located in MagentoShop/Resources/Images/ApplicationIcon.xcassets.
Refer to Apple's HIG for best practices.
+ +Thumbnail images display when a category or a product does not have an image defined for it.
+You can find customizable images in MagentoShop/Resources/Images/Images.xcassets/thumbnails.
A customer applies a coupon code when checking out in a web store that runs EE 1.12.0.2 and is configured to use the Payflow Pro or Payflow Express payment methods. The following error displays:
+PayPal gateway rejected the request. Field format error: 10431-Item amount is invalid
+
+To resolve this issue, contact Magento Support and request the patch for support issue ID SUPEE-1474.
+Then apply the patch as discussed in How to Apply and Revert Magento Patches.
diff --git a/guides/v1.8/other/php5.4_patch.html b/guides/v1.8/other/php5.4_patch.html new file mode 100644 index 0000000000..7685f5b14a --- /dev/null +++ b/guides/v1.8/other/php5.4_patch.html @@ -0,0 +1,23 @@ +--- +layout: v1x +title: Getting the PHP 5.4 patch for Magento Enterprise Edition (EE) and Community Edition (CE) +--- + + + +Magento has a patch that enables you to use PHP 5.4.x with Magento Enterprise Edition (EE) and Magento Community Edition (CE).
+This patch applies to:
+To get the patch for Magento CE:
+To get the patch for Magento EE:
+We recently identified potential exploits that:
+Creating files with a .csv extension can lead to executing files like php.csv (only under + circumstances discussed in this article). The ability to run code with a .csv extension is dangerous + itself and could be combined with other attacks; for example, targeting other software installed on the server. +
+You can resolve this issue by changing your server's configuration as discussed in Resolving + the File System Vulnerability.
+Although Magento code is protected by a hash value, the possibility of a successful exploit cannot be eliminated + because of the low entropy of the hash secret value.
+We strongly recommend you to take precautions discussed in this article and apply a patch for your + version of Magento Enterprise Edition or Community Edition.
+ +Magento software versions affected: The issue affects all shipping versions of Magento Community Edition + (CE) and Enterprise Edition (EE).
+Operating system versions affected:
+The following table shows the patch you should get for your version of CE or EE.
+| Version | +Patch | +
|---|---|
| EE 1.13 and 1.14, CE 1.8 and 1.9 | +SUPEE-1533_EE_1.13.x_v1.patch | +
| EE 1.12, CE 1.7 | +SUPEE-1533_EE_1.12.x_v1.patch | +
| EE 1.11, CE 1.6 | +SUPEE-1533_EE_1.11.x_v1.patch + | +
| EE 1.10.1, CE 1.5.1 | +SUPEE-1533_EE_1.10.1.x_v1.patch | +
| EE 1.10.0.1, CE 1.5.0.1 | +SUPEE-1533_EE_1.10.0.x_v1.patch | +
| EE 1.9 | +SUPEE-1533_EE_1.9.x_v1.patch | +
To get and apply your patch, see How + to Apply and Revert Magento Patches.
+To determine if you're vulnerable to execution of PHP code with a non-PHP extension, search your web server + configuration file for the following string:
+AddHandler application/x-httpd-php .php+
The Apache configuration file is typically /etc/httpd/conf/httpd.conf
+To confirm you're vulnerable:
+<?php +phpinfo()+

To resolve this vulnerability, you must log in to the Magento server as a user with root privileges or + as a user with permissions to change the web server configuration.
+To resolve the vulnerability:
+# AddHandler application/x-httpd-php .php+
<FilesMatch \.php$> +SetHandler application/x-httpd-php +</FilesMatch>+ Some operating systems, like Red Hat Enterprise, might require different syntax such as: +
<FilesMatch \.php$> + SetHandler php5-script +</FilesMatch>+ The regular expression in this setting matches .php only to the final extension in the file name, + applying the handler only to PHP files and preventing PHP from executing. +
This article lists patches that Magento Support has made available for Magento EE versions 1.10.1.0 and later. The patches themselves are available on the Magento EE support portal.
+To get the patches:
+http://magento.com with your Magento EE credentials.Following is a list of available patches:
+This fix affects Magento EE 1.12.0.0, 1.12.0.1, and 1.12.0.1
+ +To install this fix:
+sh PATCH_SUPEE-111_EE_1.12.0.0_v6.sh
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
+sh PATCH_SUPEE-111_EE_1.12.0.0_v6.sh -R
If you get an error when you run the patch, use the following suggestions:
+This fix affects Magento EE 1.11.1.0.
+ +To install this fix:
+sh PATCH_SUPEE-107_EE_1.11.1.0_v1.sh
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
+sh PATCH_SUPEE-107_EE_1.11.1.0_v1.sh -R
If you get an error when you run the patch, use the following suggestions:
+This fix affects Magento EE 1.11.0.0, 1.11.0.1, and 1.11.0.2.
+ +To install this fix:
+sh PATCH_SUPEE-108_EE_1.11.0.2_v1.sh
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
+sh PATCH_SUPEE-108_EE_1.11.0.2_v1.sh -R
If you get an error when you run the patch, use the following suggestions:
+This fix affects Magento EE 1.10.1.0 and 1.10.1.1.
+ +To install this fix:
+sh PATCH_SUPEE-110_EE_1.10.1.1_v2.sh
If applying the patch results in errors, contact Magento Support. If you are instructed to do so, revert the patch:
+sh PATCH_SUPEE-110_EE_1.10.1.1_v2.sh -R
If you get an error when you run the patch, use the following suggestions:
+Welcome to the Magento 1.x REST API home page.
+ +\ No newline at end of file diff --git a/guides/v19.x/api/rest/Resources/Orders/order_addresses.html b/guides/v19.x/api/rest/Resources/Orders/order_addresses.html new file mode 100644 index 0000000000..3eb7895a20 --- /dev/null +++ b/guides/v19.x/api/rest/Resources/Orders/order_addresses.html @@ -0,0 +1,288 @@ +--- +layout: v1x_rest +title: Order Addresses +--- + + +
Allows you to retrieve information about billing and shipping addresses of the required order.
+ +URL Structure: http://magentohost/api/rest/orders/:orderid/addresses
+Version: 1
Description: Allows you to retrieve information on billing and shipping addresses from the required order.
+Notes: Customers can retrieve addresses only from their orders.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/32/addresses |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia +844 Jefferson Street; 4510 Willis Avenue</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + </data_item> + <data_item> + <region>Massachusetts</region> + <postcode>01852</postcode> + <lastname>Doe</lastname> + <street>1073 Smith Street</street> + <city>Lowell</city> + <telephone>508-857-6870</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Allows you to retrieve information on the order billing address.
+Notes: Customers can retrieve information on billing addresses only from their own orders.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/32/addresses/billing |
Response example:
+<?xml version="1.0"?> +<magento_api> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia +844 Jefferson Street; 4510 Willis Avenue</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ + +Description: Allows you to retrieve information on the order shipping address.
+Notes: Customers can retrieve information on shipping addresses only from their own orders.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/32/addresses/shipping |
Response example:
+<?xml version="1.0"?> +<magento_api> + <region>Massachusetts</region> + <postcode>01852</postcode> + <lastname>Doe</lastname> + <street>1073 Smith Street</street> + <city>Lowell</city> + <telephone>508-857-6870</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ +| Attribute Name | +Attribute Description | +
|---|---|
| Customer Last Name | +Customer last name | +
| Customer First Name |
+Customer first name | +
| Customer Middle Name |
+Customer middle name or initial | +
| Customer Prefix |
+Customer prefix | +
| Customer Suffix |
+Customer suffix | +
| Company |
+Company name | +
| Street |
+Street address | +
| City |
+City | +
| State |
+State | +
| ZIP/Postal Code |
+ZIP or postal code | +
| Country |
+Country name | +
| Phone Number |
+Customer phone number | +
| Address Type |
+Address type. Can have the following values: billing or shipping | +
Allows you to retrieve information about comments of the required order.
+ +URL Structure: http://magentohost/api/rest/orders/:orderid/comments
+Version: 1
Description: Allows you to retrieve information about comments of the required order.
+ +Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/33/comments |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <created_at>2012-03-09 11:20:49</created_at> + <comment></comment> + <is_customer_notified>1</is_customer_notified> + <is_visible_on_front>0</is_visible_on_front> + <status>pending</status> + </data_item> + <data_item> + <created_at>2012-03-09 11:21:32</created_at> + <comment>This is a new order for John Doe.</comment> + <is_customer_notified>1</is_customer_notified> + <is_visible_on_front>1</is_visible_on_front> + <status>pending</status> + </data_item> +</magento_api>+
Authentication: Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/orders/33/comments |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <created_at>2012-03-09 11:21:32</created_at> + <comment>This is a new order for John Doe.</comment> + </data_item> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ + + +| Attribute Name | +Attribute Description | +Notes | +
|---|---|---|
| Comment Date | +Date when the comment was added | +Admin and Customer | +
| Comment Text | +Comment text | +Admin and Customer | +
| Is Customer Notified | +Defines whether the customer is notified about the comment. Can have the following values: 0 - Customer is not notified, 1 - Customer is notified. | +Admin only | +
| Is Comment Visible on Frontend | +Defines whether the comment is visible on the frontend. Can have the following values: 0 - Comment is not visible, 1 - Comment is visible. | + Admin only |
+
| Comment Status | +Comment status. | + Admin only |
+
Allows you to retrieve information about order items.
+ +URL Structure: http://magentohost/api/rest/orders/:orderId/items
+Version: 1
Description: Allows you to retrieve the list of existing order items with detailed items information.
+Notes: The list of attributes that will be returned for order items is configured in the Magento Admin Panel.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Response Example: XML
+ +| GET http://magentohost/api/rest/orders/410/items |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>43</item_id> + <parent_item_id></parent_item_id> + <sku>Sunglasses_1</sku> + <name>Sunglasses 1</name> + <qty_canceled>0.0000</qty_canceled> + <qty_invoiced>0.0000</qty_invoiced> + <qty_ordered>3.0000</qty_ordered> + <qty_refunded>0.0000</qty_refunded> + <qty_shipped>0.0000</qty_shipped> + <price>74.9137</price> + <base_price>106.0050</base_price> + <original_price>106.0050</original_price> + <base_original_price>150.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>26.2500</tax_amount> + <base_tax_amount>37.1400</base_tax_amount> + <discount_amount>212.0100</discount_amount> + <base_discount_amount>300.0000</base_discount_amount> + <row_total>318.0300</row_total> + <base_row_total>450.0000</base_row_total> + <price_incl_tax>114.7550</price_incl_tax> + <base_price_incl_tax>162.3800</base_price_incl_tax> + <row_total_incl_tax>344.2650</row_total_incl_tax> + <base_row_total_incl_tax>487.1400</base_row_total_incl_tax> + <status>Ordered</status> + </data_item> + <data_item> + <item_id>44</item_id> + <parent_item_id></parent_item_id> + <sku>test_simple_product</sku> + <name>test simple product</name> + <qty_canceled>0.0000</qty_canceled> + <qty_invoiced>0.0000</qty_invoiced> + <qty_ordered>10.0000</qty_ordered> + <qty_refunded>0.0000</qty_refunded> + <qty_shipped>0.0000</qty_shipped> + <price>249.7124</price> + <base_price>353.3500</base_price> + <original_price>353.3500</original_price> + <base_original_price>500.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>291.5000</tax_amount> + <base_tax_amount>412.5000</base_tax_amount> + <discount_amount>706.7000</discount_amount> + <base_discount_amount>1000.0000</base_discount_amount> + <row_total>3533.5000</row_total> + <base_row_total>5000.0000</base_row_total> + <price_incl_tax>382.5000</price_incl_tax> + <base_price_incl_tax>541.2500</base_price_incl_tax> + <row_total_incl_tax>3825.0000</row_total_incl_tax> + <base_row_total_incl_tax>5412.5000</base_row_total_incl_tax> + <status>Ordered</status> + </data_item> +</magento_api>+
Authentication: Customer
+Default Format: XML
+Parameters:
+No Parameters
Response Example: XML
+ +| GET http://magentohost/api/rest/orders/410/items |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>43</item_id> + <parent_item_id></parent_item_id> + <sku>Sunglasses_1</sku> + <name>Sunglasses 1</name> + <qty_canceled>0.0000</qty_canceled> + <qty_invoiced>0.0000</qty_invoiced> + <qty_ordered>3.0000</qty_ordered> + <qty_refunded>0.0000</qty_refunded> + <qty_shipped>0.0000</qty_shipped> + <price>74.9137</price> + <row_total>318.0300</row_total> + <price_incl_tax>114.7550</price_incl_tax> + <row_total_incl_tax>344.2650</row_total_incl_tax> + </data_item> + <data_item> + <item_id>44</item_id> + <parent_item_id></parent_item_id> + <sku>test_simple_product</sku> + <name>test simple product</name> + <qty_canceled>0.0000</qty_canceled> + <qty_invoiced>0.0000</qty_invoiced> + <qty_ordered>10.0000</qty_ordered> + <qty_refunded>0.0000</qty_refunded> + <qty_shipped>0.0000</qty_shipped> + <price>249.7124</price> + <row_total>3533.5000</row_total> + <price_incl_tax>382.5000</price_incl_tax> + <row_total_incl_tax>3825.0000</row_total_incl_tax> + </data_item> +</magento_api>+
Description: Not allowed.
+ +Description: Not allowed.
+ +Description: Not allowed.
+ + + + diff --git a/guides/v19.x/api/rest/Resources/Orders/sales_orders.html b/guides/v19.x/api/rest/Resources/Orders/sales_orders.html new file mode 100644 index 0000000000..288bd3b416 --- /dev/null +++ b/guides/v19.x/api/rest/Resources/Orders/sales_orders.html @@ -0,0 +1,367 @@ +--- +layout: v1x_rest +title: Sales Orders +--- + + +Allows you to retrieve information on existing order/orders.
+ +URL Structure: http://magentohost/api/rest/orders
+Version: 1
Description: Allows you to retrieve the list of existing orders. Each order contains the following information: general order information, information on ordered items, order comments, and order addresses (both billing and shipping).
+The list of attributes that will be returned for the order is configured in the Magento Admin Panel.
Authentication: Admin, Customer, Guest
+Default Format: XML
Response Example: XML
+ +| GET http://magentohost/api/rest/orders |
<?xml version="1.0"?> +<magento_api> + <data_item_1> + <customer_id>3</customer_id> + <base_discount_amount>0.0000</base_discount_amount> + <base_shipping_amount>455.0000</base_shipping_amount> + <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> + <base_subtotal>13650.0000</base_subtotal> + <base_tax_amount>0.0000</base_tax_amount> + <base_total_paid></base_total_paid> + <base_total_refunded></base_total_refunded> + <tax_amount>0.0000</tax_amount> + <total_paid></total_paid> + <total_refunded></total_refunded> + <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> + <base_subtotal_incl_tax>13650.0000</base_subtotal_incl_tax> + <base_total_due>14105.0000</base_total_due> + <total_due>14105.0000</total_due> + <base_currency_code>USD</base_currency_code> + <tax_name></tax_name> + <tax_rate></tax_rate> + <addresses> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia, PA 19103</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia, PA 19103</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> + </addresses> + <order_items> + <data_item> + <sku>Sunglasses_1</sku> + <price>150.0000</price> + <base_price>150.0000</base_price> + <base_original_price>150.0000</base_original_price> + <tax_percent>0.0000</tax_percent> + <tax_amount>0.0000</tax_amount> + <base_tax_amount>0.0000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>13650.0000</base_row_total> + <base_price_incl_tax>150.0000</base_price_incl_tax> + <base_row_total_incl_tax>13650.0000</base_row_total_incl_tax> + </data_item> + </order_items> + </data_item_1> + <data_item_2> + <customer_id>3</customer_id> + <base_discount_amount>0.0000</base_discount_amount> + <base_shipping_amount>95.0000</base_shipping_amount> + <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> + <base_subtotal>3350.0000</base_subtotal> + <base_tax_amount>0.0000</base_tax_amount> + <base_total_paid>2445.0000</base_total_paid> + <base_total_refunded>1845.0000</base_total_refunded> + <tax_amount>0.0000</tax_amount> + <total_paid>2445.0000</total_paid> + <total_refunded>1845.0000</total_refunded> + <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> + <base_subtotal_incl_tax>3350.0000</base_subtotal_incl_tax> + <base_total_due>1000.0000</base_total_due> + <total_due>1000.0000</total_due> + <base_currency_code>USD</base_currency_code> + <tax_name></tax_name> + <tax_rate></tax_rate> + <addresses> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia, PA 19103</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia, PA 19103</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix></prefix> + <middlename></middlename> + <suffix></suffix> + <company></company> + </data_item> + </addresses> + <order_items> + <data_item> + <sku>Sunglasses_1</sku> + <price>150.0000</price> + <base_price>150.0000</base_price> + <base_original_price>150.0000</base_original_price> + <tax_percent>0.0000</tax_percent> + <tax_amount>0.0000</tax_amount> + <base_tax_amount>0.0000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>1350.0000</base_row_total> + <base_price_incl_tax>150.0000</base_price_incl_tax> + <base_row_total_incl_tax>1350.0000</base_row_total_incl_tax> + </data_item> + <data_item> + <sku>Sun_glasses</sku> + <price>200.0000</price> + <base_price>200.0000</base_price> + <base_original_price>200.0000</base_original_price> + <tax_percent>0.0000</tax_percent> + <tax_amount>0.0000</tax_amount> + <base_tax_amount>0.0000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>2000.0000</base_row_total> + <base_price_incl_tax>200.0000</base_price_incl_tax> + <base_row_total_incl_tax>2000.0000</base_row_total_incl_tax> + </data_item> + </order_items> + </data_item_2> +</magento_api>+
Description: Not implemented.
+ + +Description: Not implemented.
+ + +Description: Not implemented.
+ +Allows you to retrieve information on a single order.
+The list of attributes that will be returned for the order is configured in the Magento Admin Panel.
URL Structure: http://magentohost/api/rest/orders/:id
+Version: 1
Description: Allows you to retrieve the order information.
+Authentication: Admin, Customer
+Default Format: XML
Response Example: XML
+ +| GET http://magentohost/api/rest/orders/32 |
<?xml version="1.0"?> +<magento_api> + <customer_id>3</customer_id> + <base_discount_amount>0.0000</base_discount_amount> + <base_shipping_amount>0.0000</base_shipping_amount> + <base_shipping_tax_amount>0.0000</base_shipping_tax_amount> + <base_subtotal>5220.0000</base_subtotal> + <base_tax_amount>430.6500</base_tax_amount> + <base_total_paid></base_total_paid> + <base_total_refunded></base_total_refunded> + <tax_amount>304.3300</tax_amount> + <total_paid></total_paid> + <total_refunded></total_refunded> + <base_shipping_discount_amount>0.0000</base_shipping_discount_amount> + <base_subtotal_incl_tax></base_subtotal_incl_tax> + <base_total_due></base_total_due> + <total_due></total_due> + <base_currency_code>USD</base_currency_code> + <tax_name>US-CA-*-Rate 1</tax_name> + <tax_rate>8.2500</tax_rate> + <addresses> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia +844 Jefferson Street; 4510 Willis Avenue</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>billing</address_type> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + </data_item> + <data_item> + <region>Palau</region> + <postcode>19103</postcode> + <lastname>Doe</lastname> + <street>2356 Jody Road Philadelphia +844 Jefferson Street; 4510 Willis Avenue</street> + <city>PA</city> + <telephone>610-634-1181</telephone> + <country_id>US</country_id> + <firstname>John</firstname> + <address_type>shipping</address_type> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + </data_item> + </addresses> + <order_items> + <data_item> + <sku>Sun_glasses</sku> + <price>141.3400</price> + <base_price>200.0000</base_price> + <base_original_price>200.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>11.6600</tax_amount> + <base_tax_amount>16.5000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>200.0000</base_row_total> + <base_price_incl_tax>216.5000</base_price_incl_tax> + <base_row_total_incl_tax>216.5000</base_row_total_incl_tax> + </data_item> + <data_item> + <sku>Virtual_product</sku> + <price>14.1340</price> + <base_price>20.0000</base_price> + <base_original_price>20.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>1.1700</tax_amount> + <base_tax_amount>1.6500</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>20.0000</base_row_total> + <base_price_incl_tax>21.6500</base_price_incl_tax> + <base_row_total_incl_tax>21.6500</base_row_total_incl_tax> + </data_item> + <data_item> + <sku>test_simple_product</sku> + <price>353.3500</price> + <base_price>500.0000</base_price> + <base_original_price>500.0000</base_original_price> + <tax_percent>8.2500</tax_percent> + <tax_amount>291.5000</tax_amount> + <base_tax_amount>412.5000</base_tax_amount> + <base_discount_amount>0.0000</base_discount_amount> + <base_row_total>5000.0000</base_row_total> + <base_price_incl_tax>541.2500</base_price_incl_tax> + <base_row_total_incl_tax>5412.5000</base_row_total_incl_tax> + </data_item> + </order_items> +</magento_api>+
Description: Not implemented.
+ + +Description: Not implemented.
+ + +Description: Not implemented.
+ + + + diff --git a/guides/v19.x/api/rest/Resources/Products/product_categories.html b/guides/v19.x/api/rest/Resources/Products/product_categories.html new file mode 100644 index 0000000000..9bec6c280f --- /dev/null +++ b/guides/v19.x/api/rest/Resources/Products/product_categories.html @@ -0,0 +1,155 @@ +--- +layout: v1x_rest +title: Product Categories +--- + + +Allows you to retrieve information about assigned categories, assign, and unassign a category from/to a product.
+ +URL Structure: http://magentohost/api/rest/products/productid/categories
+Version: 1
Description: Allows you to retrieve information about categories assigned to the specified product.
+ + +Authentication: Admin, Customer
+Default Format: JSON
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/categories |
Response Body:
+{
+ category_id: 8
+}
+ Description: Allows you to assign a category to a specified product.
+ + +Authentication: Admin
+Default Format: JSON
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| category_id | +The category ID | +required | +int | +2 | +
Example:
+ +| POST http://magentohost/api/rest/products/8/categories |
Request Body:
+{
+"category_id":"2"
+}
+ As a result, the category with ID equal to 2 will be assigned to the specified product.
+ + +Description: Allows you to unassign a category from a specified product.
+ + +Authentication: Admin
+Default Format: JSON
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/products/8/categories/2 |
| Status Code | +Message | +Description | +
|---|---|---|
| 400 | +Product <product ID> is already assigned to category <category ID> | +The message is returned when the required category is already assigned to the product | +
| 400 | +Category not found | +The specified category is not found | +
| 405 | +Resource method not implemented yet | +The specified method is not implemented yet | +
Allows you to manage images of the required product.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/images
+Version: 1
Description: Allows you to retrieve information about all images of a specified product.
+Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/images |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <id>5</id> + <label></label> + <position>1</position> + <exclude>0</exclude> + <url>http://magento/media/catalog/product/v/e/ve2011.jpg</url> + <types> + <data_item>image</data_item> + <data_item>thumbnail</data_item> + </types> + </data_item> + <data_item> + <id>7</id> + <label>second dress</label> + <position>2</position> + <exclude>1</exclude> + <url>http://magento/media/catalog/product/1/2/12.jpg</url> + <types> + <data_item>small_image</data_item> + </types> + </data_item> +</magento_api>+
Description: Allows you to add an image for the required product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| file_mime_type | +File mime type. Can have the following values: image/jpeg, image/png, etc. | +required | +string | +image/jpeg | +
| file_content | +Graphic image file content (base_64 encoded) | +required | +string | +iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg== | +
| file_name | +Name for the added image file | +optional | +string | +new image | +
Note: If the file_name parameter is not defined, the original file name is set for the image. The first created image will be called "image", the second created image will be called "image_2", etc.
+ +Example:
+ +| POST http://magentohost/api/rest/products/1/images |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <file_mime_type>image/jpeg</file_mime_type> <file_content>iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==</file_content> +</magento_api>+
Allows you to manage product images for a specified store.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/images/store/:store_id
+Version: 1
Description: Allows you to retrieve information about product images for a specified store view.
+Notes: Images can have different labels for different stores. For example, image label "flower" in the English store view can be set as "fleur" in the French store view. If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/images/store/2 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <id>6</id> + <label>white dress</label> + <position>1</position> + <exclude>0</exclude> + <url>http://magento/media/catalog/product/1/2/12.jpg</url> + <types> + <data_item>image</data_item> + <data_item>small_image</data_item> + <data_item>thumbnail</data_item> + </types> + </data_item> +</magento_api>+
Description: Allows you to add an image for the required product with image settings for a specific store.
+Notes: The image is added on the Global level; specified image parameters are set for a specific store.
Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| file_mime_type | +File mime type. Can have the following values: image/jpeg, image/png, etc. | +required | +string | +image/png | +
| file_content | +Graphic image file content (base_64 encoded) | +required | +string | +iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg== | +
| file_name | +Name for the added image file | +optional | +string | +test image | +
Note: If the file_name parameter is not defined, the original file name is set for the image. The first created image will be called "image", the second created image will be called "image_2", etc.
+ +Example:
+ +| POST http://magentohost/api/rest/products/8/images/store/3 |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <file_mime_type>image/jpeg</file_mime_type> <file_content>iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAWtJREFUeNpi/P//P8NgBkwMgxyMOnDUgTDAyMhIDNYF4vNA/B+IDwCxHLoakgEoFxODiQRXQUYi4e3k2gfDjMRajsP3zED8F8pmA+JvUDEYeArEMugOpFcanA/Ef6A0CPwC4uNoag5SnAjJjGI2tKhkg4rLAfFGIH4IxEuBWIjSKKYkDfZCHddLiwChVhokK8YGohwEZYy3aBmEKmDEhOCgreomo+VmZHxsMEQxIc2MAx3FO/DI3RxMmQTZkI9ALDCaSUYdOOrAIeRAPzQ+PxCHUM2FFDb5paGNBPRa5C20bUhxc4sSB4JaLnvxVHWHsbVu6OnACjyOg+HqgXKgGRD/JMKBoD6LDb0dyAPE94hwHAw/hGYcujlwEQmOg+EV9HJgLBmOg+FMWjsQVKR8psCBoDSrQqoDSSmoG6Hpj1wA6ju30LI9+BBX4UsC+Ai0T4BWVd1EIL5PgeO+APECmoXgaGtm1IE0AgABBgAJAICuV8dAUAAAAABJRU5ErkJggg==</file_content> +</magento_api>+
Allows you to manage a specified product image.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/images/:image_id
+Version: 1
Description: Allows you to retrieve information about a specified product image.
+Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/images/7 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <id>7</id> + <label>second dress</label> + <position>2</position> + <exclude>1</exclude> + <url>http://magento/media/catalog/product/1/2/12.jpg</url> + <types> + <data_item>small_image</data_item> + </types> +</magento_api>+
Description: Allows you to update information for the specified product image.
+Notes: When updating information, you need to pass only those parameters that you want to be updated. Parameters that were not passed in the request, will preserve the previous values.
Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example | +
|---|---|---|---|---|
| exclude | +Defines whether the image will associate only to one of the three image types. | +optional | +int | +0 | +
| file_content | +Image file content (base_64 encoded). | +optional | +string | +base_64 encoded file content | +
| file_mime_type | +File mime type. Can have the following values: image/jpeg, image/png, etc. | +optional | +string | +image/png | +
| file_name | +Image file name. | +optional | +string | +test name | +
| label | +A label that will be displayed on the frontend when pointing to the image | +optional | +string | +test label | +
| position | +The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. | +optional | +int | +1 | +
| types | +Array of image types. Can have the following values: image, small_image, and thumbnail. | +optional | +array | +thumbnail | +
Example:
+ +| PUT http://magentohost/api/rest/products/8/images/7 |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <label>English store image</label> + <position>3</position> + <exclude>0</exclude> + <types> + <data_item>image</data_item> + <data_item>small_image</data_item> + <data_item>thumbnail</data_item> + </types> +</magento_api>+
Description: Allows you to remove the specified image from a product.
+Notes: The image will not be deleted physically, the image parameters will be set to No Image.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/products/14/images/6 |
Allows you to manage a specified product image for a specified store.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/images/:image_id/store/:store_id
+Version: 1
Description: Allows you to retrieve information about the specified product image from a specified store.
+Notes: If there are custom attributes with the Catalog Input Type for Store Owner option set to Media Image, these attributes will be also returned in the response as an image type.
Authentication: Admin, Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/images/7/store/3 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <id>10</id> + <label></label> + <position>5</position> + <exclude>1</exclude> + <url>http://magento/media/catalog/product/n/e/new_image.gif</url> + <types/> +</magento_api>+
Description: Allows you to update the specified product image information for s specified store.
+Notes: When updating information, you need to pass only those parameters that you want to be updated. Parameters that were not passed in the request will preserve the previous values.
Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example | +
|---|---|---|---|---|
| exclude | +Defines whether the image will associate only to one of the three image types. | +optional | +int | +0 | +
| file_content | +Image file content (base_64 encoded). | +optional | +string | +base_64 encoded file content | +
| file_mime_type | +File mime type. Can have the following values: image/jpeg, image/png, etc. | +optional | +string | +image/png | +
| file_name | +Image file name. | +optional | +string | +test name | +
| label | +A label that will be displayed on the frontend when pointing to the image | +optional | +string | +test label | +
| position | +The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. | +optional | +int | +1 | +
| types | +Array of image types. Can have the following values: image, small_image, and thumbnail. | +optional | +array | +thumbnail | +
Example:
+ +| PUT http://magentohost/api/rest/products/8/images/7/store/3 |
Request Body:
+<?xml version="1.0"?> +<magento_api> +Â <position>3</position> +Â <exclude>0</exclude> +Â <types> +Â Â Â <data_item>image</data_item> +Â Â </types> +</magento_api>+
Description: Allows you to remove an image from the required product in the specified store.
+Notes: The image will not be deleted physically, the image parameters will be set to No Image for the current store.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/products/14/images/6/store/3 |
| Status Code | +Message | +Description | +
|---|---|---|
| 400 | + Requested store is invalid |
+The specified store is not valid or does not exist | +
| 404 | +Resource not found | +The specified resource is not found or does not exist | +
| 404 | +Product image not found | +The specified product image is not found or does not exist | +
| 400 | +Resource data pre-validator error | +Resource validation error | +
| 400 | + The image content must be valid base64 encoded data |
+The image file content must be in the base_64 encoded format (when image content does not contain supported letters and symbols) | +
| 400 | + Requested product does not support images |
+The specified product does not support images adding | +
| 400 | + Unsupported image MIME type |
+The image MIME type is not supported (e.g., image/bmp) | +
| 400 | + Resource unknown error |
+Resource unknown error | +
| 500 | + Resource internal error |
+Resource internal error | +
| - | + The image is not specified |
+The image is not specified during the POST request. | +
Allows you to retrieve information about websites assigned to a product, assign a website to a product, and copy data for a product from a specified store view.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/websites
+Version: 1
Description: Allows you to retrieve information about websites assigned to the specified product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/products/8/websites |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <website_id>2</website_id> + </data_item> +</magento_api>+
Description: Allows you to assign a website to a specified product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +The website ID | +required | +int | +2 | +
Example:
+ +| POST http://magentohost/api/rest/products/8/websites |
Request Body:
+<?xml version="1.0"?> +<magento_api> +Â Â <website_id>1</website_id> +</magento_api>+
Response Body:
+ +<?xml version="1.0"?> +<magento_api> + <success> + <data_item> + <website_id>1</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + </success> +</magento_api>+
+
Description: Allows you to assign a website and copy product data from the attached store to the one being attached. Only product data that is set on the Store View level is copied. All other data set on the Website or Global levels is not copied.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +The website ID | +required | +int | +2 | +
| store_from | +The store ID from which data will be copied | +required | +int | +1 | +
| store_to | +The store ID to which data will be copied | +required | +int | +2 | +
Notes: The store_to parameter must belong to the website which we want to assign to a product.
+ +Example:
+ +| POST http://magentohost/api/rest/products/8/websites |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <website_id>2</website_id> + <copy_to_stores> + <data_item> + <store_from>1</store_from> + <store_to>2</store_to> + </data_item> + </copy_to_stores> +</magento_api>+
+
Description: Allows you to assign multiple websites to a product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +The website ID | +required | +int | +2 | +
Example:
+ +| POST http://magentohost/api/rest/products/8/websites |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <website_id>1</website_id> + </data_item> + <data_item> + <website_id>3</website_id> + </data_item> +</magento_api>+
Response Body:
+ +<?xml version="1.0"?> +<magento_api> + <success> + <data_item> + <website_id>1</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + <data_item> + <website_id>3</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + </success> +</magento_api>+
+
Description: Allows you to assign multiple websites to a product together with copying product data from the attached store to the one being attached. Only product data that is set on the Store View level is copied. All other data set on the Website or Global levels is not copied.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +The website ID | +required | +int | +2 | +
| store_from | +The store ID from which data will be copied | +required | +int | +1 | +
| store_to | +The store ID to which data will be copied | +required | +int | +2 | +
Example:
+ +| POST http://magentohost/api/rest/products/8/websites |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <website_id>2</website_id> + <copy_to_stores> + <data_item> + <store_from>1</store_from> + <store_to>2</store_to> + </data_item> + </copy_to_stores> + </data_item> + <data_item> + <website_id>3</website_id> + <copy_to_stores> + <data_item> + <store_from>1</store_from> + <store_to>5</store_to> + </data_item> + </copy_to_stores> + </data_item> +</magento_api>+
Response Body:
+ +<?xml version="1.0"?> +<magento_api> + <success> + <data_item> + <website_id>2</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + <data_item> + <website_id>3</website_id> + <product_id>8</product_id> + <message>Resource updated successful.</message> + <code>200</code> + </data_item> + </success> +</magento_api>+
+
Allows you to unassign a website from a specified product.
+ +URL Structure: http://magentohost/api/rest/products/:product_id/websites/:website_id
+Version: 1
Description: Allows you to unassign a website from a specified product.
+ + +Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/products/8/websites/1 |
| Status Code | +Message | +Description | +
|---|---|---|
| 404 | +Product not found | +The specified product is not found or does not exist. | +
| 404 | +Website not found | +The specified website is not found or does not exist. | +
| 400 | +Invalid value for "store_from" for the website with ID <ID value>. | +The entered value for "store_from" is not valid. | +
| 400 | + Invalid value for "store_to" for the website with ID <ID value>. |
+The entered value for "store_to" is not valid. | +
| 400 | +Store not found <store ID> for website <website ID>. | +The specified store is not found or does not exist. | +
| 400 | +Store <store ID> from which we will copy the information does not belong to the product <product ID> being edited. | +The specified store is not assigned to the product. | +
| 400 | +Store <store ID> to which we will copy the information does not belong to the website <website ID> being added. | +The specified store does not belong to the website. | +
| 400 | +Product <product ID> isn't assigned to website <website ID>. | +The specified product is not assigned to the website. | +
| 400 | +Invalid value for "website_id" in request. | +The value for "website_id" is not valid. | +
Allows you to retrieve the list of all products with detailed information.
+ +URL Structure: http://magentohost/api/rest/products
+Version: 1
Description: Allows you to retrieve the list of all products with detailed information.
+Notes: The list of attributes that will be returned in the response is configured in the Magento Admin Panel. The list of attributes differs for each type of user.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
| GET http://magentohost/api/rest/products |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>1</entity_id> + <type_id>simple</type_id> + <sku>dress_test</sku> + <status>1</status> + <visibility>4</visibility> + <tax_class_id>2</tax_class_id> + <weight>1.0000</weight> + <price>1500.0000</price> + <special_price>1000.0000</special_price> + <name>Wedding dress</name> + <url_key>dress</url_key> + <country_of_manufacture>AO</country_of_manufacture> + <msrp_display_actual_price_type>2</msrp_display_actual_price_type> + <gift_message_available>1</gift_message_available> + <news_from_date>2012-03-21 00:00:00</news_from_date> + <news_to_date>2012-03-24 00:00:00</news_to_date> + <special_from_date>2012-03-21 00:00:00</special_from_date> + <special_to_date>2012-03-24 00:00:00</special_to_date> + <description>White wedding dress</description> + </data_item> + <data_item> + <entity_id>2</entity_id> + <type_id>simple</type_id> + <sku>black_sunglasses</sku> + <status>1</status> + <visibility>4</visibility> + <tax_class_id>2</tax_class_id> + <weight>0.2000</weight> + <price>500.0000</price> + <special_price>300.0000</special_price> + <name>Sunglasses</name> + <url_key>sunglasses</url_key> + <country_of_manufacture>AR</country_of_manufacture> + <msrp_display_actual_price_type>2</msrp_display_actual_price_type> + <gift_message_available></gift_message_available> + <news_from_date></news_from_date> + <news_to_date></news_to_date> + <special_from_date>2012-03-21 00:00:00</special_from_date> + <special_to_date>2012-03-24 00:00:00</special_to_date> + <description>Black sunglasses</description> + </data_item> +</magento_api>+
Response Example: JSON
+ +{"1":{"entity_id":"1","type_id":"simple","sku":"dress_test","status":"1","visibility":"4","tax_class_id":"2","weight":"1.0000","price":"1500.0000","special_price":"1000.0000","name":"Wedding dress","url_key":"dress","country_of_manufacture":"AO","msrp_display_actual_price_type":"2","gift_message_available":"1","news_from_date":"2012-03-21 00:00:00","news_to_date":"2012-03-24 00:00:00","special_from_date":"2012-03-21 00:00:00","special_to_date":"2012-03-24 00:00:00","description":"White wedding dress"},"2":{"entity_id":"2","type_id":"simple","sku":"black_sunglasses","status":"1","visibility":"4","tax_class_id":"2","weight":"0.2000","price":"500.0000","special_price":"300.0000","name":"Sunglasses","url_key":"sunglasses","country_of_manufacture":"AR","msrp_display_actual_price_type":"2","gift_message_available":null,"news_from_date":null,"news_to_date":null,"special_from_date":"2012-03-21 00:00:00","special_to_date":"2012-03-24 00:00:00","description":"Black sunglasses"}}
+ Authentication: Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
| GET http://magentohost/api/rest/products |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>1</entity_id> + <type_id>simple</type_id> + <sku>dress_test</sku> + <description>White wedding dress</description> + <short_description>dress</short_description> + <meta_keyword>white, dress</meta_keyword> + <name>Wedding dress</name> + <meta_title>dress</meta_title> + <meta_description>A nice wedding dress</meta_description> + <regular_price_with_tax>1500</regular_price_with_tax> + <regular_price_without_tax>1500</regular_price_without_tax> + <final_price_with_tax>1000</final_price_with_tax> + <final_price_without_tax>1000</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magentohost/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/1/2/wedding_dress.jpg</image_url> + </data_item> + <data_item> + <entity_id>2</entity_id> + <type_id>simple</type_id> + <sku>black_sunglasses</sku> + <description>Black sunglasses</description> + <short_description>Black sunglasses</short_description> + <meta_keyword>sunglasses, black</meta_keyword> + <name>Sunglasses</name> + <meta_title>sunglasses</meta_title> + <meta_description>black sunglasses</meta_description> + <regular_price_with_tax>500</regular_price_with_tax> + <regular_price_without_tax>500</regular_price_without_tax> + <final_price_with_tax>300</final_price_with_tax> + <final_price_without_tax>300</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magentohost/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/a/l/sunglasses-1.jpg</image_url> + </data_item> +</magento_api>+
Response Example: JSON
+ +{"1":{"entity_id":"1","type_id":"simple","sku":"dress_test","description":"White wedding dress","short_description":"dress","meta_keyword":"white, dress","name":"Wedding dress","meta_title":"dress","meta_description":"A nice wedding dress","regular_price_with_tax":1500,"regular_price_without_tax":1500,"final_price_with_tax":1000,"final_price_without_tax":1000,"is_saleable":"1","image_url":"http:\/\/magentohost\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/1\/2\/wedding_dress.jpg"},"2":{"entity_id":"2","type_id":"simple","sku":"black_sunglasses","description":"Black sunglasses","short_description":"Black sunglasses","meta_keyword":"sunglasses, black","name":"Sunglasses","meta_title":"sunglasses","meta_description":"black sunglasses","regular_price_with_tax":500,"regular_price_without_tax":500,"final_price_with_tax":300,"final_price_without_tax":300,"is_saleable":"1","image_url":"http:\/\/magentohost\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/a\/l\/sunglasses-1.jpg"}}
+ Description: Allows you to retrieve the list of products of a specified category. These products will be returned in the product position ascending order.
+ +In the following example, product with ID=4 has position equal to 7 and the product with ID=3 has position equal to 1. The list of products, therefore, is sorted by the product position in the category.
+ +| GET http://magentohost/api/rest/products?category_id=5 |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>4</entity_id> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <tax_class_id>2</tax_class_id> + <weight>1.0000</weight> + <price>329.9900</price> + </data_item> + <data_item> + <entity_id>3</entity_id> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <tax_class_id>2</tax_class_id> + <weight>1.0000</weight> + <price>550.0000</price> + </data_item> +</magento_api>+
Description: Allows you to create a new simple product.
+ +Authentication: Admin
+Default Format: JSON
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| type_id | +Product type. Can have the "simple" value. | +required | +string | +simple | +
| attribute_set_id | +Attribute set for the product. | +required | +int | +4 | +
| sku | +Product SKU | +required | +string | +new_product | +
| name | +Product name | + required |
+string | +New product | +
| meta_title | +Product meta title | +optional | +string | +new product | +
| meta_description |
+Product meta description | +optional | +string | +This is a new product | +
| url_key |
+A friendly URL path for the product | +optional | +string | +new-product | +
| custom_design |
+Custom design applied for the product page | +optional | +string | +enterprise/default | +
| page_layout |
+Page template that can be applied to the product page | +optional | +string | +one_column | +
| options_container |
+Defines how the custom options for the product will be displayed. Can have the following values: Block after Info Column or Product Info Column | +optional | +string | +container2 | +
| country_of_manufacture |
+Product country of manufacture | +optional | +string | +AD | +
| msrp_enabled |
+The Apply MAP option. Defines whether the price in the catalog in the frontend is substituted with a Click for price link | +optional | +int | +1 | +
| msrp_display_actual_price_type |
+Defines how the price will be displayed in the frontend. Can have the following values: In Cart, Before Order Confirmation, and On Gesture | +optional | +int | +2 | +
| gift_message_available |
+Defines whether the gift message is available for the product | +optional | +int | +1 | +
| price | +Product price | + required |
+string | +2000 | +
| special_price |
+Product special price | +optional | +string | +150 | +
| weight | +Product weight | + required |
+string | +0.5 | +
| msrp |
+The Manufacturer's Suggested Retail Price option. The price that a manufacturer suggests to sell the product at | +optional | +string | +140 | +
| status | +Product status. Can have the following values: 1- Enabled, 2 - Disabled. | + required |
+int | +1 | +
| visibility | +Product visibility. Can have the following values: 1 - Not Visible Individually, 2 - Catalog, 3 - Search, 4 - Catalog, Search. | + required |
+int | +4 | +
| enable_googlecheckout |
+Defines whether the product can be purchased with the help of the Google Checkout payment service. Can have the following values: Yes and No | +optional | +int | +1 | +
| tax_class_id | +Product tax class. Can have the following values: 0 - None, 2 - taxable Goods, 4 - Shipping, etc., depending on created tax classes. | + required |
+int | +7 | +
| description | +Product description. | + required |
+string | +This is a new product. | +
| short_description | +Product short description. | + required |
+string | +A new product. | +
| meta_keyword |
+Product meta keywords | +optional | +string | +new | +
| custom_layout_update |
+An XML block to alter the page layout | +optional | +string | +XML body | +
| special_from_date |
+Date starting from which the special price will be applied to the product | +optional | +string | +2012-03-15 00:00:00 | +
| special_to_date |
+Date till which the special price will be applied to the product | +optional | +string | +2012-03-15 00:00:00 | +
| news_from_date |
+Date starting from which the product is promoted as a new product | +optional | +string | +2012-03-15 00:00:00 | +
| news_to_date |
+Date till which the product is promoted as a new product | +optional | +string | +2012-03-15 00:00:00 | +
| custom_design_from |
+Date starting from which the custom design will be applied to the product page | +optional | +string | +2012-03-15 00:00:00 | +
| custom_design_to |
+Date till which the custom design will be applied to the product page | +optional | +string | +2012-03-15 00:00:00 | +
| group_price |
+Product group price | +optional | +array | +array of group price | +
| tier_price |
+Product tier price | +optional | +array | +array of tier price | +
| stock_data |
+Product inventory data | +optional | +array | +array of stock data | +
Array of Group Price attributes is as follows:
+ +| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +Website ID | +optional | +int | +0 | +
| cust_group | +Customer group | +optional | +int | +1 | +
| price |
+Group price | +optional | +string | +140 | +
Array of Tier Price attributes is as follows:
+ +| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| website_id | +Website ID | +optional | +int | +0 | +
| cust_group | +Customer group | +optional | +int | +1 | +
| price | +Tier price | +optional | +string | +140 | +
| price_qty | +Price quantity | +optional | +string | +10 | +
Array of Stock Data attributes is as follows:
+ +| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| qty | +Quantity of stock items for the current product | +optional | +string | +99 | +
| min_qty | +Quantity for stock items to become out of stock | +optional | +string | +5 | +
| use_config_min_qty | +Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock option | +optional | +int | +1 | +
| is_qty_decimal | +Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) | +optional | +int | +1 | +
| backorders |
+ Defines whether the customer can place the order for products that are out of stock at the moment. |
+ optional |
+int | +0 | +
| use_config_backorders |
+Choose whether the Config settings will be applied for the Backorders option | + optional |
+int | +1 | +
| min_sale_qty |
+ Minimum number of items in the shopping cart to be sold |
+ optional |
+string | +10 | +
| use_config_min_sale_qty |
+Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option | + optional |
+int | +1 | +
| max_sale_qty |
+ Maximum number of items in the shopping cart to be sold |
+ optional |
+string | +50 | +
| use_config_max_sale_qty |
+Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option | + optional |
+int | +1 | +
| is_in_stock |
+Defines whether the product is available for selling. | + optional |
+int | +1 | +
| notify_stock_qty |
+The number of inventory items below which the customer will be notified | + optional |
+string | +5 | +
| use_config_notify_stock_qty |
+Choose whether the Config settings will be applied for the Notify for Quantity Below option | + optional |
+int | +1 | +
| manage_stock |
+Choose whether to view and specify the product quantity and availability and whether the product is in stock management. | + optional |
+int | +1 | +
| use_config_manage_stock |
+Choose whether the Config settings will be applied for the Manage Stock option | + optional |
+int | +1 | +
| use_config_qty_increments |
+Choose whether the Config settings will be applied for the Qty Increments option | + optional |
+int | +1 | +
| qty_increments |
+The product quantity increment value | + optional |
+string | +3 | +
| use_config_enable_qty_inc |
+Choose whether the Config settings will be applied for the Enable Qty Increments option | + optional |
+int | +1 | +
| enable_qty_increments |
+Defines whether the customer can add products only in increments to the shopping cart | + optional |
+int | +0 | +
| is_decimal_divided |
+Defines whether the stock items can be divided into multiple boxes for shipping | + optional |
+int | +0 | +
| POST http://magentohost/api/rest/products |
Request Example: JSON
+ +{
+ "custom_design" : "default/blank",
+ "custom_design_from" : "02/16/2012",
+ "custom_design_to" : "05/01/2012",
+ "description" : "Test description",
+ "gift_message_available" : 1,
+ "meta_description" : "Test meta",
+ "meta_keyword" : "Test keyword",
+ "meta_title" : "Test title",
+ "msrp" : 11.015000000000001,
+ "msrp_display_actual_price_type" : 1,
+ "msrp_enabled" : 1,
+ "name" : "Test",
+ "news_from_date" : "02/16/2012",
+ "news_to_date" : "16.02.2012",
+ "options_container" : "container1",
+ "page_layout" : "one_column",
+ "price" : 25.5,
+ "attribute_set_id" : "4",
+ "short_description" : "Test short description",
+ "sku" : "simple4f5490f31959f",
+ "special_from_date" : "02/16/2012",
+ "special_price" : 11.199999999999999,
+ "special_to_date" : "03/17/2012",
+ "status" : 1,
+ "stock_data" : { "backorders" : 1,
+ "enable_qty_increments" : 0,
+ "is_in_stock" : 0,
+ "is_qty_decimal" : 0,
+ "manage_stock" : 1,
+ "max_sale_qty" : 1,
+ "min_qty" : 1.5600000000000001,
+ "min_sale_qty" : 1,
+ "notify_stock_qty" : -50.990000000000002,
+ "qty" : 1,
+ "use_config_manage_stock" : 1,
+ "use_config_min_qty" : 1,
+ "use_config_min_sale_qty": 1,
+ "use_config_max_sale_qty" : 1,
+ "use_config_backorders": 1,
+ "use_config_enable_qty_inc":1,
+ "use_config_notify_stock_qty":1 },
+ "tax_class_id" : "2",
+ "type_id" : "simple",
+ "use_config_gift_message_available" : 0,
+ "visibility" : "4",
+ "weight" : 125
+}
+ Request Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <sku>test_dress</sku> + <name>Test_dress</name> + <country_of_manufacture>AD</country_of_manufacture> + <price>2000.0000</price> + <special_price>1500.0000</special_price> + <weight>0.5000</weight> + <status>1</status> + <visibility>4</visibility> + <tax_class_id>7</tax_class_id> + <description>dress</description> + <short_description>Wedding dress</short_description> +</magento_api>+
Allows you to retrieve, update, and delete a specified product in Magento.
+ +URL Structure: http://magentohost/api/rest/products/:id
+Version: 1
Description: Allows you to retrieve information on a required simple product.
+Notes: The list of attributes that will be returned in the response is configured in the Magento Admin Panel. The list of attributes differs for each type of user.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
| GET http://magentohost/api/rest/products/8 |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <entity_id>8</entity_id> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <sku>dress</sku> + <name>Dress</name> + <url_key>my-new-dress</url_key> + <country_of_manufacture>AD</country_of_manufacture> + <msrp_display_actual_price_type>2</msrp_display_actual_price_type> + <gift_message_available>1</gift_message_available> + <price>2000.0000</price> + <weight>0.5000</weight> + <status>1</status> + <visibility>4</visibility> + <tax_class_id>7</tax_class_id> + <description>dress</description> + <group_price> + <data_item> + <website_id>0</website_id> + <cust_group>1</cust_group> + <price>1400.0000</price> + </data_item> + </group_price> + <tier_price> + <data_item> + <website_id>0</website_id> + <cust_group>1</cust_group> + <price>1300.0000</price> + <price_qty>1.0000</price_qty> + </data_item> + </tier_price> + <stock_data> + <qty>50.0000</qty> + <min_qty>0.0000</min_qty> + <use_config_min_qty>1</use_config_min_qty> + <is_qty_decimal>0</is_qty_decimal> + <backorders>0</backorders> + <use_config_backorders>1</use_config_backorders> + <min_sale_qty>1.0000</min_sale_qty> + <use_config_min_sale_qty>1</use_config_min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <use_config_max_sale_qty>1</use_config_max_sale_qty> + <is_in_stock>1</is_in_stock> + <notify_stock_qty></notify_stock_qty> + <use_config_notify_stock_qty>1</use_config_notify_stock_qty> + <manage_stock>0</manage_stock> + <use_config_manage_stock>1</use_config_manage_stock> + <use_config_qty_increments>1</use_config_qty_increments> + <qty_increments>0.0000</qty_increments> + <use_config_enable_qty_inc>1</use_config_enable_qty_inc> + <enable_qty_increments>0</enable_qty_increments> + <is_decimal_divided>0</is_decimal_divided> + <use_config_enable_qty_increments>1</use_config_enable_qty_increments> + </stock_data> +</magento_api>+
Response Example: JSON
+ +{"entity_id":"8","attribute_set_id":"4","type_id":"simple","sku":"dress","name":"Dress","url_key":"my-new-dress","country_of_manufacture":"AD","msrp_display_actual_price_type":"2","gift_message_available":"1","price":"2000.0000","weight":"0.5000","status":"1","visibility":"4","tax_class_id":"7","description":"dress","group_price":[{"website_id":"0","cust_group":"1","price":"1400.0000"}],"tier_price":[{"website_id":"0","cust_group":"1","price":"1300.0000","price_qty":"1.0000"}],"stock_data":{"qty":"50.0000","min_qty":"0.0000","use_config_min_qty":"1","is_qty_decimal":"0","backorders":"0","use_config_backorders":"1","min_sale_qty":"1.0000","use_config_min_sale_qty":"1","max_sale_qty":"0.0000","use_config_max_sale_qty":"1","is_in_stock":"1","notify_stock_qty":null,"use_config_notify_stock_qty":"1","manage_stock":"0","use_config_manage_stock":"1","use_config_qty_increments":"1","qty_increments":"0.0000","use_config_enable_qty_inc":"1","enable_qty_increments":"0","is_decimal_divided":"0","use_config_enable_qty_increments":"1"}}
+ Authentication: Customer, Guest
+Default Format: XML
+Parameters:
+No Parameters
| GET http://magentohost/api/rest/products/8 |
Response Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <entity_id>1</entity_id> + <type_id>simple</type_id> + <sku>dress_test</sku> + <name>Wedding dress</name> + <meta_title>dress</meta_title> + <meta_description>A nice wedding dress</meta_description> + <description>White wedding dress</description> + <short_description>dress</short_description> + <meta_keyword>white, dress</meta_keyword> + <tier_price/> + <is_in_stock>1</is_in_stock> + <regular_price_with_tax>1500</regular_price_with_tax> + <regular_price_without_tax>1500</regular_price_without_tax> + <final_price_with_tax>1000</final_price_with_tax> + <final_price_without_tax>1000</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magento/media/catalog/product/cache/0/image/9df78eab33525d08d6e5fb8d27136e95/1/2/wedding_dress.jpg</image_url> + <url>http://magento/index.php/catalog/product/view/id/1/s/dress/</url> + <buy_now_url>http://magento/index.php/checkout/cart/add/uenc/aHR0cDovLzEyNy4wLjAuMS9Tb3VyY2VzL2FwaS9yZXN0L3Byb2R1Y3RzLzE,/product/1/</buy_now_url> + <total_reviews_count>0</total_reviews_count> + <has_custom_options></has_custom_options> +</magento_api>+
Response Example: JSON
+ +{"entity_id":"1","type_id":"simple","sku":"dress_test","name":"Wedding dress","meta_title":"dress","meta_description":"A nice wedding dress","description":"White wedding dress","short_description":"dress","meta_keyword":"white, dress","tier_price":[],"is_in_stock":"1","regular_price_with_tax":1500,"regular_price_without_tax":1500,"final_price_with_tax":1000,"final_price_without_tax":1000,"is_saleable":"1","image_url":"http:\/\/magento\/media\/catalog\/product\/cache\/0\/image\/9df78eab33525d08d6e5fb8d27136e95\/1\/2\/wedding_dress.jpg","url":"http:\/\/magento\/index.php\/catalog\/product\/view\/id\/1\/s\/dress\/","buy_now_url":"http:\/\/magento\/index.php\/checkout\/cart\/add\/uenc\/aHR0cDovLzEyNy4wLjAuMS9Tb3VyY2VzL2FwaS9yZXN0L3Byb2R1Y3RzLzE,\/product\/1\/","total_reviews_count":"0","has_custom_options":false}
+ Description: Allows you to update an existing product.
+ + +Authentication: Admin
+Default Format: JSON
+Parameters:
+Enter only those parameters which you want to update.
| PUT http://magentohost/api/rest/products/8 +PUT for specific store http://magentohost/api/rest/products/8/store/3 |
Request Example: JSON
+ +{
+"attribute_set_id":"4",
+"type_id":"simple",
+"sku":"wedding dress",
+"name":"Dress_test",
+"meta_title":"dress",
+"meta_description":"a wedding dress",
+"price":"2000.0000",
+"weight":"0.5000",
+"status":"1",
+"visibility":"4",
+"enable_googlecheckout":"1",
+"tax_class_id":"7",
+"description":"dress",
+"meta_keyword":"dress, wedding"
+}
+ Request Example: XML
+ +<?xml version="1.0"?> +<magento_api> + <attribute_set_id>4</attribute_set_id> + <type_id>simple</type_id> + <sku>wedding dress</sku> + <name>Dress_test</name> + <meta_title>dress</meta_title> + <price>2000.0000</price> + <weight>0.5000</weight> + <status>1</status> + <visibility>4</visibility> + <enable_googlecheckout>1</enable_googlecheckout> + <tax_class_id>7</tax_class_id> + <description>dress</description> + <meta_keyword>dress, wedding</meta_keyword> +</magento_api>+
Description: Allows you to delete an existing product.
+ + +Authentication: Admin
+Default Format: JSON
+Parameters: no parameters
+Request Example:
| DELETE http://magentohost/api/rest/products/1 |
| Status Code | +Message | +Description | +
|---|---|---|
| 404 | +Resource not found. | +The required resource is not found. | +
| 405 | +Resource method not implemented yet. | +The required method is not implemented yet. | +
| 405 | +Resource does not support method. | +The current resource does not support the specified method. | +
Some requests use GET parameters in the URL. These are as follows:
+ +If the attribute value consists of several words separated by a whitespace, the '%20' sign is used:
+ + + +For example, to filter products with the description equal to simple01:
+ + + + + diff --git a/guides/v19.x/api/rest/Resources/inventory.html b/guides/v19.x/api/rest/Resources/inventory.html new file mode 100644 index 0000000000..7e048d1743 --- /dev/null +++ b/guides/v19.x/api/rest/Resources/inventory.html @@ -0,0 +1,626 @@ +--- +layout: v1x_rest +title: Inventory +--- + + +Allows you to manage existing stock items. Inventory management is available only for Admin.
+ +URL Structure: http://magentohost/api/rest/stockitems
Version: 1
Description: Allows you to retrieve the list of existing stock items.
+ Notes: The list of attributes that will be returned for stock items is configured in the Magento Admin Panel.
+
Authentication: Admin
+ Default Format: JSON
+ Parameters :
+ No Parameters
Response Example: XML
+ +| GET http://magentohost/api/rest/stockitems | +
<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>1</item_id> + <qty>100.0000</qty> + <backorders>0</backorders> + <min_sale_qty>1.0000</min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <low_stock_date></low_stock_date> + <manage_stock>0</manage_stock> + <stock_status_changed_auto>0</stock_status_changed_auto> + <enable_qty_increments>0</enable_qty_increments> + </data_item> + <data_item> + <item_id>2</item_id> + <qty>100.0000</qty> + <backorders>0</backorders> + <min_sale_qty>1.0000</min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <low_stock_date></low_stock_date> + <manage_stock>0</manage_stock> + <stock_status_changed_auto>0</stock_status_changed_auto> + <enable_qty_increments>0</enable_qty_increments> + </data_item> + <data_item> + <item_id>3</item_id> + <qty>1.0000</qty> + <backorders>0</backorders> + <min_sale_qty>1.0000</min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <low_stock_date></low_stock_date> + <manage_stock>0</manage_stock> + <stock_status_changed_auto>0</stock_status_changed_auto> + <enable_qty_increments>0</enable_qty_increments> + </data_item> + <data_item> + <item_id>4</item_id> + <qty>0.0000</qty> + <backorders>0</backorders> + <min_sale_qty>1.0000</min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <low_stock_date></low_stock_date> + <manage_stock>0</manage_stock> + <stock_status_changed_auto>1</stock_status_changed_auto> + <enable_qty_increments>0</enable_qty_increments> + </data_item> +</magento_api>+
Response Example: JSON
+ +| GET http://magentohost/api/rest/stockitems | +
[{"item_id":"1","qty":"100.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"2","qty":"100.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"3","qty":"1.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"0","enable_qty_increments":"0"},{"item_id":"4","qty":"0.0000","backorders":"0","min_sale_qty":"1.0000","max_sale_qty":"0.0000","low_stock_date":null,"manage_stock":"0","stock_status_changed_auto":"1","enable_qty_increments":"0"}]
+ Description: Allows you to update existing stock items.
+ + +Authentication: Admin
+ Default Format: JSON
Notes: The Content-Type: text/xml parameter must be added to the request header.
+ +Parameters:
+ +| Name | +Description | +Type | +Example Value | +
|---|---|---|---|
| item_id | +Item ID | +int | +1 | +
| product_id | +Product ID | +int | +1 | +
| stock_id | +Stock ID | +int | +1 | +
| qty | +Quantity of stock items for the current product | +string | +20 | +
| min_qty | +Quantity for stock items to become out of stock | +string | +0 | +
| use_config_min_qty | +Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock + option + | +int | +1 | +
| is_qty_decimal | +Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) | +int | +0 | +
| backorders | +The customer can place the order for products that are out of stock at the moment (0 - No Backorders, 1 - + Allow Qty Below 0, and 2 - Allow Qty Below 0 and Notify Customer) + | +int | +0 | +
| use_config_backorders | +Choose whether the Config settings will be applied for the Backorders option | +int | +1 | +
| min_sale_qty | +Minimum number of items in the shopping cart to be sold | +string | +10 | +
| use_config_min_sale_qty | +Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option | +int | +0 | +
| max_sale_qty | +Maximum number of items in the shopping cart to be sold | +string | +100 | +
| use_config_max_sale_qty | +Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option | +int | +0 | +
| is_in_stock | +Defines whether the product is available for selling (0 - Out of Stock, 1 - In Stock) | +int | +1 | +
| low_stock_date | +Date when the number of stock items became lower than the number defined in the Notify for Quantity Below + option + | +string | +2012-02-24 12:37:51 | +
| notify_stock_qty | +The number of inventory items below which the customer will be notified via the RSS feed | +string | +10 | +
| use_config_notify_stock_qty | +Choose whether the Config settings will be applied for the Notify for Quantity Below option | +int | +0 | +
| manage_stock | +Choose whether to view and specify the product quantity and availability and whether the product is in + stock management( 0 - No, 1 - Yes) + | +int | +0 | +
| use_config_manage_stock | +Choose whether the Config settings will be applied for the Manage Stock option | +int | +1 | +
| stock_status_changed_auto | +Defines whether products can be automatically returned to stock when the refund for an order is created + | +int | +0 | +
| use_config_qty_increments | +Choose whether the Config settings will be applied for the Enable Qty Increments option | +int | +1 | +
| qty_increments | +The product quantity increment value | +string | +5 | +
| use_config_enable_qty_inc | +Choose whether the Config settings will be applied for the Qty Increments option | +int | +1 | +
| enable_qty_increments | +Defines whether the customer can add products only in increments to the shopping cart | +int | +0 | +
| is_decimal_divided | +Defines whether the stock items can be divided into multiple boxes for shipping. | +int | +0 | +
Example: XML
+ +| PUT http://magentohost/api/rest/stockitems | +
Request Body:
+<?xml version="1.0"?> +<magento_api> + <data_item item_id="157"> + <product_id>262</product_id> + <stock_id>1</stock_id> + <qty>100.0000</qty> + <min_qty>0.0000</min_qty> + </data_item> + <data_item item_id="158"> + <product_id>263</product_id> + <stock_id>1</stock_id> + <qty>100.0000</qty> + <min_qty>0.0000</min_qty> + </data_item> + <data_item item_id="159"> + <product_id>264</product_id> + <stock_id>1</stock_id> + <qty>120.0000</qty> + <min_qty>0.0000</min_qty> + </data_item> + <data_item item_id="153"> + <product_id> </product_id> + <qty>110.0000</qty> + <min_qty>0.0000</min_qty> + </data_item> +</magento_api>+
Response Body:
+<?xml version="1.0"?> +<magento_api> + <success> + <data_item> + <message>Resource updated successful.</message> + <code>200</code> + <item_id>157</item_id> + </data_item> + </success> + <error> + <data_item> + <message>Resource not found.</message> + <code>404</code> + <item_id>158</item_id> + </data_item> + <data_item> + <message>Resource not found.</message> + <code>404</code> + <item_id>159</item_id> + </data_item> + <data_item> + <message>Empty value for "product_id" in request.</message> + <code>400</code> + <item_id>153</item_id> + </data_item> + </error> +</magento_api>+
Allows you to update, delete, or retrieve information on a single stock item.
+ Notes: The list of attributes that will be returned for stock items is configured in the Magento Admin Panel.
+
URL Structure: http://magentohost/api/rest/stockitems/:id
+ Version: 1
Description: Allows you to retrieve the stock item information.
+ Authentication: Admin
+ Default Format: JSON
Response Example: XML
+ +| GET http://magentohost/api/rest/stockitems/1 | +
Response Body:
+<?xml version="1.0"?> +<magento_api> + <item_id>1</item_id> + <product_id>1</product_id> + <stock_id>1</stock_id> + <qty>200.0000</qty> + <min_qty>0.0000</min_qty> + <use_config_min_qty>1</use_config_min_qty> + <is_qty_decimal>1</is_qty_decimal> + <backorders>0</backorders> + <use_config_backorders>1</use_config_backorders> + <min_sale_qty>1.0000</min_sale_qty> + <use_config_min_sale_qty>1</use_config_min_sale_qty> + <max_sale_qty>0.0000</max_sale_qty> + <use_config_max_sale_qty>1</use_config_max_sale_qty> + <is_in_stock>1</is_in_stock> + <low_stock_date></low_stock_date> + <notify_stock_qty>10.0000</notify_stock_qty> + <use_config_notify_stock_qty>0</use_config_notify_stock_qty> + <manage_stock>0</manage_stock> + <use_config_manage_stock>1</use_config_manage_stock> + <stock_status_changed_auto>0</stock_status_changed_auto> + <use_config_qty_increments>1</use_config_qty_increments> + <qty_increments>0.0000</qty_increments> + <use_config_enable_qty_inc>1</use_config_enable_qty_inc> + <enable_qty_increments>0</enable_qty_increments> + <is_decimal_divided>1</is_decimal_divided> +</magento_api>+
Response Example: JSON
+ +| GET http://magentohost/api/rest/stockitems/157 + | +
Response Body:
+{"item_id":"1","product_id":"1","stock_id":"1","qty":"200.0000","min_qty":"0.0000","use_config_min_qty":"1","is_qty_decimal":"1","backorders":"0","use_config_backorders":"1","min_sale_qty":"1.0000","use_config_min_sale_qty":"1","max_sale_qty":"0.0000","use_config_max_sale_qty":"1","is_in_stock":"1","low_stock_date":null,"notify_stock_qty":"10.0000","use_config_notify_stock_qty":"0","manage_stock":"0","use_config_manage_stock":"1","stock_status_changed_auto":"0","use_config_qty_increments":"1","qty_increments":"0.0000","use_config_enable_qty_inc":"1","enable_qty_increments":"0","is_decimal_divided":"1"}
+ Description: Allows you to update existing stock item data.
+ Notes: The Content-Type: text/xml parameter must be added to the request header.
+ Authentication: Admin
+ Default Format: JSON
+ Parameters:
+ Enter only those parameters which you want to update.
Example: XML
+ +| PUT http://magentohost/api/rest/stockitems/1 | +
Request Body:
+<?xml version="1.0"?> +<magento_api> + <qty>99</qty> +</magento_api>+
Example: JSON
+ +| PUT http://magentohost/api/rest/stockitems/1 | +
Request Body:
+{
+"qty":"99"
+}
+ Description: Not allowed. The DELETE method is not allowed because you cannot delete a stock item. The + required stock item is deleted together with the product which it is associated to.
+ + +Possible HTTP Status Codes:
+ +| Error Code | +Error Message | +Error Description | +
|---|---|---|
| 200 | +Resource updated successful. | +The required resource was successfully updated. | +
| 404 | +Resource not found. | +The required resource is not found or does not exist. | +
| 400 | +Empty value for <name of the parameter> in request. | +Value is not defined for the specified parameter in the request body. | +
| 400 | +Invalid value for "item_id" in request. | +The specified value for "item_id" is not valid. | +
| 400 | +Missing <name of the parameter> in request. | +The specified parameter is missing in the request body. | +
| 500 | +Resource internal error. | +Resource internal error. | +
Allows you to manage existing customer addresses.
+ +URL Structure: http://magentohost/api/rest/customers/:customer_id/addresses
+Version: 1
Description: Allows you to retrieve the list of existing customer addresses.
+Notes: The list of attributes that will be returned for customer addresses is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses. Also, Admin can add additional non-system customer address attributes by selecting Customers > Attributes > Manage Customer Address Attributes (available only in Magento Enterprise Edition). If these attributes are set as visible on frontend, they will be returned in the response.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/customers/1/addresses |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>2</entity_id> + <firstname>John</firstname> + <lastname>Doe</lastname> + <city>PA</city> + <region>Palau</region> + <postcode>19103</postcode> + <country_id>US</country_id> + <telephone>610-634-1181</telephone> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + <fax></fax> + <vat_id>123456789</vat_id> + <street> + <data_item>2356 Jody Road Philadelphia</data_item> + <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> + </street> + <is_default_billing>1</is_default_billing> + <is_default_shipping>1</is_default_shipping> + </data_item> +</magento_api>+
response body: json:
+
+
+[
+ {
+ "entity_id": "98",
+ "firstname": "John",
+ "middlename": null,
+ "lastname": "Doe",
+ "company": null,
+ "city": "Philly",
+ "country_id": "US",
+ "region": "California",
+ "postcode": "94131",
+ "telephone": "888-555-1212",
+ "fax": null,
+ "street": [
+ "123 Center St"
+ ],
+ "is_default_billing": 0,
+ "is_default_shipping": 1
+ },
+ {
+ "entity_id": "99",
+ "firstname": "John",
+ "lastname": "Doe",
+ "city": "San Jose",
+ "country_id": "US",
+ "region": "California",
+ "postcode": "94070",
+ "telephone": "898-555-1212",
+ "street": [
+ "123 Easy St"
+ ],
+ "is_default_billing": 1,
+ "is_default_shipping": 0
+ }
+]
+
+ Notes: If the customer has more than two street addresses, they will be returned in the following form: first address in the first string and all other addresses in the second string separated with a semicolon (like in the example above).
+ +Description: Allows you to create a new address for the required customer.
+Notes: The Customer user type can create addresses only for themselves.
When adding a street address for the customer, it should look like the following:
+<street> + <data_item>street address 1</data_item> + <data_item>street address 2</data_item> + <data_item>street address 3</data_item> +</street>+
Authentication: Admin, Customer
+Default Format: XML
Parameters:
+ +| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| firstname | +Customer first name | +required | +string | +John | +
| lastname | +Customer last name | + required |
+string | +Doe | +
| street |
+Customer street address. There can be more than one street address. | + required |
+string | + 2800 Watson Lane |
+
| city |
+Name of the city | + required |
+string | + Asheville |
+
| country_id |
+Name of the country | + required |
+string | + US |
+
| region | +Region name or code | +required for countries with regions (USA, Canada, etc.) | +string | +Palau | +
| postcode |
+Customer ZIP/postal code | + required |
+string | + 28803 |
+
| telephone |
+Customer phone number | + required |
+string | + 828-775-0519 |
+
Example:
+ +| POST http://magentohost/api/rest/customers/1/addresses |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <firstname>Johny</firstname> + <lastname>Doe</lastname> + <city>PA</city> + <region>Palau</region> + <postcode>19103</postcode> + <country_id>US</country_id> + <telephone>611-634-1181</telephone> + <street> + <data_item>2354 Jody Road Philadelphia</data_item> + <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> + </street> +</magento_api>+
Update Customer Address: not allowed.
+ + +Description: Not allowed.
+ + + +Allows you to manage an existing customer address.
+ +URL Structure: http://magentohost/api/rest/customers/addresses/:address_id
+Version: 1
Description: Allows you to retrieve an existing customer address.
+Notes: The list of attributes that will be returned for customer address is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses. Also, Admin can add additional non-system customer address attributes by selecting Customers > Attributes > Manage Customer Address Attributes (available only in Magento Enterprise Edition). If these attributes are set as visible on frontend, they will be returned in the response.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| GET http://magentohost/api/rest/customers/addresses/2 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <entity_id>2</entity_id> + <firstname>John</firstname> + <lastname>Doe</lastname> + <city>PA</city> + <region>Palau</region> + <postcode>19103</postcode> + <country_id>US</country_id> + <telephone>610-634-1181</telephone> + <prefix>Dr.</prefix> + <middlename></middlename> + <suffix>Jr.</suffix> + <company></company> + <fax></fax> + <vat_id>123456789</vat_id> + <street> + <data_item>2356 Jody Road Philadelphia</data_item> + <data_item>844 Jefferson Street; 4510 Willis Avenue</data_item> + </street> + <is_default_billing>1</is_default_billing> + <is_default_shipping>1</is_default_shipping> +</magento_api>+
response body: json:
+
+
+{
+ "entity_id": "2",
+ "firstname": "John",
+ "lastname": "Doe",
+ "city": "San Jose",
+ "country_id": "US",
+ "region": "California",
+ "postcode": "94070",
+ "telephone": "898-555-1212",
+ "street": [
+ "123 Easy St"
+ ],
+ "is_default_billing": 1,
+ "is_default_shipping": 0
+}
+ Description: Not allowed.
+ +Description: Allows you to update an existing customer address.
+Notes: The list of attributes that will be updated for customer address is configured in the Magento Admin Panel. The Customer user type has access only to his/her own addresses.
If you want to add more addresses, it should look like the following:
+<street> +Â Â <data_item>street address 1</data_item> +Â Â <data_item>street address 2</data_item> +Â Â <data_item>street address 3</data_item> +</street>+
Authentication: Admin, Customer
+Default Format: XML
Example:
+ +| PUT http://magentohost/api/rest/customers/addresses/7 |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <firstname>Johny</firstname> + <lastname>Doe</lastname> + <city>PA</city> + <region>Palau</region> + <postcode>19103</postcode> + <country_id>US</country_id> + <telephone>610-634-1181</telephone> + <street> + <data_item>2356 Jody Road Philadelphia</data_item> + <data_item>844 Jefferson Street</data_item> + </street> + <is_default_billing>1</is_default_billing> + <is_default_shipping>1</is_default_shipping> +</magento_api>+
request body: json:
+
+
+{
+ "entity_id": "99",
+ "firstname": "John",
+ "lastname": "Doe",
+ "city": "San Jose",
+ "country_id": "US",
+ "region": "California",
+ "postcode": "94070",
+ "telephone": "898-555-1212",
+ "street": [
+ "123 Easy St"
+ ],
+ "is_default_billing": 1,
+ "is_default_shipping": 0
+}
+ Description: Allows you to delete an existing customer address.
+Notes: The Customer user type can delete only his/her own addresses.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+ +| DELETE http://magentohost/api/rest/customers/addresses/7 |
| Status Code | +Message | +Description | +
|---|---|---|
| 405 | +Resource method not implemented yet. | +The required method is not implemented or not allowed. | +
| 404 | + Resource not found. |
+The specified resource is not found or does not exist. | +
| 400 | +Invalid country identifier type | +The <country_id> value is passed not as a string type. | +
| 400 | + <value name> is a required value. |
+The specified value is a required one. | +
| 400 | + Country does not exist |
+The specified country does not exist. | +
| 400 | +Country is required | +The <country_id> value is required. | +
| 400 | + Country is not between '2' and '3' inclusively. |
+The country code is not in the range of 2 and 3 symbols inclusively. | +
| 400 | + Invalid State/Province type |
+The <region> value is invalid (value is empty or passed as an array) | +
| 400 | + State/Province is required |
+The <region> value is required for the specified country. | +
| 400 | + State/Province is invalid |
+The entered value for <region> is invalid. It must be the region code (TX) or region name (Texas). | +
| 400 | + State/Province does not exist |
+The specified region does not exist (only for the country with predefined regions). | +
| 400 | + Address is default for customer so is not allowed to be deleted |
+The address cannot be deleted because it is set as a default one for billing or shipping. | +
Allows you to create and retrieve customers.
+ +URL Structure: http://magentohost/api/rest/customers
+Version: 1
Description: Allows you to retrieve the list of existing customers.
+Notes:: Only Admin user can retrieve the list of customers with all their attributes.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example
+| GET http://magentohost/api/rest/customers |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>2</entity_id> + <website_id>1</website_id> + <email>test@example.com</email> + <group_id>1</group_id> + <created_at>2012-03-22 14:15:54</created_at> + <disable_auto_group_change>1</disable_auto_group_change> + <firstname>john</firstname> + <lastname>Doe</lastname> + <created_in>Default Store View</created_in> + </data_item> + <data_item> + <entity_id>4</entity_id> + <website_id>1</website_id> + <email>earl@example.com</email> + <group_id>1</group_id> + <created_at>2012-03-28 13:54:04</created_at> + <disable_auto_group_change>0</disable_auto_group_change> + <firstname>Earl</firstname> + <lastname>Hickey</lastname> + <created_in>Admin</created_in> + </data_item> +</magento_api>+
response example: json
+| get http://magentohost/api/rest/customers |
response body:
+
+
+{
+ "2": {
+ "entity_id": "2",
+ "website_id": "1",
+ "email": "test@example.com",
+ "group_id": "1",
+ "created_at": "2012-03-22 14:15:54",
+ "disable_auto_group_change": "1",
+ "firstname": "john",
+ "lastname": "Doe",
+ "created_in": "Admin",
+ "prefix": null,
+ "suffix": null,
+ "taxvat": null,
+ "dob": "2001-01-03 00:00:00",
+ "reward_update_notification": "1",
+ "reward_warning_notification": "1",
+ "gender": "1"
+ },
+ "4": {
+ "entity_id": "4",
+ "website_id": "1",
+ "email": "earl@example.com",
+ "group_id": "1",
+ "created_at": "2013-03-28 18:59:41",
+ "disable_auto_group_change": "0",
+ "firstname": "Earl",
+ "lastname": "Hickey",
+ "created_in": "Admin",
+ "prefix": null,
+ "suffix": null,
+ "taxvat": null,
+ "dob": "2012-03-28 13:54:04",
+ "reward_update_notification": "1",
+ "reward_warning_notification": "1",
+ "gender": "1"
+ }
+
+ Description: Allows you to create a new customer.
+Authentication: Admin
+Default Format: XML
+Parameters:
| Name | +Description | +Required | +Type | +Example Value | +
|---|---|---|---|---|
| firstname | +The customer first name | +required | +string | +John | +
| lastname | +The customer last name | +required | +string | +Doe | +
| The customer email address | +required | +string | +johny@example.com | +|
| password | +The customer password. The password must contain minimum 7 characters | +required | +string | +123123q | +
| website_id | +Website ID | +required | +int | +1 | +
| group_id | +Customer group ID | +required | +int | +1 | +
| disable_auto_group_change | +Defines whether the automatic group change for the customer will be disabled | +optional | +int | +0 | +
| prefix |
+Customer prefix | + optional |
+string | +Mr. | +
| middlename |
+Customer middle name or initial | + optional |
+string | +R. | +
| suffix |
+Customer suffix | + optional |
+string | +Sr. | +
| taxvat |
+Customer Tax or VAT number | + optional |
+string | + GB999 9999 73 |
+
Notes: The list of parameters may change depending on the attributes settings in Customers > Attributes > Manage Customer Attributes page in Magento Admin Panel. For example, a required status of the middlename attribute (Middle Name/Initial) may be changed to 'YES". Please note that managing customer attributes is available only in Magento Enterprise Edition.
+ +Example:
+| POST http://magentohost/api/rest/customers |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <firstname>Earl</firstname> + <lastname>Hickey</lastname> + <password>123123q</password> + <email>earl@example.com</email> + <website_id>1</website_id> + <group_id>1</group_id> +</magento_api>+
Response:
+If the customer was created successfully, we receive Response HTTP Code = 200, empty Response Body and Location header like '/api/rest/customers/555' where '555' - an entity id of the new customer.
Description: Not allowed
+ +Description: Not allowed
+ +Allows you to manage existing customers.
+ +URL Structure: http://magentohost/api/rest/customers/:customerId
+Version: 1
Description: Allows you to retrieve information on an existing customer.
+Notes:: The list of attributes that will be returned for customers is configured in the Magento Admin Panel. The Customer user type has access only to his/her own information. Also, Admin can add additional non-system customer attributes by selecting Customers > Attributes > Manage Customer Attributes. If these attributes are set as visible on frontend, they will be returned in the response. Also, custom attributes will be returned in the response only after the customer information is updated in the Magento Admin Panel or the specified custom attribute is updated via API (see the PUT method below). Please note that managing customer attributes is available only in Magento Enterprise Edition.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+No Parameters
Example:
+| GET http://magentohost/api/rest/customers/2 |
Response Body:
+<?xml version="1.0"?> +<magento_api> + <entity_id>2</entity_id> + <website_id>1</website_id> + <email>test@example.com</email> + <group_id>1</group_id> + <created_at>2012-03-22 14:15:54</created_at> + <disable_auto_group_change>1</disable_auto_group_change> + <created_in>Default Store View</created_in> + <firstname>john</firstname> + <lastname>Doe</lastname> + <last_logged_in>2012-03-22 14:15:56</last_logged_in> +</magento_api>+
response example: json
+ + +response body:
+
+
+{
+ "entity_id": "2",
+ "website_id": "1",
+ "email": "test@example.com",
+ "group_id": "1",
+ "created_at": "2012-03-22 14:15:54",
+ "disable_auto_group_change": "1",
+ "created_in": "English",
+ "firstname": "john",
+ "lastname": "Doe"
+}
+
+ Description: Not allowed.
+ +Description: Allows you to update an existing customer.
+Notes: The list of attributes that will be updated for customer is configured in the Magento Admin Panel. The Customer user type has access only to his/her own information.
Authentication: Admin, Customer
+Default Format: XML
+Parameters:
+You must specify only those parameters which you want to update. Parameters that are not defined in the request body will preserve the previous values. The website_id and created_in attributes are not allowed for updating.
Example:
+| PUT http://magentohost/api/rest/customers/2 |
Request Body:
+<?xml version="1.0"?> +<magento_api> + <firstname>Earl</firstname> + <lastname>Hickey</lastname> + <email>customerss@example.com</email> + <group_id>1</group_id> +</magento_api>+
Description: Allows you to delete an existing customer.
+Notes: Admin only can delete a customer.
Authentication: Admin
+Default Format: XML
+Parameters:
+No Parameters
Example:
+| DELETE http://magentohost/api/rest/customers/2 |
The Magento REST API allows you to manage customers, customer addresses, sales orders, inventory, and products. REST API is organized into the following categories:
+ + + +Retrieve the list of products, create, update, delete a product.
+ +Resource Structure: http://magentohost/api/rest/products
+ +Retrieve the list of categories assigned to a product, assign and unassign the category from a product.
+ +Resource Structure: http://magentohost/api/rest/products/:id/categories
+ +Retrieve the list of images assigned to a product, add, update, remove an image to/from a product.
+ +Resource Structure: http://magentohost/api/rest/products/:id/images
+ +Retrieve the list of websites assigned to a product, assign, unassign a website to/from a product.
+ +Resource Structure: http://magentohost/api/rest/products/:id/websites
+ +Retrieve the list of customers, create, delete a customer, and update the customer information.
+ +Resource Structure: http://magentohost/api/rest/customers
+ +Retrieve the list of customer addresses, create, update, and delete the customer address.
+ +Resource Structure: http://magentohost/api/rest/customers/:id/addresses
+ +Retrieve the list of stock items, update required stock items.
+ +Resource Structure: http://magentohost/api/rest/stockitems
+ +Retrieve the list of sales orders with detailed information on order addresses, items, and comments.
+ +Resource Structure: http://magentohost/api/rest/orders
+ +Retrieve information on order billing and shipping addresses.
+ +Resource Structure: http://magentohost/api/rest/orders/:id/addresses
+ +Retrieve information on the specified order comments.
+ +Resource Structure: http://magentohost/api/rest/orders/:id/comments
+ +Retrieve information on specified order items.
+ +Resource Structure: http://magentohost/api/rest/orders/:id/items
+ + + + diff --git a/guides/v19.x/api/rest/authentication/oauth_authentication.html b/guides/v19.x/api/rest/authentication/oauth_authentication.html new file mode 100644 index 0000000000..8a716745f7 --- /dev/null +++ b/guides/v19.x/api/rest/authentication/oauth_authentication.html @@ -0,0 +1,469 @@ +--- +layout: v1x_rest +title: Authentication +--- + +In most cases, the third-party application must be authenticated to use the Magento API. But users never reveal their credentials to the application to preserve their privacy. So, the question is as follows: how is your application going to authenticate users if it does not know user credentials. OAuth is the solution.
+ +Magento authentication is based on OAuth, an open standard for secure API authentication. OAuth is a token-passing mechanism that allows users to control which applications have access to their data without revealing their passwords or other credentials.
+ +The OAuth concept lies in three basic elements that can be easily described in the following picture:
+ + +
+
+To learn more about OAuth, you can visit the official OAuth site.
+ + +The current API supports OAuth 1.0a.
+ +The OAuth authentication works by asking the user to authorize their application. When the user authorizes the application, the application can access that user protected resources by using an access token. This token will be used in each further request. Access tokens are long-lived and will not expire unless the user revokes access to the application.
+ +OAuth is completely invisible for the site visitors.
+ +Magento uses OAuth to allow access to its data. You need to use OAuth if you want to use any of the following Magento APIs:
+ +There are some definitions you need to get familiar with before you start using OAuth. These are as follows:
+The OAuth process consists of several steps:
+
+
+The application that requires access to data is known as the Consumer and Magento is the Service Provider.
+ + +Before starting to make API requests, you need to register the application. After the registration, you will receive the Consumer Key that will identify you in Magento. Also, you will receive a Consumer Secret. This secret will be used when requesting for a Request Token.
+ +You can register your application by selecting System > Web Services > REST - OAuth Consumers and clicking Add New in the Admin Panel.
+ +When registering the application, you also need to define the callback URL, to which the user will be redirected after he/she successfully authorizes your application.
+ +The authentication endpoints include the following ones:
+ +Also, the simple form can be used for authentication. To use a simple form, add the /simple endpoint to the authentication endpoint. For example: /oauth/authorize/simple
+ + +The first step to authenticate the user is to retrieve a Request Token from Magento. This is a temporary token that will be exchanged for the Access Token.
+ + + +| Endpoint: | +/oauth/initiate | +
|---|---|
| Description: | +The first step of authentication. Allows you to obtain the Request Token used for the rest of the authentication process. | +
| Method: | +POST | +
| Returns: | +Request Token | +
| Sample Response: | +oauth_token=4cqw0r7vo0s5goyyqnjb72sqj3vxwr0h&oauth_token_secret=rig3x3j5a9z5j6d4ubjwyf9f1l21itrr&oauth_callback_confirmed=true | +
The following request parameters should be present in the Authorization header:
+The second step is to request user authorization. After receiving the Request Token from Magento, the application provides an authorization page to the user. The only required parameter for this step is the Request Token (oauth_token value) received from the previous step. The endpoint is followed by an oauth_token parameter with the value set to the oauth_token value.
+ +After this, the user is asked to enter their credentials and authorize. When the user is granted the access, he/she is redirected to the URL specified in the oauth_callback parameter. This URL is followed by two parameters:
+| Endpoint: | +/oauth/authorize | +
|---|---|
| Description: | +The second step of authentication. Without the user authorization in this step, it is impossible for your application to obtain an Access Token. | +
| Method: | +GET | +
| Sample Response: | +/callback?oauth_token=tz2kmxyf3lagl3o95xnox9ia15k6mpt3&oauth_verifier=cbwwh03alr5huiz5c76wi4l21zf05eb0 | +
The final third authentication step. After the application access is authorized, the application needs to exchange the Request Token for an Access Token. For this step, you will need the Request Token (the oauth_token and oauth_token_secret values) and the oauth_verifier value from the previous step.
+ + + +| Endpoint: | +/oauth/token | +
|---|---|
| Description: | +The third step of authentication. Getting an Access Token. | +
| Method: | +POST | +
| Returns: | +An access token and the corresponding access token secret, URL-encoded. | +
| Sample Response: | +oauth_token=0lnuajnuzeei2o8xcddii5us77xnb6v0&oauth_token_secret=1c6d2hycnir5ygf39fycs6zhtaagx8pd | +
The following components should be present in the Authorization header:
+The response will contain the following response parameters:
+When the third-party application performs invalid requests to Magento, the following errors related to OAuth can occur:
+ + +| HTTP Code | +Error Code | +Text Representation | +Description | +
|---|---|---|---|
| 400 | +1 | +version_rejected | +This error is used when the oauth_version parameter does not correspond to the "1.0a" value. | +
| 400 | +2 | + parameter_absent |
+This error is used there is no required parameter in the request. The name of the missing parameter is specified additionally in the response. | +
| 400 | +3 | + parameter_rejected |
+This error is used when the type of the parameter or its value does not meet the protocol requirements (e.g., array is passed instead of the string). | +
| 400 | +4 | + timestamp_refused |
+This error is used if there is incorrect value of the timestamp in the oauth_timestamp parameter. | +
| 401 | +5 | + nonce_used |
+This error is used if the nonce-timestamp combination has already been used. | +
| 400 | +6 | + signature_method_rejected |
+This error is used for unsupported signature method. The following methods are supported: HMAC-SHA1, RSA-SHA1, and PLAINTEXT. | +
| 401 | +7 | + signature_invalid |
+This error is used if the signature is invalid. | +
| 401 | +8 | + consumer_key_rejected |
+This error is used if the Consumer Key has incorrect length or does not exist. | +
| 401 | +9 | + token_used |
+This error is used if there is an attempt of authorization of an already authorized token or an attempt to exchange a not temporary token for a permanent one. | +
| 401 | +10 | + token_expired |
+This error is used if the temporary token has expired. At the moment, the mechanism of expiration of temporary tokens is not implemented and the current error is not used. | +
| 401 | +11 | + token_revoked |
+This error is used if the token is revoked by the user who authorized it. | +
| 401 | +12 | + token_rejected |
+This error is used if the token is not valid, or does not exist, or is not valid for using in the current type of request. | +
| 401 | +13 | + verifier_invalid |
+This error is used if the confirmation string does not correspond to the token. | +
<?php
+/**
+ * Example of retrieving the products list using Customer account via Magento REST API. OAuth authorization is used
+ * Preconditions:
+ * 1. Install php oauth extension
+ * 2. If you were authorized as an Admin before this step, clear browser cookies for 'yourhost'
+ * 3. Create at least one product in Magento and enable it for viewing in the frontend
+ * 4. Configure resource permissions for Customer REST user for retrieving all product data for Customer
+ * 5. Create a Consumer
+ */
+// $callbackUrl is a path to your file with OAuth authentication example for the Customer user
+$callbackUrl = "http://yourhost/oauth_customer.php";
+$temporaryCredentialsRequestUrl = "http://yourhost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
+$customerAuthorizationUrl = 'http://yourhost/oauth/authorize';
+$accessTokenRequestUrl = 'http://yourhost/oauth/token';
+$apiUrl = 'http://yourhost/api/rest';
+$consumerKey = 'yourconsumerkey';
+$consumerSecret = 'yourconsumersecret';
+
+session_start();
+if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
+ $_SESSION['state'] = 0;
+}
+try {
+ $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
+ $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
+ $oauthClient->enableDebug();
+
+ if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
+ $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
+ $_SESSION['secret'] = $requestToken['oauth_token_secret'];
+ $_SESSION['state'] = 1;
+ header('Location: ' . $customerAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
+ exit;
+ } else if ($_SESSION['state'] == 1) {
+ $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
+ $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
+ $_SESSION['state'] = 2;
+ $_SESSION['token'] = $accessToken['oauth_token'];
+ $_SESSION['secret'] = $accessToken['oauth_token_secret'];
+ header('Location: ' . $callbackUrl);
+ exit;
+ } else {
+ $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
+
+ $resourceUrl = "$apiUrl/products";
+ $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json'));
+ $productsList = json_decode($oauthClient->getLastResponse());
+ print_r($productsList);
+ }
+} catch (OAuthException $e) {
+ print_r($e->getMessage());
+ echo "<br/>";
+ print_r($e->lastResponse);
+}
+
diff --git a/guides/v19.x/api/rest/authentication/oauth_configuration.html b/guides/v19.x/api/rest/authentication/oauth_configuration.html
new file mode 100644
index 0000000000..f7e63369c3
--- /dev/null
+++ b/guides/v19.x/api/rest/authentication/oauth_configuration.html
@@ -0,0 +1,261 @@
+---
+layout: v1x_rest
+title: OAuth Configuration
+---
+
+
+Before starting to use OAuth, you need to perform several steps in the Magento Admin Panel. These steps allow you to enable the OAuth functionality for further actions.
+ +First, you need to create a Consumer in the Admin Panel. Creating a new consumer means registering the application. To do this, perform the following steps:
+ +
To edit an existing consumer, perform the following steps:
+ +| The Key and Secret fields cannot be edited. |
To delete the required consumer, perform the following steps:
+You can search for a required consumer by several parameters: ID, consumer name, and date of creation.
+To search for a consumer, perform the following steps:
To view authorized tokens in the Admin panel, perform the following steps:
+ +From the Authorized OAuth Tokens page, you can enable, revoke, or delete the required token.
+ +To view the list of applications, perform the following steps:
+If a token is revoked (the Yes value in the Revoked column on the Authorized OAuth Tokens page), you can enable it. To do this, perform the following steps:
+| You can select more than one token with the Revoked status and enable all of them by using the mass action. |
If a token is enabled (the No value in the Revoked column), you can revoke it. To do this, perform the following steps:
+| You can select more than one token with the Revoked status set to No and revoke all of them by using the mass action. |
To delete the required token, perform the following steps:
+| You can select more than one token and delete all of them by using the mass action. |
To view the authorized applications from the frontend, perform the following steps:
+ +
From this page, you can enable, revoke, or delete the required token.
+ +| If the token is revoked, there will be the Disabled status next to it. |
| If the token is enabled, there will be the Enabled status next to it. |
You can set the email template that will be used for user notification if the token status changes. Also, you can set different email templates for different store views. For example, you have two store views: English and German. Magento allows you to set one email template for the English store view and another one for the German store view.
+To set the email template, perform the following steps:

You can also create your own email template that will be used for user notification if the token status changes.
+To create a new template, perform the following steps:
You can configure the cleanup functionality for temporary tokens. These tokens can be deleted after a certain period of time or after a certain number of OAuth requests.
+To configure cleanup, perform the following steps:

HTTP status codes are an essential part of the REST concept. You can get familiar with all of them on Wikipedia.
+ +The Magento API attempts to return appropriate HTTP status codes for all requests. Any information is returned in the form of a standard HTTP response with an HTTP status code describing the error and the body message.
+ +The following table contains possible common HTTP status codes:
+ +| Status Code | +Message | +
|---|---|
| 200 OK | +- | +
| 201 Created | + Resource was partially created + |
+
| 207 Multi-Status | +- | +
| 400 Bad Request | + Resource data pre-validation error. +Resource data invalid. +Resource unknown error. +The request data is invalid. +Resource collection paging error. +The paging limit exceeds the allowed number. +Resource collection ordering error. +Resource collection filtering error. +Resource collection including additional attributes error. |
+
| 403 Forbidden | +Access denied. | +
| 404 Not Found | + Resource not found. |
+
| 405 Method Not Allowed | + Resource does not support method. +Resource method not implemented yet. |
+
| 500 Internal Error | + Unhandled simple errors. +Resource internal error. |
+
When the Magento API returns an error message, it returns it in your requested format. For example, an error in the XML format might look like the following:
+<?xml version="1.0"?> +<magento_api> + <messages> + <error> + <data_item> + <code>404</code> + <message>Resource not found.</message> + </data_item> + </error> + </messages> +</magento_api>+
An error in the JSON format might look like the following:
+ +{"messages":{"error":[{"code":404,"message":"Resource not found."}]}}
+ Some requests use GET parameters in the URL. These are as follows:
+ +If the attribute value consists of several words separated by a whitespace, the '%20' sign is used:
+ + + +For example, to filter products with the description equal to simple01:
+ + + +To filter customers by email address:
+ +http://magentohost/api/rest/customers?filter[1][attribute]=email&filter[1][in][0]=ryan@test.com
+ + diff --git a/guides/v19.x/api/rest/http_methods.html b/guides/v19.x/api/rest/http_methods.html new file mode 100644 index 0000000000..f58d4dd98c --- /dev/null +++ b/guides/v19.x/api/rest/http_methods.html @@ -0,0 +1,90 @@ +--- +layout: v1x_rest +title: HTTP Methods +--- + + +Accessing API is performed via HTTP. When you enter a URL into a web browser address bar, the browser performs an HTTP GET request to the URL. This usually returns a web page in the form of an HTTP response that the browser displays. But the GET method is one of several HTTP request methods. Magento REST API uses the four main HTTP methods: GET, POST, PUT, and DELETE. The most widespread methods are GET and POST. The other methods are less known but they became widely known due to the popularity of REST web services. An important concept of the REST architecture is that different HTTP request methods perform different actions when applied to the same URL.
+ +For example:
+ + + +will retrieve information about the specified customer;
+ + + +will delete the specified customer.
+ +Retrieving Resources with the HTTP GET Method
+ +The HTTP GET method is defined in section 9.3 of the RFC2616 document:
+ +++The GET method means retrieve whatever information (in the form of an entity) is identified by the Request-URI. If the Request-URI refers to a data-producing process, it is the produced data which shall be returned as the entity in the response and not the source text of the process, unless that text happens to be the output of the process.
You can retrieve a representation of a resource by getting its URL.
+ + + +Creating or Updating Resources with the HTTP POST and PUT Methods
+ +The POST method is defined in section 9.5 of the RFC2616 document:
+ +++ + +The POST method is used to request that the origin server accept the entity enclosed in the request as a new subordinate of the resource identified by the Request-URI in the Request-Line. POST is designed to allow a uniform method to cover the following functions:
+ ++
+ + +- Annotation of existing resources;
++
+ + +- Posting a message to a bulletin board, newsgroup, mailing list, or similar group of articles;
++
+ + +- Providing a block of data, such as the result of submitting a form, to a data-handling process;
++
+ +- Extending a database through an append operation.
+
The PUT method is defined in section 9.6 of the RFC2616 document:
+ ++ + +The PUT method requests that the enclosed entity be stored under the supplied Request-URI. If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.
Creating or updating a resource involves performing an HTTP POST or HTTP PUT to a resource URL.
+ + + +Deleting Resources with the HTTP DELETE Method
+ +The DELETE method is defined in section 9.7 of the RFC2616 document:
+ ++ + +The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human intervention (or other means) on the origin server.
Deleting a resource is performed by means of making an HTTP DELETE request to the resource URL.
+ + + diff --git a/guides/v19.x/api/rest/introduction.html b/guides/v19.x/api/rest/introduction.html new file mode 100644 index 0000000000..5ecca7ef8d --- /dev/null +++ b/guides/v19.x/api/rest/introduction.html @@ -0,0 +1,510 @@ +--- +layout: v1x_rest +title: Introduction to the Magento 1.x REST API +--- + + +What is REST API? To make it simple, REST API defines a set of functions to which the developers can perform requests + and receive responses. The interaction is performed via the HTTP protocol. An advantage of such an approach is the + wide usage of HTTP. That is why REST API can be used practically for any programming language.
+ +Common characteristics of Magento REST API resources are as follows: (magentohost is your domain)
+ +Magento REST API allows managing a number of features, namely:
+ +Magento REST API uses 3-legged OAuth 1.0a protocol to authenticate + the application to access the Magento service.
+ + +The REST API supports the response in two formats, which are XML and JSON.
+ +HTTP verbs are used to manage the state of resources. In Magento REST API, there are four verbs used to manage + resources: GET, POST, PUT, and DELETE. You can get the contents of the data using HTTP GET, delete the data using + HTTP DELETE, and create or update the data using POST/PUT.
+ +All URLs in REST API have the following base URL.
+ +http://magentohost/api/rest/
+ + +Example
+ +Supposing, you want to retrieve the list of customers from Magento. To do this, you need to use the GET HTTP method. + The GET request to retrieve the list of customers will look as follows:
+ +http://magentohost/api/rest/customers
+where
+ +The Magento REST API allows you to manage customers, customer addresses, sales orders, inventory, and products. REST + API is organized into the following categories:
+ +These steps are required for utilizing REST API resources:
+ +
<?php
+/**
+* Example of simple product POST using Admin account via Magento REST API. OAuth authorization is used.
+*
+* This file is a stand-alone OAuth client PHP file, which handles everything with the OAuth three-legged authentication.
+* It uses PHP session to persist the current authentication state (step), the OAuth request token with its secret
+* and the OAuth access token with its secret.
+*
+* Create this file oauth_admin.php in your Magento 1.x instance root folder to run this oauth authentication example.
+*
+* oauth_admin.php
+*
+*/
+
+$callbackUrl = "http://yourhost/oauth_admin.php";
+$temporaryCredentialsRequestUrl = "http://magentohost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
+$adminAuthorizationUrl = 'http://magentohost/admin/oauth_authorize';
+$accessTokenRequestUrl = 'http://magentohost/oauth/token';
+$apiUrl = 'http://magentohost/api/rest';
+$consumerKey = 'yourconsumerkey';
+$consumerSecret = 'yourconsumersecret';
+
+session_start();
+if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
+ $_SESSION['state'] = 0;
+}
+try {
+ $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
+ $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
+ $oauthClient->enableDebug();
+
+ if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
+ // step 1 (state 1) - Get the initial temporary request token.
+ $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
+
+ // persist the request token secret in the session variable for step 3 to get the access token and secret.
+ $_SESSION['secret'] = $requestToken['oauth_token_secret'];
+ $_SESSION['state'] = 1;
+
+ // step 2 (state 2) - redirect to the Oauth admin authorization url to validate and confirm / reject the admin Oauth authorization request.
+ // variable $requestToken['oauth_token'] has the temporary request token
+ header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
+ exit;
+ } elseif ($_SESSION['state'] == 1) {
+ //step 3 (state 3) Exchange the temporary request token and secret to get the final access token and secret.
+ $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
+ $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
+
+ // persist the access token and its secret in the session variable
+ $_SESSION['state'] = 2;
+ $_SESSION['token'] = $accessToken['oauth_token'];
+ $_SESSION['secret'] = $accessToken['oauth_token_secret'];
+
+ // redirect back to the callback url which is the same file
+ header('Location: ' . $callbackUrl);
+ exit;
+ } else {
+
+ // send a POST request to create a simple product
+ $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
+ $resourceUrl = "$apiUrl/products";
+ $productData = json_encode(array(
+ 'type_id' => 'simple',
+ 'attribute_set_id' => 4,
+ 'sku' => 'simple' . uniqid(),
+ 'weight' => 1,
+ 'status' => 1,
+ 'visibility' => 4,
+ 'name' => 'Simple Product',
+ 'description' => 'Simple Description',
+ 'short_description' => 'Simple Short Description',
+ 'price' => 99.95,
+ 'tax_class_id' => 0,
+ ));
+ $headers = array('Content-Type' => 'application/json');
+ $oauthClient->fetch($resourceUrl, $productData, OAUTH_HTTP_METHOD_POST, $headers);
+ print_r($oauthClient->getLastResponseInfo());
+ }
+} catch (OAuthException $e) {
+ print_r($e);
+}
+ <?php
+/**
+* Example of products list retrieve using Customer account via Magento REST API. OAuth authorization is used
+*
+* This file is a stand-alone Oauth client PHP file, which handles everything with the Oauth three-legged authentication.
+* It uses PHP session to persist the current authentication state (step), the oauth request token with its secret
+* and the oauth access token with its secret.
+*
+* Create this file oauth_customer in your Magento 1.x instance root folder to run this oauth authentication example.
+*
+* oauth_customer.php
+*
+*/
+$callbackUrl = "http://yourhost/oauth_customer.php";
+$temporaryCredentialsRequestUrl = "http://magentohost/oauth/initiate?oauth_callback=" . urlencode($callbackUrl);
+$adminAuthorizationUrl = 'http://magentohost/oauth/authorize';
+$accessTokenRequestUrl = 'http://magentohost/oauth/token';
+$apiUrl = 'http://magentohost/api/rest';
+$consumerKey = 'yourconsumerkey';
+$consumerSecret = 'yourconsumersecret';
+
+session_start();
+if (!isset($_GET['oauth_token']) && isset($_SESSION['state']) && $_SESSION['state'] == 1) {
+ $_SESSION['state'] = 0;
+}
+try {
+ $authType = ($_SESSION['state'] == 2) ? OAUTH_AUTH_TYPE_AUTHORIZATION : OAUTH_AUTH_TYPE_URI;
+ $oauthClient = new OAuth($consumerKey, $consumerSecret, OAUTH_SIG_METHOD_HMACSHA1, $authType);
+ $oauthClient->enableDebug();
+
+ if (!isset($_GET['oauth_token']) && !$_SESSION['state']) {
+ // step 1 (state 1) - Get the initial temporary request token.
+ $requestToken = $oauthClient->getRequestToken($temporaryCredentialsRequestUrl);
+
+ // persist the request token secret in the session variable for step 3 to get the access token and secret.
+ $_SESSION['secret'] = $requestToken['oauth_token_secret'];
+ $_SESSION['state'] = 1;
+
+ // step 2 (state 2) - redirect to the Oauth customer authorization url.
+ // variable $requestToken['oauth_token'] has the temporary request token
+ header('Location: ' . $adminAuthorizationUrl . '?oauth_token=' . $requestToken['oauth_token']);
+ exit;
+ } elseif ($_SESSION['state'] == 1) {
+ //step 3 (state 3) Exchange the temporary request token and secret to get the final access token and secret.
+ $oauthClient->setToken($_GET['oauth_token'], $_SESSION['secret']);
+ $accessToken = $oauthClient->getAccessToken($accessTokenRequestUrl);
+
+ // persist the access token and its secret in the session variable to access the products resource
+ $_SESSION['state'] = 2;
+ $_SESSION['token'] = $accessToken['oauth_token'];
+ $_SESSION['secret'] = $accessToken['oauth_token_secret'];
+
+ // redirect back to the callback url which is the same file
+ header('Location: ' . $callbackUrl);
+ exit;
+ } else {
+ // send a GET request to list all the products
+ $oauthClient->setToken($_SESSION['token'], $_SESSION['secret']);
+ $resourceUrl = "$apiUrl/products";
+ $oauthClient->fetch($resourceUrl, array(), 'GET', array('Content-Type' => 'application/json', 'Accept' => '*/*'));
+ $productsList = json_decode($oauthClient->getLastResponse());
+ print_r($productsList);
+ }
+} catch (OAuthException $e) {
+ print_r($e);
+}
+ Retrieving the list of Products as a Guest
+ +Example: XML
+<?xml version="1.0"?> +<magento_api> + <data_item> + <entity_id>16</entity_id> + <type_id>simple</type_id> + <sku>n2610</sku> + <description>The Nokia 2610 is an easy to use device that combines multiple messaging options including email, instant messaging, and more. You can even download MP3 ringtones, graphics, and games straight to the phone, or surf the Internet with Cingular's MEdia Net service. It's the perfect complement to Cingular service for those even remotely interested in mobile Web capabilities in an affordable handset. +Design +Compact and stylish, the 2610 features a candybar design sporting a bright 128 x 128 pixel display capable of displaying over 65,000 colors. Most of the phone's features and on-screen menus are controlled by a center toggle on the control pad. A standard hands-free headphone jack is provided, as are volume control keys, and there's even a "Go-To" button that can be assigned by the user for quick access to favorite applications. Lastly, the included speakerphone allows you to talk handsfree, and because the phone sports an internal antenna, there's nothing to snag or break off. +</description> + <meta_keyword>Nokia 2610, cell, phone, </meta_keyword> + <short_description>The words "entry level" no longer mean "low-end," especially when it comes to the Nokia 2610. Offering advanced media and calling features without breaking the bank</short_description> + <name>Nokia 2610 Phone</name> + <meta_title>Nokia 2610</meta_title> + <meta_description>Offering advanced media and calling features without breaking the bank, The Nokia 2610 is an easy to use</meta_description> + <regular_price_with_tax>149.99</regular_price_with_tax> + <regular_price_without_tax>149.99</regular_price_without_tax> + <final_price_with_tax>149.99</final_price_with_tax> + <final_price_without_tax>149.99</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magentohost/imageulr/nokia.jpg</image_url> + </data_item> + <data_item> + <entity_id>17</entity_id> + <type_id>simple</type_id> + <sku>bb8100</sku> + <description> Like the BlackBerry 7105t, the BlackBerry 8100 Pearl is +The BlackBerry 8100 Pearl sports a large 240 x 260 screen that supports over 65,000 colors-- plenty of real estate to view your e-mails, Web browser content, messaging sessions, and attachments. The venerable BlackBerry trackwheel has been replaced on this model with an innovative four-way trackball placed below the screen. On the rear of the handheld, you'll find a 1.3-megapixel camera and a self portrait mirror. The handheld's microSD memory card slot is located inside the device, behind the battery. There's also a standard 2.5mm headset jack that can be used with the included headset, as well as a mini-USB port for data connectivity.</description> + <meta_keyword>Blackberry, 8100, pearl, cell, phone</meta_keyword> + <short_description>The BlackBerry 8100 Pearl is a departure from the form factor of previous BlackBerry devices. This BlackBerry handset is far more phone-like, and RIM's engineers have managed to fit a QWERTY keyboard onto the handset's slim frame.</short_description> + <name>BlackBerry 8100 Pearl</name> + <meta_title>BlackBerry 8100 Pearl</meta_title> + <meta_description>BlackBerry 8100 Pearl sports a large 240 x 260 screen that supports over 65,000 colors-- plenty of real estate to view your e-mails, Web browser content, messaging sessions, and attachments.</meta_description> + <regular_price_with_tax>349.99</regular_price_with_tax> + <regular_price_without_tax>349.99</regular_price_without_tax> + <final_price_with_tax>349.99</final_price_with_tax> + <final_price_without_tax>349.99</final_price_without_tax> + <is_saleable>1</is_saleable> + <image_url>http://magentohost/imageulr/blackberry.jpg</image_url> + </data_item> +</magento_api>+
Additional Information
+ +You can define the limit of items returned in the response by passing the limit parameter. By default, 10 items are + returned and the maximum number is 100 items. You can also define the page number by passing the page parameter. + Example:
+ +http://magentohost/api/rest/products?page=2&limit=20
+Authorization header will be required for Admin and Customer user types. The following parameters must be provided in + the Authorization header for the call:
+REST attributes allow specifying additional filters for different types of users. Attributes allow limiting user access more precisely.
+ + +
+
+The REST attributes tree includes the following elements (as subnodes):
+The Resources tree may be too immense. To avoid scrolling down when searching for the required resource, you can fold the nodes for better representation.
+ + + +This section provides some examples of limiting Guest and Customer access to certain resource elements.
+ +To allow Guests (users that are not registered in the Magento system) view only product name and final price with tax, perform the following steps:
+To allow Customers (users that are registered in the Magento system) view only product name and final price with tax, perform the following steps:
+The following table describes REST attributes that can be managed in the Magento Admin Panel.
+To access these attributes, go to System > Web Services > REST Attributes and select the type of the user for which attributes will be managed.
| Attribute Name | +Attribute Description | +Notes | +
|---|---|---|
| Order ID | +Sales order ID | ++ |
| Order Date |
+Date when the sales order was placed | ++ |
| Order Status | +Sales order status. Can have the following values: Pending, Processing, Complete, Closed, Holded, Pending PayPal, and Payment Review. | ++ |
| Shipping Method | +Shipping method selected during the checkout process (e.g., Flat rate - Fixed) | ++ |
| Payment Method | +Payment method selected during the checkout process (e.g., Check/money order) | ++ |
| Base Currency |
+Base currency code (e.g., USD) | ++ |
| Order Currency | + Order currency code (e.g., EUR) |
++ |
| Store Name |
+ Name of the store from which the order was placed |
++ |
| Placed from IP |
+ IP address from which the order was placed |
++ |
| Store Currency to Base Currency Rate |
+ Store currency to base currency rate |
++ |
| Subtotal |
+ Subtotal amount in order currency (excluding shipping and tax) |
++ |
| Subtotal Including Tax |
+ Subtotal amount including tax (in order currency) |
++ |
| Discount |
+ Discount amount applied in the sales order in order currency |
++ |
| Grand Total to Be Charged |
+ Total amount of money to be paid for the order in base currency (including tax) |
++ |
| Grand Total |
+ Grand total amount in order currency (including tax and shipping) |
++ |
| Shipping |
+ Shipping amount applied in the sales order in order currency |
++ |
| Shipping Including Tax |
+ Shipping amount including tax (in order currency) |
++ |
| Shipping Tax |
+ Tax amount for shipping in order currency |
++ |
| Tax Amount |
+ Tax amount applied in the sales order in order currency |
++ |
| Tax Name |
+Name of the applied tax | ++ |
| Tax Rate |
+Tax rate applied in the order (in order currency) | ++ |
| Gift Cards Amount |
+Gift card pricing amount | +This attribute is available only in Magento EE | +
| Reward Points Balance |
+Reward points amount (that can be converted to currency) | + This attribute is available only in Magento EE |
+
| Reward Currency Amount |
+Reward currency amount | + This attribute is available only in Magento EE |
+
| Coupon Code |
+ Coupon code that was applied in the order |
++ |
| Base Discount |
+ Amount of applied discount in base currency |
++ |
| Base Subtotal |
+ Subtotal amount for all products in the order in base currency (excluding tax and shipping) |
++ |
| Base Shipping |
+ Amount of money to be paid for shipping in base currency |
++ |
| Base Shipping Tax |
+ Tax amount for shipping in base currency |
++ |
| Base Tax Amount |
+ Tax amount applied to the order items in base currency |
++ |
| Total Paid |
+ Total amount paid for the order (in order currency) |
++ |
| Base Total Paid |
+ Total amount paid for the order (in base currency) |
++ |
| Total Refunded |
+ Total refunded amount in order currency |
++ |
| Base Total Refunded |
+ Total amount refunded for the order (in base currency) |
++ |
| Base Subtotal Including Tax |
+ Subtotal amount including tax but excluding the discount amount (in base currency) |
++ |
| Base Total Due |
+ The rest of the money to be paid for the order in base currency (e.g., when partial invoice is applied) |
++ |
| Total Due |
+ The rest of the money to be paid for the order in order currency (e.g., when partial invoice is applied) |
++ |
| Shipping Discount |
+ Discount amount for shipping (in order currency) |
++ |
| Base Shipping Discount |
+ Discount amount for shipping (in base currency) |
++ |
| Discount Description |
+ Discount code (coupon code applied in the order) |
++ |
| Customer Balance |
+Customer balance (in order currency) | ++ |
| Base Customer Balance |
+Customer balance (in base currency) | ++ |
| Base Gift Cards Amount |
+Gift card pricing amount (in base currency) | + This attribute is available only in Magento EE |
+
| Base Rewards Currency |
+Reward currency amount (in base currency) | + This attribute is available only in Magento EE |
+
| Attribute Name | +Attribute Description | +
|---|---|
| Customer Last Name | +Customer last name | +
| Customer First Name |
+Customer first name | +
| Customer Middle Name |
+Customer middle name or initial | +
| Customer Prefix |
+Customer prefix | +
| Customer Suffix |
+Customer suffix | +
| Company |
+Company name | +
| Street |
+Street address | +
| City |
+City | +
| State |
+State | +
| ZIP/Postal Code |
+ZIP or postal code | +
| Country |
+Country name | +
| Phone Number |
+Customer phone number | +
| Address Type |
+Address type. Can have the following values: billing or shipping | +
| Attribute Name | +Attribute Description | +
|---|---|
| Base Discount Amount | +Discount amount applied to the row in base currency | +
| Base Item Subtotal | +Row subtotal in base currency | +
| Base Item Subtotal Including tax | + Row subtotal including tax in base currency |
+
| Base Original Price | + Original item price in base currency |
+
| Base Price | + Item price in base currency |
+
| Base Price Including tax | + Item price including tax in base currency |
+
| Base Tax Amount | + Tax amount applied to the row in base currency |
+
| Canceled Qty | + Number of canceled order items |
+
| Discount Amount | +Discount amount applied to the row in order currency | +
| Invoiced Qty | + Number of invoiced order items |
+
| Item Subtotal | +Row subtotal in order currency | +
| Item Subtotal Including Tax | +Row subtotal including tax in order currency | +
| Order Item ID | +Order item ID | +
| Ordered Qty | + Number of ordered items |
+
| Original Price | +Original item price in order currency | +
| Parent Order Item ID | +ID of the configurable product to which the simple product is assigned | +
| Price | + Item price in order currency |
+
| Price Including Tax | +Item price including tax in order currency | +
| Product and Custom Options Name | +Name of the product (custom options name) | +
| Refunded Qty | + Number of refunded order items |
+
| SKU | + Product SKU |
+
| Shipped Qty | + Number of shipped order items |
+
| Tax Amount | +Tax amount applied to the row in order currency | +
| Tax Percent | +Tax percent applied to the row | +
| Attribute Name | +Attribute Description | +
|---|---|
| Automatically Return Credit Memo Item to Stock | +Defines whether products can be automatically returned to stock when the refund for an order is created | +
| Backorders | +Defines whether the customer can place the order for products that are out of stock at the moment. Can have the following values: 0 - No Backorders, 1 - Allow Qty Below 0, and 2 - Allow Qty Below 0 and Notify Customer | +
| Can Be Divided into Multiple Boxes for Shipping | + Defines whether the stock items can be divided into multiple boxes for shipping |
+
| Enable Qty Increments | + Defines whether the customer can add products only in increments to the shopping cart |
+
| Item ID | + Stock item ID |
+
| Low Stock Date | + Date when the number of stock items became lower than the number defined in the Notify for Quantity Below option |
+
| Manage Stock | + Choose whether to view and specify the product quantity and availability and whether the product is in stock management. Can have the following values: 0 - No, 1 - Yes |
+
| Maximum Qty Allowed in Shopping Cart | + Maximum number of items in the shopping cart to be sold |
+
| Minimum Qty Allowed in Shopping Cart | + Minimum number of items in the shopping cart to be sold |
+
| Notify for Quantity Below | + The number of inventory items below which the customer will be notified via the RSS feed |
+
| Product ID | + Product ID |
+
| Qty | + Quantity of stock items for the current product |
+
| Qty Increments | + The product quantity increment value |
+
| Qty Uses Decimals | + Choose whether the product can be sold using decimals (e.g., you can buy 2.5 product) |
+
| Qty for Item's Status to Become Out of Stock | + Quantity for stock items to become out of stock |
+
| Stock Availability | + Defines whether the product is available for selling. Can have the following values: 0 - Out of Stock, 1 - In Stock |
+
| Stock ID | + Stock ID |
+
| Use Config Settings for Backorders | + Choose whether the Config settings will be applied for the Backorders option |
+
| Use Config Settings for Enable Qty Increments | + Choose whether the Config settings will be applied for the Enable Qty Increments option |
+
| Use Config Settings for Manage Stock | + Choose whether the Config settings will be applied for the Manage Stock option |
+
| Use Config Settings for Maximum Qty Allowed in Shopping Cart | + Choose whether the Config settings will be applied for the Maximum Qty Allowed in Shopping Cart option |
+
| Use Config Settings for Minimum Qty Allowed in Shopping Cart | + Choose whether the Config settings will be applied for the Minimum Qty Allowed in Shopping Cart option |
+
| Use Config Settings for Notify for Quantity Below | + Choose whether the Config settings will be applied for the Notify for Quantity Below option |
+
| Use Config Settings for Qty Increments | + Choose whether the Config settings will be applied for the Qty Increments option |
+
| Use Config Settings for Qty for Item's Status to Become Out of Stock | + Choose whether the Config settings will be applied for the Qty for Item's Status to Become Out of Stock option |
+
Notes: The Admin user type has restrictions concerning the WRITE operations for definite stock item attributes. These are as follows:
+ +| Attribute Name | +Admin | +
|---|---|
| Item ID | +No | +
| Product ID | +No | +
| Stock ID | +No | +
| Low Stock Date | +No | +
However, these attributes are available for READ operations.
+ + + +| Attribute Name | +Attribute Description | +
|---|---|
| Customer ID | +Customer ID | +
| Last Logged In | +Date when the customer was logged in last | +
| Is Confirmed | +Defines whether the email confirmation is sent to the customer | +
| Created At | +Date when the customer was created | +
| Associate to Website | +Website ID to which the customer is associated | +
| Created From | +Store view from which the customer was created | +
| Group | +Customer group ID | +
| Disable automatic group change | +Defines whether the automatic group change will be applied to the customer | +
| Prefix | +Customer prefix | +
| First Name | +Customer first name | +
| Middle Name/Initial | +Customer middle name or initial | +
| Last Name | +Customer last name | +
| Suffix | +Customer suffix | +
| Customer email address | +|
| Date Of Birth | +Customer date of birth | +
| Tax/VAT Number | +Customer tax or VAT number | +
| Gender | +Customer gender (male or female) | +
| Attribute Name | +Attribute Description | +
|---|---|
| City | +City name | +
| Company | +Company name | +
| Country | +Country | +
| Customer Address ID | +Customer address ID | +
| Fax | +Fax number | +
| First Name | +Customer first name | +
| Is Default Billing Address | +Defines whether the address is a default one for billing | +
| Is Default Shipping Address | +Defines whether the address is a default one for shipping | +
| Last Name | +Customer last name | +
| Middle Name/Initial | +Customer middle name or initial | +
| Prefix | +Customer prefix | +
| State/Province | +Customer state/region | +
| Street Address | +Customer street address | +
| Suffix | +Customer suffix | +
| Telephone | +Customer phone number | +
| VAT Number | +Customer VAT number | +
| ZIP/Postal Code | +Customer ZIP or postal code | +
Attributes for the product resource are divided into those available for the Admin type of user and those available for the Customer and Guest types of user.
+ + +| Attribute Name | +Attribute Description | +Notes | +
|---|---|---|
| Product ID | +Product ID | +Available only for Admin | +
| name | +Product Name | ++ |
| Product Type | +Product type. Can have the following values: Simple, Grouped, Configurable, Virtual, Bundle, or Downloadable | ++ |
| Attribute Set Name | +Name of the attribute set which the product is based on | + Available only for Admin |
+
| sku |
+Product SKU | ++ |
| price | +Product price | ++ |
| visibility | +Product visibility in the store. Can have the following values: Catalog, Search; Search; Catalog; Not Visible Individually | + Available only for Admin |
+
| description | +Product description | ++ |
| short_description | +Product short description | ++ |
| weight | +Product weight | + Available only for Admin |
+
| news_from_date | +Date starting from which the product is promoted as a new product | + Available only for Admin |
+
| news_to_date | +Date till which the product is promoted as a new product | + Available only for Admin |
+
| status | +Product status in the store. Can have the following values: Enabled or Disabled | + Available only for Admin |
+
| url_key | +A friendly URL path for the product | + Available only for Admin |
+
| Create Permanent Redirect for Old URL | +Defines whether the redirect to an original URL will be applied (when the existing URL for a product is edited) | + Available only for Admin; available only for product update |
+
| country_of_manufacture | +Product country of manufacture | + Available only for Admin |
+
| is_returnable | +Defines whether the product can be returned | + Available only for Admin |
+
| special_price | +Product special price | + Available only for Admin |
+
| special_from_date | +Date starting from which the special price will be applied for the product | + Available only for Admin |
+
| special_to_date | +Date till which the special price will be applied for the product | + Available only for Admin |
+
| group_price | +Product group price | + Available only for Admin |
+
| tier_price | +Product tier price | ++ |
| msrp_enabled | +The Apply MAP option. Defines whether the price in the catalog in the frontend is substituted with a Click for price link | + Available only for Admin |
+
| msrp_display_actual_price_type | +Defines how the price will be displayed in the frontend. Can have the following values: In Cart, Before Order Confirmation, and On Gesture | + Available only for Admin |
+
| msrp | +The Manufacturer's Suggested Retail Price option. The price that a manufacturer suggests to sell the product at | + Available only for Admin |
+
| enable_googlecheckout | +Defines whether the product can be purchased with the help of the Google Checkout payment service. Can have the following values: Yes and No | + Available only for Admin |
+
| tax_class_id | +The product tax class to which the product will be associated | + Available only for Admin |
+
| meta_title | +Product meta title | ++ |
| meta_keyword | +Product meta keywords | ++ |
| meta_description | +Product meta description | ++ |
| custom_design | +Custom design applied for the product page | + Available only for Admin |
+
| custom_design_from | +Date starting from which the custom design will be applied for the product page | + Available only for Admin |
+
| custom_design_to | +Date till which the custom design will be applied for the product page | + Available only for Admin |
+
| custom_layout_update | +An XML block to alter the page layout | + Available only for Admin |
+
| page_layout | +Page template that can be applied to the product page | + Available only for Admin |
+
| options_container | +Defines how the custom options for the product will be displayed. Can have the following values: Block after Info Column or Product Info Column | + Available only for Admin |
+
| gift_message_available | +Defines whether the gift message is available for the product | + Available only for Admin |
+
| Use Config Settings for Allow Gift Message | +Defines whether the configuration settings will be used for the Allow Gift Message option | + Available only for Admin |
+
| gift_wrapping_available | +Defines whether the gift wrapping is available for the product | +Available only for Admin. This attribute is available in Magento EE | +
| Use Config Settings for Allow Gift Wrapping | +Defines whether the configuration settings will be used for the Allow Gift Wrapping option | + Available only for Admin. This attribute is available in Magento EE |
+
| gift_wrapping_price | +Price for the gift wrapping (available in Magento EE) | + Available only for Admin |
+
| Inventory Data | +Product inventory data | + Available only for Admin |
+
| Custom attr | +Product custom attributes | +The customer can see only attributes that are set as visible on frontend | +
| Regular Price | +The original product price displayed in the frontend | + Available only for Customer and Guest |
+
| Final Price | +The final product price | + Available only for Customer and Guest |
+
| Final Price with Tax |
+The final product price with tax | + Available only for Customer and Guest |
+
| Final Price Without Tax |
+The final product price without tax | + Available only for Customer and Guest |
+
| Stock Status |
+The product stock status (availability) | + Available only for Customer and Guest |
+
| Product Is Saleable |
+Defines whether the product can be sold | + Available only for Customer and Guest |
+
| Total Reviews Number |
+The number of all reviews for a product | + Available only for Customer and Guest |
+
| Product URL Link |
+A link to the product without the assigned category | + Available only for Customer and Guest |
+
| Buy Now Link |
+A link that adds a product to the shopping cart | + Available only for Customer and Guest |
+
| Product Has Custom Options |
+Defines whether the product has custom options or not | + Available only for Customer and Guest |
+
| Default Product Image |
+Default product image | +Available only for Customer and Guest | +
| Attribute Name | +Attribute Description | +
|---|---|
| Category ID | +ID of the category to which the product is assigned | +
| Attribute Name | +Attribute Description | +Notes | +
|---|---|---|
| Exclude | +Defines whether the image will associate only to one of the three image types. | ++ |
| ID | +Image file ID | +Available only for READ operations | +
| Label | + A label that will be displayed on the frontend when pointing to the image |
++ |
| Position | + The Sort Order option. The order in which the images are displayed in the MORE VIEWS section. |
++ |
| Type | +Image type. Can have the following values: Base Image, Small Image, or Thumbnail. | ++ |
| URL | +Image file URL path | + Available only for READ operations |
+
| File Content | +Image file content (base_64 encoded) | +Available only for WRITE operations | +
| File MIME Type | +File MIME type. Can have the following values: image/jpeg, image/png, image/gif, etc. | + Available only for WRITE operations |
+
| File Name | +Image file name | + Available only for WRITE operations |
+
After the authentication is complete successfully, the Access Token is received and will be used in every API call. This key allows identifying the client that accesses the API. With the help of this key, the following information about the user can be retrieved:
+ +There is a three-level authorization approach in Magento REST API. These three levels are as follows:
+The following graphic describes the default rights for each access level with each level obtaining more rights up to Admin who has access to everything.
+ +
+
+
+Each user type will be described below.
+Magento grants permissions for the following three types of users:
Guest
+ +Guest can be a type of application that does not require authentication. This application has access only to public resources.
+ +Customer
+ +Customer can be a registered and logged in user. This type of user can have access only to its own resources as well as to public resources.
+ +Admin
+ +Admin can be the store owner. This type has full set of permissions.
+ +Understanding of access levels is the basis of the ACL work.
+ +Every user has a specific role and purpose. To accomplish their goals, each user must be able to access certain resources and perform specific actions. Allowing users to access the resources without any limits can compromise Magento security.
+ +The Access Control List (ACL) is a set of permissions (access rights) that particular users have for certain resources. When a user wants to perform a specific action with a resource (for example, update the customer information), Magento checks the permission for this combination of user, resource, and action. If the action is allowed, the user can proceed. Otherwise, the action is denied.
+ +Access control lists include two main things: a subject and an object. Usually, the subject is the user who wants to use the resource. The object is the resource that a certain user wants to have access to. So, ACL is used to decide when the subject can have access to object.
+ +You should remember that ACL is not the same as authentication. ACL is the next step after the authentication is passed successfully. These two concepts are closely connected but the difference lies in the following: authentication is understanding who the user is and ACL is understanding what the user can do.
+ + + +ACL is implemented in a tree structure. There is a tree of resources for each user type. Namely, Admin, Customer, and Guest have their own trees of resources.
+Each ACL entry specifies two instances: a subject and an action the subject can perform.
Example of the resource tree for the Admin role is as follows:
+
All REST resource attributes are divided into two categories: Read and Write. The Read category includes the operation of retrieving. So, when selecting the attributes in the Read category, you specify them for the resource retrieving. The Write category includes the operations of creating and updating. So, when selecting the attributes in the Write category, you specify them for the resource creation and updating. To illustrate the situation, let's take the following example:
+
Setting up ACL is performed on two levels:
+ + + +REST roles in Magento are used to limit access to certain resources. Limiting access lies in configuration of a REST role and assigning a user to it. You can select which resources will be available for the user and which will not.
+ +REST roles management consists in the role creation, editing, deleting, and user assignment. Note that REST role creation and deletion is available only for Admin role.
+ +The REST Roles page initially includes two roles: Customer and Guest.
+ +Only API Resources can be edited in the Guest and Customer roles. You cannot change the name or assigned users in these roles. Also, you cannot delete the Guest or Customer role. For example, when editing the Guest Role, the page looks as follows:
+
To view the list of REST roles, perform the following steps:
+To add a new REST role for Admin, perform the following steps:
+ +To edit an existing Admin REST role, perform the following steps:
+To delete an existing Admin REST role, perform the following steps:
+To assign a REST role to admin, perform the following steps:
+To assign more than one user to an existing Admin REST role, perform the following steps:
+To view the list of users assigned to a REST role, perform the following steps:
+To unassign the Admin REST role from a user, perform the following steps:
+As it has been mentioned before, the Customer and Guest roles cannot be removed and can be only partially edited. You can edit only the resources and actions allowed for the user.
+ +To edit the Guest REST role, perform the following steps:
+To edit the Customer REST role, perform the following steps:
+If you make a Magento API call, you are guaranteed to receive some kind of a response. If you make a successful call, you will receive an HTTP response with a 200 OK status.
+ +You can view the response data from any Magento API call in one of the following two formats:
+ +The format of returned data is defined in the request header. The format you choose depends on what you are familiar with most or tools available to you.
+ + +The XML response format is a simple XML block.
+To set the response format to XML, add the Accept request header with the text/xml value.
A successful call will return the following response (example of retrieving information about stock items):
+ +<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>1</item_id> + <product_id>1</product_id> + <stock_id>1</stock_id> + <qty>99.0000</qty> + <low_stock_date></low_stock_date> + </data_item> + <data_item> + <item_id>2</item_id> + <product_id>2</product_id> + <stock_id>1</stock_id> + <qty>100.0000</qty> + <low_stock_date></low_stock_date> + </data_item> +</magento_api>+
If an error occurs, the call may return the following response:
+ +<?xml version="1.0"?> +<magento_api> + <messages> + <error> + <data_item> + <code>404</code> + <message>Resource not found.</message> + </data_item> + </error> + </messages> +</magento_api>+
JSON (JavaScript Object Notation) is a lightweight data-interchange format.
+To set the response format to JSON, add the Accept request header with the application/json value.
The JSON objects represent a direct mapping of the XML block from the XML response format.
+ +A simple XML error
+ +<messages> + <error> + <data_item> + <code>404</code> + <message>Resource not found.</message> + </data_item> + </error> + </messages>+
will be transformed to
+ +{"messages":{"error":[{"code":404,"message":"Resource not found."}]}}
+ A successful API call to the Stock Items resource will return the following XML response:
+<?xml version="1.0"?> +<magento_api> + <data_item> + <item_id>1</item_id> + <product_id>1</product_id> + <stock_id>1</stock_id> + <qty>99.0000</qty> + <low_stock_date></low_stock_date> + </data_item> + <data_item> + <item_id>2</item_id> + <product_id>2</product_id> + <stock_id>1</stock_id> + <qty>100.0000</qty> + <low_stock_date></low_stock_date> + </data_item> +</magento_api>+
The JSON equivalent will be as follows:
+[{"item_id":"1","product_id":"1","stock_id":"1","qty":"99.0000","low_stock_date":null},{"item_id":"2","product_id":"2","stock_id":"1","qty":"100.0000","low_stock_date":null}]
+ The list of HTTP status codes that are returned in the API response is described in the Common HTTP Status Codes part of the documentation. There, you can find the list of codes themselves together with their description.
+ + + diff --git a/guides/v19.x/api/rest/testing_rest_resources.html b/guides/v19.x/api/rest/testing_rest_resources.html new file mode 100644 index 0000000000..c25eab7f4a --- /dev/null +++ b/guides/v19.x/api/rest/testing_rest_resources.html @@ -0,0 +1,170 @@ +--- +layout: v1x_rest +title: Testing REST Resources +--- + +Three steps are required for utilizing REST API resources:
+The following headers are required for the call:
+The following parameters must be provided in the Authorization header for the call:
+
+
+ An authorization header is created on the main page of REST Client.
+
+
+ 

Example: Retrieving the List of Products
+ +



+ Example: Retrieving the list of customers
+ +
Example: Creating a customer address
+ +
Welcome to the Magento 1.x SOAP API home page.
+ +The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage categories and how products are assigned to categories.
+ +Resource Name: catalog_category
+ +Aliases:
+Methods:
+Allows you to retrieve the list of category attributes and options.
+ +Resource Name: catalog_category_attribute
+ +Aliases:
+Methods:
+Allows you to manage products.
+ +Resource Name: catalog_product
+ +Aliases:
+Methods:
+Allows you to retrieve product attributes and options.
+ +Resource Name: catalog_product_attribute
+ +Aliases:
+Methods:
+Allows you to retrieve product attribute sets.
+ +Resource Name: catalog_product_attribute_set
+ +Aliases:
+Methods:
+Allows you to retrieve product types.
+ +Resource Name: catalog_product_type
+ +Aliases:
+Methods:
+Allows you to manage product images.
+ +Resource Name: catalog_product_attribute_media
+ +Aliases:
+Methods:
+Allows you to retrieve and update product tier prices.
+ +Resource Name: catalog_product_attribute_tier_price
+ +Aliases:
+Methods:
+Allows you to manage links for products, including related, cross-sells, up-sells, and grouped.
+ +Resource Name: catalog_product_link
+ +Aliases:
+Methods:
+Allows you to add, remove, and retrieve a link to a downloadable product.
+ +Resource Name: product_downloadable_link
+ + +Allows you to add, update, remove, and retrieve product tags.
+ +Resource Name: catalog_product_tag
+ +Aliases:
+Allows you to manage product custom options, including adding, updating, removing, and retrieving information.
+ +Resource Name: catalog_product_custom_option
+ +Aliases:
+Allows you to manage product custom option values, including adding, updating, removing, and retrieving information.
+ +Resource Name: catalog_product_custom_option_value
+ +Aliases:
+The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage categories and how products are assigned to categories.
+ +Resource Name: catalog_category
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Requested website not found. | +
| 102 | +Category not exists. | +
| 103 | +Invalid data given. Details in error message. | +
| 104 | +Category not moved. Details in error message. | +
| 105 | +Category not deleted. Details in error message. | +
| 106 | +Requested product is not assigned to category. | +
function getSomeRandomCategory(&$categories, $targetLevel, $currentLevel = 0) {
+ if (count($categories)==0) {
+ return false;
+ }
+ if ($targetLevel == $currentLevel) {
+ return $categories[array_rand($categories)];
+ } else {
+ return getSomeRandomCategory($categories[array_rand($categories)]['children'], $targetLevel + 1);
+ }
+}
+
+$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$allCategories = $proxy->call($sessionId, 'category.tree'); // Get all categories.
+
+// select random category from tree
+while (($selectedCategory = getSomeRandomCategory($allCategories, 3)) === false) {}
+
+// create new category
+$newCategoryId = $proxy->call(
+ $sessionId,
+ 'category.create',
+ array(
+ $selectedCategory['category_id'],
+ array(
+ 'name'=>'Newopenerp',
+ 'is_active'=>1,
+ 'include_in_menu'=>2,
+ 'available_sort_by'=>'position',
+ 'default_sort_by'=>'position'
+ )
+ )
+);
+
+$newData = array('is_active'=>1);
+// update created category on German store view
+$proxy->call($sessionId, 'category.update', array($newCategoryId, $newData, 'german'));
+
+$firstLevel = $proxy->call($sessionId, 'category.level', array(null, 'german', $selectedCategory['category_id']));
+
+var_dump($firstLevel);
+
+// If you wish remove category, uncomment next line
+//$proxy->call($sessionId, 'category.delete', $newCategoryId);
+ $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$categoryId = 5; // Put here your category id
+$storeId = 1; // You can add store level
+
+$assignedProducts = $proxy->call($sessionId, 'category.assignedProducts', array($categoryId, $storeId));
+var_dump($assignedProducts); // Will output assigned products.
+
+// Assign product
+$proxy->call($sessionId, 'category.assignProduct', array($categoryId, 'someProductSku', 5));
+
+// Update product assignment position
+$proxy->call($sessionId, 'category.updateProduct', array($categoryId, 'someProductSku', 25));
+
+// Remove product assignment
+$proxy->call($sessionId, 'category.removeProduct', array($categoryId, 'someProductSku'));
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Assign a product to the required category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category | +
| string | +product/productId | +ID or SKU of the product to be assigned to the category | +
| string | +position | +Position of the assigned product in the category (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' argument | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is assigned to the specified category | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.assignProduct', array('categoryId' => '4', 'product' => '1'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAssignProduct($sessionId, '4', '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryAssignProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '5', 'productId' => '1', 'position' => '5'));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Retrieve the list of products assigned to a required category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the required category | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAssignedProduct | +
The catalogAssignedProduct content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +product_id | +ID of the assigned product | +
| string | +type | +Product type | +
| int | +set | +Attribute set ID | +
| string | +sku | +Product SKU | +
| int | +position | +Position of the assigned product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.assignedProducts', '4');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAssignedProducts($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryAssignedProducts((object)array('sessionId' => $sessionId->result, 'categoryId' => '4'));
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '1' (length=1) + 'type' => string 'simple' (length=6) + 'set' => string '4' (length=1) + 'sku' => string 'n2610' (length=5) + 'position' => string '1' (length=1) + 1 => + array + 'product_id' => string '2' (length=1) + 'type' => string 'simple' (length=6) + 'set' => string '4' (length=1) + 'sku' => string 'b8100' (length=5) + 'position' => string '1' (length=1)+
The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Create a new category and return its ID.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +parentId | +Parent category ID | +
| array | +categoryData | +Array of catalogCategoryEntityCreate | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + attribute_id |
+ID of the created category | +
The categoryData content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +name | +Name of the created category | +
| int | +is_active | +Defines whether the category will be visible in the frontend | +
| int | +position | +Position of the created category (optional) | +
| ArrayOfString | +available_sort_by | +All available options by which products in the category can be sorted | +
| string | +custom_design | +The custom design for the category (optional) | +
| int | + custom_apply_to_products |
+Apply the custom design to all products assigned to the category (optional) | +
| string | +custom_design_from | +Date starting from which the custom design will be applied to the category (optional) | +
| string | +custom_design_to | +Date till which the custom design will be applied to the category (optional) | +
| string | +custom_layout_update | +Custom layout update (optional) | +
| string | +default_sort_by | +The default option by which products in the category are sorted | +
| string | +description | +Category description (optional) | +
| string | +display_mode | +Content that will be displayed on the category view page (optional) | +
| int | +is_anchor | +Defines whether the category will be anchored (optional) | +
| int | +landing_page | +Landing page (optional) | +
| string | +meta_description | +Category meta description (optional) | +
| string | +meta_keywords | +Category meta keywords (optional) | +
| string | +meta_title | +Category meta title (optional) | +
| string | +page_layout | +Type of page layout that the category should use (optional) | +
| string | +url_key | +A relative URL path which can be entered in place of the standard target path (optional) | +
| int | +include_in_menu | +Defines whether the category is visible on the top menu bar | +
| string | +filter_price_range | + Price range of each price level displayed in the layered navigation block (optional) |
+
| int | + custom_use_parent_settings |
+ Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No (optional) |
+
Notes: The position parameter is deprecated, the category will be positioned anyway in the end of the list and you can not set the position directly. You should use the catalog_category.move method instead. You cannot also assign a root category to the specified store.
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session, 'catalog_category.create', array(2, array(
+ 'name' => 'Category name',
+ 'is_active' => 1,
+ 'position' => 1,
+ //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
+ //and you can not set position directly, use catalog_category.move instead -->
+ 'available_sort_by' => 'position',
+ 'custom_design' => null,
+ 'custom_apply_to_products' => null,
+ 'custom_design_from' => null,
+ 'custom_design_to' => null,
+ 'custom_layout_update' => null,
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'display_mode' => null,
+ 'is_anchor' => 0,
+ 'landing_page' => null,
+ 'meta_description' => 'Category meta description',
+ 'meta_keywords' => 'Category meta keywords',
+ 'meta_title' => 'Category meta title',
+ 'page_layout' => 'two_columns_left',
+ 'url_key' => 'url-key',
+ 'include_in_menu' => 1,
+)));
+
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->catalogCategoryCreate($session, 2, array(
+ 'name' => 'Category name 2',
+ 'is_active' => 1,
+ 'position' => 1,
+ //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
+ //and you can not set position directly, use catalog_category.move instead -->
+ 'available_sort_by' => array('position'),
+ 'custom_design' => null,
+ 'custom_apply_to_products' => null,
+ 'custom_design_from' => null,
+ 'custom_design_to' => null,
+ 'custom_layout_update' => null,
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'display_mode' => null,
+ 'is_anchor' => 0,
+ 'landing_page' => null,
+ 'meta_description' => 'Category meta description',
+ 'meta_keywords' => 'Category meta keywords',
+ 'meta_title' => 'Category meta title',
+ 'page_layout' => 'two_columns_left',
+ 'url_key' => 'url-key',
+ 'include_in_menu' => 1,
+));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryCreate((object)array('sessionId' => $sessionId->result, 'parentId' => '5', 'categoryData' => ((object)array(
+ 'name' => 'category',
+ 'is_active' => '1',
+ 'position' => '1',
+ 'available_sort_by' => array('position'),
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'is_anchor' => '1',
+ 'include_in_menu' => '1'
+))));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeView | +Store view ID or code | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'category.currentStore', '1');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryCurrentStore($sessionId, '1');
+var_dump($result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to delete the required category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category to be deleted | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the category is deleted | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.delete', '7');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryDelete($sessionId, '7');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryDelete((object)array('sessionId' => $sessionId->result, 'categoryId' => '7'));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to retrieve information about the required category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +Category ID | +
| string | +storeView | +Store view ID or code (optional) | +
| ArrayOfString | +attributes | +Array of attributes (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +info | +Array of catalogCategoryInfo | +
The catalogCategoryInfo content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + category_id |
+Category ID | +
| int | + is_active |
+Defines whether the category is active | +
| string |
+ position |
+Category position | +
| string |
+ level |
+Category level | +
| string |
+ parent_id |
+Parent category ID | +
| string |
+ all_children |
+All child categories of the current category | +
| string |
+ children |
+Names of direct child categories | +
| string |
+ created_at |
+Date when the category was created | +
| string |
+ updated_at |
+Date when the category was updated | +
| string |
+ name |
+Category name | +
| string |
+ url_key |
+ A relative URL path which can be entered in place of the standard target path (optional) |
+
| string |
+ description |
+Category description | +
| string |
+ meta_title |
+Category meta title | +
| string |
+ meta_keywords |
+Category meta keywords | +
| string |
+ meta_description |
+Category meta description | +
| string |
+ path |
+Path | +
| string |
+ url_path |
+URL path | +
| int | + children_count |
+Number of child categories | +
| string |
+ display_mode |
+ Content that will be displayed on the category view page (optional) |
+
| int | + is_anchor |
+Defines whether the category is anchored | +
| ArrayOfString | + available_sort_by |
+ All available options by which products in the category can be sorted |
+
| string |
+ custom_design |
+ The custom design for the category (optional) |
+
| string |
+ custom_apply_to_products |
+ Apply the custom design to all products assigned to the category (optional) |
+
| string |
+ custom_design_from |
+ Date starting from which the custom design will be applied to the category (optional) |
+
| string |
+ custom_design_to |
+ Date till which the custom design will be applied to the category (optional) |
+
| string |
+ page_layout |
+ Type of page layout that the category should use (optional) |
+
| string |
+ custom_layout_update |
+ Custom layout update (optional) |
+
| string |
+ default_sort_by |
+ The default option by which products in the category are sorted |
+
| int | + landing_page |
+ Landing page (optional) |
+
| int | + include_in_menu |
+ Defines whether the category is available on the Magento top menu bar |
+
| string | + filter_price_range |
+ Price range of each price level displayed in the layered navigation block |
+
| int | + custom_use_parent_settings |
+ Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No |
+
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.info', '5');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryInfo($sessionId, '5');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryInfo((object)array('sessionId' => $sessionId->result, 'categoryId' => '5'));
+var_dump($result->result);
+ array + 'category_id' => string '5' (length=1) + 'is_active' => string '1' (length=1) + 'position' => string '1' (length=1) + 'level' => string '2' (length=1) + 'parent_id' => int 3 + 'increment_id' => null + 'created_at' => string '2012-03-29 12:30:51' (length=19) + 'updated_at' => string '2012-03-29 14:25:08' (length=19) + 'name' => string 'Mobile Phones' (length=13) + 'url_key' => string 'mobile-phones' (length=13) + 'thumbnail' => null + 'description' => string 'Category for cell phones' (length=24) + 'image' => null + 'meta_title' => string 'Cell Phones' (length=11) + 'meta_keywords' => string 'cell, phone' (length=11) + 'meta_description' => null + 'include_in_menu' => string '1' (length=1) + 'path' => string '1/3/4' (length=5) + 'all_children' => string '4' (length=1) + 'path_in_store' => null + 'children' => string '' (length=0) + 'url_path' => string 'mobile-phones.html' (length=18) + 'children_count' => string '0' (length=1) + 'display_mode' => string 'PRODUCTS' (length=8) + 'landing_page' => null + 'is_anchor' => string '1' (length=1) + 'available_sort_by' => null + 'default_sort_by' => null + 'filter_price_range' => null + 'custom_use_parent_settings' => string '1' (length=1) + 'custom_apply_to_products' => null + 'custom_design' => null + 'custom_design_from' => null + 'custom_design_to' => null + 'page_layout' => null + 'custom_layout_update' => null+
The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to retrieve one level of categories by a website, a store view, or a parent category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +website | +Website ID or code (optional) | +
| string | +storeView | +Store view ID or code (optional) | +
| string | +parentCategory | +Parent category ID (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +tree | +Array of CatalogCategoryEntitiesNoChildren | +
The CatalogCategoryEntitityNoChildren content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + category_id |
+Category ID | +
| int | + parent_id |
+Parent category ID | +
| string | + name |
+Category name | +
| int | + is_active |
+Defines whether the category is active | +
| int | + position |
+Category position | +
| int | + level |
+Category level | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.level');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryLevel($sessionId);
+var_dump($result);
+ array + 0 => + array + 'category_id' => string '2' (length=1) + 'parent_id' => int 1 + 'name' => string 'Default Category' (length=16) + 'is_active' => string '1' (length=1) + 'position' => string '1' (length=1) + 'level' => string '1' (length=1) + 1 => + array + 'category_id' => string '3' (length=1) + 'parent_id' => int 1 + 'name' => string 'root_category' (length=13) + 'is_active' => string '1' (length=1) + 'position' => string '2' (length=1) + 'level' => string '1' (length=1)+
The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to move the required category in the category tree.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category to be moved | +
| int | +parentId | +ID of the new parent category | +
| string | +afterId | +ID of the category after which the required category will be moved (optional for V1 and V2) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +id | +True if the category is moved | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.move', array('categoryId' => '4', 'parentId' => '3'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryMove($sessionId, '4', '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryMove((object)array('sessionId' => $sessionId->result, 'categoryId' => '19', 'parentId' => '8', 'afterId' => '4'));
+var_dump($result->result);
+ Note: Please make sure that you are not moving the category to any of its own children. There are no extra checks to prevent doing it through API, and you won’t be able to fix this from the admin interface later.
+ + + diff --git a/guides/v19.x/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html b/guides/v19.x/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html new file mode 100644 index 0000000000..851886603f --- /dev/null +++ b/guides/v19.x/api/soap/catalog/catalogCategory/catalog_category.removeProduct.html @@ -0,0 +1,129 @@ +--- +layout: v1x_soap +title: Remove Product +--- + + + +The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to remove the product assignment from the category.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +Category ID | +
| string | +productId | +ID or SKU of the product to be removed from the category | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is removed from the category | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.removeProduct', array('categoryId' => '4', 'product' => '3'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryRemoveProduct($sessionId, '4', '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryRemoveProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '4', 'productId' => '3'));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to retrieve the hierarchical tree of categories.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +parentId | +ID of the parent category (optional) | +
| string | +storeView | +Store view (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +tree | +Array of catalogCategoryTree | +
The catalogCategoryTree content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +category_id | +Category ID | +
| int | + parent_id |
+Parent category ID | +
| string | + name |
+Category name | +
| int | + position |
+Category position | +
| int | + level |
+Category level | +
| array | + children |
+Array of CatalogCategoryEntities | +
The catalogCategoryEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + category_id |
+Category ID | +
| int | + parent_id |
+Parent category ID | +
| string | + name |
+Category name | +
| int | + is_active |
+defines whether the category is active | +
| int | + position |
+Category position | +
| int | + level |
+Category level | +
| array | + children |
+Array of CatalogCategoryEntities | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.tree');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryTree($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryTree((object)array('sessionId' => $sessionId->result, 'parentId' => '15'));
+var_dump($result->result);
+ array + 'category_id' => string '1' (length=1) + 'parent_id' => string '0' (length=1) + 'name' => string 'Root Catalog' (length=12) + 'is_active' => null + 'position' => string '0' (length=1) + 'level' => string '0' (length=1) + 'children' => + array + 0 => + array + 'category_id' => string '2' (length=1) + 'parent_id' => string '1' (length=1) + 'name' => string 'Default Category' (length=16) + 'is_active' => string '1' (length=1) + 'position' => string '1' (length=1) + 'level' => string '1' (length=1) + 'children' => + array + ... + 1 => + array + 'category_id' => string '3' (length=1) + 'parent_id' => string '1' (length=1) + 'name' => string 'root_category' (length=13) + 'is_active' => string '1' (length=1) + 'position' => string '2' (length=1) + 'level' => string '1' (length=1) + 'children' => + array + ...+
The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Update the required category. Note that you should specify only those parameters which you want to be updated.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category to be updated | +
| array | +categoryData | +An array of catalogCategoryEntityCreate | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the category is updated | +
The catalogCategoryEntityCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +name | + Name of the category to be updated |
+
| int | +is_active | + Defines whether the category is visible in the frontend |
+
| int | +position | + Position of the category to be updated |
+
| arrayOfString |
+ available_sort_by |
+ All available options by which products in the category can be sorted |
+
| string |
+ custom_design |
+ The custom design for the category |
+
| int |
+ custom_apply_to_products |
+ Apply the custom design to all products assigned to the category |
+
| string |
+ custom_design_from |
+ Date starting from which the custom design will be applied to the category |
+
| string |
+ custom_design_to |
+ Date till which the custom design will be applied to the category |
+
| string |
+ custom_layout_update |
+ Custom layout update |
+
| string |
+ default_sort_by |
+ The default option by which products in the category are sorted |
+
| string |
+ description |
+ Category description |
+
| string |
+ display_mode |
+ Content that will be displayed on the category view page |
+
| int |
+ is_anchor |
+ Defines whether the category will be anchored |
+
| int |
+ landing_page |
+ Landing page |
+
| string |
+ meta_description |
+ Category meta description |
+
| string |
+ meta_keywords |
+ Category meta keywords |
+
| string |
+ meta_title |
+ Category meta title |
+
| string |
+ page_layout |
+ Type of page layout that the category should use |
+
| string |
+ url_key |
+ A relative URL path which can be entered in place of the standard target path |
+
| int |
+ include_in_menu |
+ Defines whether the category is visible on the top menu bar in the frontend |
+
| string | + filter_price_range |
+ Price range of each price level displayed in the layered navigation block |
+
| int | + custom_use_parent_settings |
+ Defines whether the category will inherit custom design settings of the category to which it is assigned. 1 - Yes, 0 - No |
+
Faults:
+No Faults
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session, 'catalog_category.update', array(23, array(
+ 'name' => 'Category name',
+ 'is_active' => 1,
+ 'position' => 1,
+ //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
+ //and you can not set position directly, use catalog_category.move instead -->
+ 'available_sort_by' => 'position',
+ 'custom_design' => null,
+ 'custom_apply_to_products' => null,
+ 'custom_design_from' => null,
+ 'custom_design_to' => null,
+ 'custom_layout_update' => null,
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'display_mode' => null,
+ 'is_anchor' => 0,
+ 'landing_page' => null,
+ 'meta_description' => 'Category meta description',
+ 'meta_keywords' => 'Category meta keywords',
+ 'meta_title' => 'Category meta title',
+ 'page_layout' => 'two_columns_left',
+ 'url_key' => 'url-key',
+ 'include_in_menu' => 1,
+)));
+
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->catalogCategoryUpdate($session, 23, array(
+ 'name' => 'Category name 2',
+ 'is_active' => 1,
+ 'position' => 1,
+ //<!-- position parameter is deprecated, category anyway will be positioned in the end of list
+ //and you can not set position directly, use catalog_category.move instead -->
+ 'available_sort_by' => array('position'),
+ 'custom_design' => null,
+ 'custom_apply_to_products' => null,
+ 'custom_design_from' => null,
+ 'custom_design_to' => null,
+ 'custom_layout_update' => null,
+ 'default_sort_by' => 'position',
+ 'description' => 'Category description',
+ 'display_mode' => null,
+ 'is_anchor' => 0,
+ 'landing_page' => null,
+ 'meta_description' => 'Category meta description',
+ 'meta_keywords' => 'Category meta keywords',
+ 'meta_title' => 'Category meta title',
+ 'page_layout' => 'two_columns_left',
+ 'url_key' => 'url-key',
+ 'include_in_menu' => 1,
+));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryUpdate((object)array('sessionId' => $sessionId->result, 'categoryId' => '23', 'categoryData' => ((object)array(
+ 'name' => 'Category Name Updated',
+ 'is_active' => '1',
+ 'position' => '1',
+ 'available_sort_by' => array('name'),
+ 'default_sort_by' => 'name',
+ 'description' => 'Category description',
+ 'is_anchor' => '1',
+ 'include_in_menu' => '1'
+))));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Aliases:
+Allows you to update the product assigned to a category. The product position is updated.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +categoryId | +ID of the category to which the product is assigned | +
| string | +productId | +ID or SKU of the product to be updated | +
| string | +position | +Position of the product in the category (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is updated in the category | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category.updateProduct', array('categoryId' => '4', 'product' => '1', 'position' => '3'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryUpdateProduct($sessionId, '4', '1', '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogCategoryUpdateProduct((object)array('sessionId' => $sessionId->result, 'categoryId' => '4', 'productId' => '1', 'position' => '3'));
+var_dump($result->result);
+ Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeView | +Store view ID or code | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category_attribute.currentStore', 'english');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAttributeCurrentStore($sessionId, 'english');
+var_dump($result);
+ Aliases:
+Allows you to retrieve the list of category attributes.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeEntity | +
The catalogAttributeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + attribute_id |
+Attribute ID | +
| string | + code |
+Attribute code | +
| string |
+ type |
+Attribute type | +
| string |
+ required |
+Defines whether the attribute is required | +
| string |
+ scope |
+Attribute scope: global, website, or store | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category_attribute.list',);
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAttributeList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $client->catalogCategoryAttributeList((object)array('sessionId' => $session->result));
+
+var_dump ($result);
+ array + 0 => + array + 'attribute_id' => null + 'code' => string 'parent_id' (length=9) + 'type' => null + 'required' => null + 'scope' => string 'global' (length=6) + 1 => + array + 'attribute_id' => null + 'code' => string 'increment_id' (length=12) + 'type' => null + 'required' => null + 'scope' => string 'global' (length=6) + 2 => + array + 'attribute_id' => null + 'code' => string 'updated_at' (length=10) + 'type' => null + 'required' => null + 'scope' => string 'global' (length=6)+
Aliases:
+Allows you to retrieve the attribute options.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +attributeId | +Attribute ID or code | +
| string | +storeView | +Store view ID or code | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeOptionEntity | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Option label | +
| string | +value | +Option value | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_category_attribute.options', '65');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogCategoryAttributeOptions($sessionId, '65');
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $client->catalogCategoryAttributeOptions((object)array('sessionId' => $session->result, 'attributeId' => '65'));
+
+var_dump ($result);
+ array + 0 => + array + 'label' => string 'Yes' (length=3) + 'value' => int 1 + 1 => + array + 'label' => string 'No' (length=2) + 'value' => int 0+
The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve the list of category attributes and options.
+ +Resource Name: catalog_category_attribute
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Requested attribute not found. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$attributes = $proxy->call($sessionId, 'category_attribute.list');
+foreach ($attributes as &$attribute) {
+ if (isset($attribute['type'])
+ && ($attribute['type'] == 'select' || $attribute['type'] == 'multiselect')) {
+ $attribute['options'] = $proxy->call($sessionId, 'category_attribute.options', $attribute['code']);
+ }
+}
+var_dump($attributes);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage products.
+ +Resource Name: catalog_product
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Product not exists. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Product not deleted. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$filters = array(
+ 'sku' => array('like'=>'zol%')
+);
+
+$products = $proxy->call($sessionId, 'product.list', array($filters));
+
+var_dump($products);
+ $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeSets = $proxy->call($sessionId, 'product_attribute_set.list');
+$set = current($attributeSets);
+
+
+$newProductData = array(
+ 'name' => 'name of product',
+ // websites - Array of website ids to which you want to assign a new product
+ 'websites' => array(1), // array(1,2,3,...)
+ 'short_description' => 'short description',
+ 'description' => 'description',
+ 'status' => 1,
+ 'weight' => 0,
+ 'tax_class_id' => 1,
+ 'categories' => array(3), //3 is the category id
+ 'price' => 12.05
+);
+
+// Create new product
+$proxy->call($sessionId, 'product.create', array('simple', $set['set_id'], 'sku_of_product', $newProductData));
+$proxy->call($sessionId, 'product_stock.update', array('sku_of_product', array('qty'=>50, 'is_in_stock'=>1)));
+
+// Get info of created product
+var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
+
+// Update product name on german store view
+$proxy->call($sessionId, 'product.update', array('sku_of_product', array('name'=>'new name of product'), 'german'));
+
+// Get info for default values
+var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
+// Get info for german store view
+
+var_dump($proxy->call($sessionId, 'product.info', array('sku_of_product', 'german')));
+
+// Delete product
+$proxy->call($sessionId, 'product.delete', 'sku_of_product');
+
+try {
+ // Ensure that product deleted
+ var_dump($proxy->call($sessionId, 'product.info', 'sku_of_product'));
+} catch (SoapFault $e) {
+ echo "Product already deleted";
+}
+ Aliases:
+Allows you to create a new product and return ID of the created product.
+ +Aliases:
+Note:
+Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ type |
+Product type | +
| string |
+ set |
+ID of the product attribute set | +
| string |
+ sku |
+Product SKU | +
| array | + productData |
+Array of catalogProductCreateEntity | +
| string | +storeView | +Store view ID or code | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created product | +
The catalogProductCreateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString | + categories |
+Array of categories | +
| ArrayOfString |
+ websites |
+Array of websites | +
| string | + name |
+Product name | +
| string |
+ description |
+Product description | +
| string |
+ short_description |
+Product short description | +
| string |
+ weight |
+Product weight | +
| string |
+ status |
+Product status | +
| string |
+ url_key |
+URL key | +
| string |
+ url_path |
+URL path | +
| string |
+ visibility |
+Product visibility on the frontend | +
| ArrayOfString |
+ category_ids |
+Array of category IDs | +
| ArrayOfString |
+ website_ids |
+Array of website IDs | +
| string |
+ has_options |
+Defines whether the product has options | +
| string |
+ gift_message_available |
+Defines whether the gift message is available for the product | +
| string |
+ price |
+Product price | +
| string |
+ special_price |
+Product special price | +
| string |
+ special_from_date |
+Date starting from which the special price will be applied to the product | +
| string |
+ special_to_date |
+Date till which the special price will be applied to the product | +
| string |
+ tax_class_id |
+Tax class ID | +
| array | + tier_price |
+Array of catalogProductTierPriceEntity | +
| string |
+ meta_title |
+Meta title | +
| string |
+ meta_keyword |
+Meta keyword | +
| string |
+ meta_description |
+Meta description | +
| string |
+ custom_design |
+Custom design | +
| string |
+ custom_layout_update |
+Custom layout update | +
| string |
+ options_container |
+Options container | +
| array |
+ additional_attributes |
+Array of catalogProductAdditionalAttributesEntity | +
| array | + stock_data |
+ Array of catalogInventoryStockItemUpdateEntity |
+
Notes: The "websites" and "website_ids" or "categories" and "category_ids" parameters are interchangeable. In other words, you can specify an array of website IDs (int) and then you don't need to specify the array of website codes (string) and vice versa.
+ +The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+Customer group ID | +
| string | + website |
+Website | +
| int | + qty |
+Quantity | +
| double | + price |
+Tier price | +
The catalogInventoryStockItemUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + qty |
+Quantity of items | +
| int | + is_in_stock |
+Defines whether the item is in stock | +
| int |
+ manage_stock |
+Manage stock | +
| int |
+ use_config_manage_stock |
+Use config manage stock | +
| int |
+ min_qty |
+Minimum quantity for items to be in stock | +
| int |
+ use_config_min_qty |
+Use config settings flag (value defined in the Inventory System Configuration) | +
| int |
+ min_sale_qty |
+Minimum quantity allowed in the shopping cart | +
| int |
+ use_config_min_sale_qty |
+Use config settings flag | +
| int |
+ max_sale_qty |
+Maximum quantity allowed in the shopping cart | +
| int |
+ use_config_max_sale_qty |
+Use config settings flag | +
| int |
+ is_qty_decimal |
+Defines whether the quantity is decimal | +
| int |
+ backorders |
+Backorders status | +
| int |
+ use_config_backorders |
+Use config settings flag (for backorders) | +
| int |
+ notify_stock_qty |
+Stock quantity below which a notification will appear | +
| int |
+ use_config_notify_stock_qty |
+Use config settings flag (for stock quantity) | +
The catalogProductAdditionalAttributesEntity content is as follows:
+ + +| Type | +Name | +
|---|---|
| associativeMultiArray | +multi_data | +
| associativeArray | +single_data | +
Single Data: array of attributes with only single value
+Multi Data: array of attributes which could contain several values
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 102 | +Invalid data given. Details in error message. | +
| 104 | +Product type is not in allowed types. | +
| 105 | +Product attribute set is not existed | +
| 106 | +Product attribute set is not belong catalog product entity type | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+// get attribute set
+$attributeSets = $client->call($session, 'product_attribute_set.list');
+$attributeSet = current($attributeSets);
+
+
+$result = $client->call($session, 'catalog_product.create', array('simple', $attributeSet['set_id'], 'product_sku', array(
+ 'categories' => array(2),
+ 'websites' => array(1),
+ 'name' => 'Product name',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'url_key' => 'product-url-key',
+ 'url_path' => 'product-url-path',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+ 'meta_title' => 'Product meta title',
+ 'meta_keyword' => 'Product meta keyword',
+ 'meta_description' => 'Product meta description'
+)));
+
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+// get attribute set
+$attributeSets = $client->catalogProductAttributeSetList($session);
+$attributeSet = current($attributeSets);
+
+$result = $client->catalogProductCreate($session, 'simple', $attributeSet->set_id, 'product_sku', array(
+ 'categories' => array(2),
+ 'websites' => array(1),
+ 'name' => 'Product name',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'url_key' => 'product-url-key',
+ 'url_path' => 'product-url-path',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+ 'meta_title' => 'Product meta title',
+ 'meta_keyword' => 'Product meta keyword',
+ 'meta_description' => 'Product meta description'
+));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCreate((object)array('sessionId' => $sessionId->result, 'type' => 'simple', 'set' => '4', 'sku' => 'simple_sku',
+'productData' => ((object)array(
+ 'name' => 'Product name',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+))));
+
+var_dump($result->result);
+ Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int/string | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.currentStore', 'english');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCurrentStore($sessionId, 'english');
+var_dump($result);
+ Aliases:
+Allows you to delete the required product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + product\productId |
+Product ID or SKU | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean/int | +result | +True (1) if the product is deleted | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.delete', '6');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductDelete($sessionId, '6');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDelete((object)array('sessionId' => $sessionId->result, 'productId' => '21'));
+var_dump($result->result);
+ Aliases:
+Allows you to get the product special price data.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ storeView |
+Store view ID or code | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductReturnEntity | +
The catalogProductReturnEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ special_price |
+Product special price | +
| string |
+ special_from_date |
+Date starting from which the special price is applied to the product | +
| string |
+ special_to_date |
+Date till which the special price is applied to the product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.getSpecialPrice', '1');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductGetSpecialPrice($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductGetSpecialPrice((object)array('sessionId' => $sessionId->result, 'productId' => '1'));
+var_dump($result->result);
+ array + 'special_price' => string '139.9900' (length=8) + 'special_from_date' => string '2012-03-28 00:00:00' (length=19) + 'special_to_date' => string '2012-03-31 00:00:00' (length=19)+
Aliases:
+Allows you to retrieve information about the required product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | + Description |
+
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +productId | +Product ID or SKU | +
| string | +storeView | +Store view ID or code (optional) | +
| array | +attributes | +Array of catalogProductRequestAttributes (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU value is passed in the "productId" parameter. (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +info | +Array of catalogProductReturnEntity | +
The catalogProductRequestAttributes content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString |
+ attributes |
+Array of attributes | +
| ArrayOfString |
+ additional_attributes |
+Array of additional attributes | +
The catalogProductReturnEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ sku |
+Product SKU | +
| string |
+ set |
+Product set | +
| string |
+ type |
+Product type | +
| ArrayOfString | + categories |
+Array of categories | +
| ArrayOfString | + websites |
+Array of websites | +
| string |
+ created_at |
+Date when the product was created | +
| string |
+ updated_at |
+Date when the product was last updated | +
| string |
+ type_id |
+Type ID | +
| string |
+ name |
+Product name | +
| string |
+ description |
+Product description | +
| string |
+ short_description |
+Short description for a product | +
| string |
+ weight |
+Product weight | +
| string |
+ status |
+Status of a product | +
| string |
+ url_key |
+Relative URL path that can be entered in place of a target path | +
| string |
+ url_path |
+URL path | +
| string |
+ visibility |
+Product visibility on the frontend | +
| ArrayOfString |
+ category_ids |
+Array of category IDs | +
| ArrayOfString |
+ website_ids |
+Array of website IDs | +
| string |
+ has_options |
+Defines whether the product has options | +
| string |
+ gift_message_available |
+Defines whether the gift message is available for the product | +
| string |
+ price |
+Product price | +
| string |
+ special_price |
+Product special price | +
| string |
+ special_from_date |
+Date starting from which the special price is applied to the product | +
| string |
+ special_to_date |
+Date till which the special price is applied to the product | +
| string |
+ tax_class_id |
+Tax class ID | +
| array | + tier_price |
+Array of catalogProductTierPriceEntity | +
| string |
+ meta_title |
+Mate title | +
| string |
+ meta_keyword |
+Meta keyword | +
| string |
+ meta_description |
+Meta description | +
| string |
+ custom_design |
+Custom design | +
| string |
+ custom_layout_update |
+Custom layout update | +
| string |
+ options_container |
+Options container | +
| associativeArray | + additional_attributes |
+Array of additional attributes | +
| string |
+ enable_googlecheckout |
+Defines whether Google Checkout is applied to the product | +
The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+ID of the customer group | +
| string | + website |
+Website | +
| int | + qty |
+Quantity to which the price will be applied | +
| double | + price |
+Price that each item will cost | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.info', '4');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductInfo($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductInfo((object)array('sessionId' => $sessionId->result, 'productId' => '4'));
+var_dump($result->result);
+ array + 'product_id' => string '4' (length=1) + 'sku' => string 'canon_powershot' (length=15) + 'set' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'categories' => + array + 0 => string '3' (length=1) + 1 => string '5' (length=1) + 'websites' => + array + 0 => string '2' (length=1) + 'type_id' => string 'simple' (length=6) + 'name' => string 'Canon PowerShot A630 8MP Digital Camera with 4x Optical Zoom' (length=60) + 'description' => string 'Replacing the highly popular PowerShot A620, the PowerShot A630 features a rotating 2.5-inch vari-angle LCD, 4x optical zoom lens, and a vast array of creative shooting modes. + +The PowerShot A630 packs a vast array of advanced features into a remarkably compact space' (length=267) + 'short_description' => string 'Replacing the highly popular PowerShot A620, the PowerShot A630 features a rotating 2.5-inch vari-angle LCD, 4x optical zoom lens, and a vast array of creative shooting modes.' (length=175) + 'weight' => string '1.0000' (length=6) + 'old_id' => null + 'news_from_date' => null + 'news_to_date' => null + 'status' => string '1' (length=1) + 'url_key' => string 'canon-powershot-a630-8mp-digital-camera-with-4x-optical-zoom' (length=60) + 'url_path' => string 'canon-powershot-a630-8mp-digital-camera-with-4x-optical-zoom.html' (length=65) + 'visibility' => string '4' (length=1) + 'category_ids' => + array + 0 => string '3' (length=1) + 1 => string '5' (length=1) + 'required_options' => string '0' (length=1) + 'has_options' => string '0' (length=1) + 'image_label' => null + 'small_image_label' => null + 'thumbnail_label' => null + 'created_at' => string '2012-03-29 12:47:56' (length=19) + 'updated_at' => string '2012-03-29 12:47:56' (length=19) + 'country_of_manufacture' => null + 'price' => string '329.9900' (length=8) + 'group_price' => + array + empty + 'special_price' => null + 'special_from_date' => null + 'special_to_date' => null + 'tier_price' => + array + empty + 'minimal_price' => null + 'msrp_enabled' => string '2' (length=1) + 'msrp_display_actual_price_type' => string '4' (length=1) + 'msrp' => null + 'enable_googlecheckout' => string '1' (length=1) + 'tax_class_id' => string '2' (length=1) + 'meta_title' => null + 'meta_keyword' => null + 'meta_description' => null + 'is_recurring' => string '0' (length=1) + 'recurring_profile' => null + 'custom_design' => null + 'custom_design_from' => null + 'custom_design_to' => null + 'custom_layout_update' => null + 'page_layout' => null + 'options_container' => string 'container2' (length=10) + 'gift_message_available' => null+
Aliases:
+Allows you to retrieve the list of products.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +filters | +Array of filters by attributes (optional) | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +storeView | +Array of catalogProductEntity | +
The catalogProductEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ sku |
+Product SKU | +
| string |
+ name |
+Product name | +
| string |
+ set |
+Product attribute set | +
| string |
+ type |
+Type of the product | +
| ArrayOfString | + category_ids |
+Array of category IDs | +
| ArrayOfString |
+website_ids | +Array of website IDs | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'type',
+ 'value' => array('key' => 'in', 'value' => 'simple,configurable')
+ )
+ )
+);
+$result = $client->catalogProductList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductList((object)array('sessionId' => $sessionId->result, 'filters' => null));
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '1' (length=1) + 'sku' => string 'n2610' (length=5) + 'name' => string 'Nokia 2610 Phone' (length=16) + 'set' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'category_ids' => + array + 0 => string '4' (length=1) + 1 => + array + 'product_id' => string '2' (length=1) + 'sku' => string 'b8100' (length=5) + 'name' => string 'BlackBerry 8100 Pearl' (length=21) + 'set' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'category_ids' => + array + 0 => string '4' (length=1)+
Get the list of additional attributes. Additional attributes are attributes that are not in the default set of attributes.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +productType | +Product type (e.g., simple) | +
| string | +attributeSetId | +Attribute set ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +attribute_id | +Attribute ID | +
| string | +code | +Attribute code | +
| string |
+type | +Attribute type (e.g., text, select, date, etc.) | +
| string |
+required | +Defines whether the attribute is required | +
| string |
+scope | +Attribute scope (global, website, or store) | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 104 | +Product type is not in allowed types. | +
| 105 | +Product attribute set is not existed | +
| 106 | +Product attribute set is not belong catalog product entity type | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$listAttributes = $proxy->call(
+ $sessionId,
+ 'product.listOfAdditionalAttributes',
+ array(
+ 'simple',
+ 13
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductListOfAdditionalAttributes($sessionId, 'simple', '13');
+var_dump($result);
+ array + 0 => + array + 'attribute_id' => string '89' (length=2) + 'code' => string 'old_id' (length=6) + 'type' => string 'text' (length=4) + 'required' => string '0' (length=1) + 'scope' => string 'global' (length=6) + 1 => + array + 'attribute_id' => string '93' (length=2) + 'code' => string 'news_from_date' (length=14) + 'type' => string 'date' (length=4) + 'required' => string '0' (length=1) + 'scope' => string 'website' (length=7) + 2 => + array + ...+
Aliases:
+Allows you to set the product special price.
+ +Aliases:
+Note:
+Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ productId |
+Product ID or SKU | +
| string |
+ specialPrice |
+Product special price | +
| string |
+ fromDate |
+Date starting from which special price will be applied | +
| string |
+ toDate |
+Date till which special price will be applied | +
| string |
+ storeView |
+Store view ID or code (optional) | +
| string | +productIdentifierType | +Defines whether the product ID or SKU is passed in the 'productId' parameter (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean/int | +result | +True (1) if the special price is set for the product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product.setSpecialPrice', array('product' => 'testproduct', 'specialPrice' => '77.5', 'fromDate' => '2012-03-29 12:30:51', 'toDate' => '2012-04-29 12:30:51'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductSetSpecialPrice($sessionId, '2', '77.5', '2012-03-29 12:30:51', '2012-04-29 12:30:51');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductSetSpecialPrice((object)array('sessionId' => $sessionId->result, 'productId' => '2', 'specialPrice' => '77.5', 'fromDate' => '2012-03-29 12:30:51', 'toDate' => '2012-04-29 12:30:51'));
+var_dump($result->result);
+ Aliases:
+Allows you to update the required product. Note that you should specify only those parameters which you want to be updated.
+ +Aliases:
+Note:
+Although the API accepts up to four digits of precision for all price arguments, Magento strongly recommends you pass in two digits to reduce inaccuracy in the tax calculation process. (That is, use a price like 12.35 and not 12.3487).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + product\productId |
+Product ID | +
| array | + productData |
+Array of catalogProductCreateEntity | +
| string | + storeView |
+Store view ID or code (optional) | +
| string | + identifierType |
+Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is updated | +
The catalogProductCreateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString | + categories |
+Array of categories | +
| ArrayOfString |
+ websites |
+Array of websites | +
| string | + name |
+Product name | +
| string |
+ description |
+Product description | +
| string |
+ short_description |
+Product short description | +
| string |
+ weight |
+Product weight | +
| string |
+ status |
+Product status | +
| string |
+ url_key |
+A relative URL path that can be entered in place of the target path | +
| string |
+ url_path |
+URL path | +
| string |
+ visibility |
+Product visibility on the frontend | +
| ArrayOfString |
+ category_ids |
+Array of category IDs | +
| ArrayOfString |
+ website_ids |
+Array of website IDs | +
| string |
+ has_options |
+Defines whether the product has options | +
| string |
+ gift_message_available |
+Defines whether the gift message is available for the product | +
| string |
+ price |
+Product price | +
| string |
+ special_price |
+Product special price | +
| string |
+ special_from_date |
+Date starting from which the special price will be applied to the product | +
| string |
+ special_to_date |
+Date till which the special price will be applied to the product | +
| string |
+ tax_class_id |
+Tax class ID | +
| array | + tier_price |
+Array of catalogProductTierPriceEntity | +
| string |
+ meta_title |
+Meta title | +
| string |
+ meta_keyword |
+Meta keyword | +
| string |
+ meta_description |
+Meta description | +
| string |
+ custom_design |
+Custom design | +
| string |
+ custom_layout_update |
+Custom layout update | +
| string |
+ options_container |
+Options container | +
| associativeArray |
+ additional_attributes |
+Array of catalogProductAdditionalAttributesEntity | +
| array | + stock_data |
+ Array of catalogInventoryStockItemUpdateEntity |
+
Notes: The "websites" and "website_ids" or "categories" and "category_ids" parameters are interchangeable. In other words, you can specify an array of website IDs (int) and then you don't need to specify the array of website codes (string) and vice versa.
+ +The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+Customer group ID | +
| string | + website |
+Website | +
| int | + qty |
+Quantity of items to which the price will be applied | +
| double | + price |
+Price that each item will cost | +
The catalogInventoryStockItemUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + qty |
+Quantity of items | +
| int | + is_in_stock |
+Defines whether the item is in stock | +
| int |
+ manage_stock |
+Manage stock | +
| int |
+ use_config_manage_stock |
+Use config manage stock | +
| int |
+ min_qty |
+Minimum quantity for items to be in stock | +
| int |
+ use_config_min_qty |
+Use config settings flag (value defined in the Inventory System Configuration) | +
| int |
+ min_sale_qty |
+Minimum quantity allowed in the shopping cart | +
| int |
+ use_config_min_sale_qty |
+Use config settings flag | +
| int |
+ max_sale_qty |
+Maximum quantity allowed in the shopping cart | +
| int |
+ use_config_max_sale_qty |
+Use config settings flag | +
| int |
+ is_qty_decimal |
+Defines whether the quantity is decimal | +
| int |
+ backorders |
+Backorders status | +
| int |
+ use_config_backorders |
+Use config settings flag (for backorders) | +
| int |
+ notify_stock_qty |
+Stock quantity below which a notification will appear | +
| int |
+ use_config_notify_stock_qty |
+Use config settings flag (for stock quantity) | +
The catalogProductAdditionalAttributesEntity content is as follows:
+ + +| Type | +Name | +
|---|---|
| associativeMultiArray | +multi_data | +
| associativeArray | +single_data | +
Single Data: array of attributes with only single value
+Multi Data: array of attributes which could contain several values
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Product not exists. | +
| 102 | +Invalid data given. Details in error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session, 'catalog_product.update', array('product_sku', array(
+ 'categories' => array(2),
+ 'websites' => array(1),
+ 'name' => 'Product name new 2',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'url_key' => 'product-url-key',
+ 'url_path' => 'product-url-path',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+ 'meta_title' => 'Product meta title',
+ 'meta_keyword' => 'Product meta keyword',
+ 'meta_description' => 'Product meta description'
+)));
+
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->catalogProductUpdate($session, 'product_sku', array(
+ 'categories' => array(2),
+ 'websites' => array(1),
+ 'name' => 'Product name new',
+ 'description' => 'Product description',
+ 'short_description' => 'Product short description',
+ 'weight' => '10',
+ 'status' => '1',
+ 'url_key' => 'product-url-key',
+ 'url_path' => 'product-url-path',
+ 'visibility' => '4',
+ 'price' => '100',
+ 'tax_class_id' => 1,
+ 'meta_title' => 'Product meta title',
+ 'meta_keyword' => 'Product meta keyword',
+ 'meta_description' => 'Product meta description'
+));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1',
+'productData' => ((object)array(
+ 'name' => 'Product name updated',
+ 'status' => '1',
+))));
+
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve product attributes and options.
+ +Resource Name: catalog_product_attribute
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Requested attribute not found. | +
| 102 | +Invalid request parameters. | +
| 103 | +Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, first character should be a letter. | +
| 104 | +Incorrect attribute type. | +
| 105 | +Unable to save attribute. | +
| 106 | +This attribute cannot be deleted. | +
| 107 | +This attribute cannot be edited. | +
| 108 | +Unable to add option. | +
| 109 | +Unable to remove option. | +
<pre>
+<?php
+$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+echo "<pre>";
+// Create new attribute
+$attributeToCreate = array(
+ "attribute_code" => "new_attribute",
+ "scope" => "store",
+ "frontend_input" => "select",
+ "is_unique" => 0,
+ "is_required" => 0,
+ "is_configurable" => 0,
+ "is_searchable" => 0,
+ "is_visible_in_advanced_search" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(
+ "is_filterable" => 1,
+ "is_filterable_in_search" => 1,
+ "position" => 1,
+ "used_for_sort_by" => 1
+ ),
+ "frontend_label" => array(
+ array(
+ "store_id" => 0,
+ "label" => "A new attribute"
+ )
+ )
+);
+
+$attributeId = $proxy->call(
+ $sessionId,
+ "product_attribute.create",
+ array(
+ $attributeToCreate
+ )
+);
+
+// Update attribute
+$attributeToUpdate = array(
+ "scope" => "global",
+ "is_unique" => 1,
+ "is_required" => 1,
+ "is_configurable" => 1,
+ "is_searchable" => 1,
+ "is_visible_in_advanced_search" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(
+ "is_filterable" => 01,
+ "is_filterable_in_search" => 0,
+ "position" => 2,
+ "used_for_sort_by" => 0
+ ),
+ "frontend_label" => array(
+ array(
+ "store_id" => 0,
+ "label" => "A Test Attribute"
+ )
+ )
+);
+$proxy->call(
+ $sessionId,
+ "product_attribute.update",
+ array(
+ "new_attribute",
+ $attributeToUpdate
+ )
+);
+
+// Add option
+$optionToAdd = array(
+ "label" => array(
+ array(
+ "store_id" => 0,
+ "value" => "New Option"
+ )
+ ),
+ "order" => 0,
+ "is_default" => 0
+);
+
+$proxy->call(
+ $sessionId,
+ "product_attribute.addOption",
+ array(
+ $attributeId,
+ $optionToAdd
+ )
+);
+
+// Get info
+$resultInfo = $proxy->call(
+ $sessionId,
+ "product_attribute.info",
+ array(
+ $attributeId
+ )
+);
+echo "info result:\n";
+print_r($resultInfo);
+
+// List options
+$resultListOptions = $proxy->call(
+ $sessionId,
+ "product_attribute.options",
+ array(
+ $attributeId
+ )
+);
+echo "\n options result:\n";
+print_r($resultListOptions);
+
+// Remove option
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.removeOption",
+ array(
+ $attributeId,
+ $resultInfo['options'][0]['value']
+ )
+);
+
+// remove attribute
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.remove",
+ array(
+ $attributeId
+ )
+);
+ Aliases:
+Allows you to retrieve the product attribute options.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ attributeId |
+Attribute ID or code | +
| string |
+ storeView |
+Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeOptionEntity | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Option label | +
| string | +value | +Option value | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeId = 11; // Existing selectable attribute ID
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.options",
+ array(
+ $attributeId
+ )
+);
+echo "<pre>";
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeOptions($sessionId, '11');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeOptions((object)array('sessionId' => $sessionId->result, 'attributeId' => '11'));
+
+var_dump($result->result);
+ array + 1 => + array + 'value' => string '5' (length=1) + 'label' => string 'blue' (length=4) + 2 => + array + 'value' => string '4' (length=1) + 'label' => string 'green' (length=5) + 3 => + array + 'value' => string '3' (length=1) + 'label' => string 'yellow' (length=6)+
Allows you to add a new option for attributes with selectable fields.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + attribute |
+Attribute code or ID | +
| array | +data | +Array of catalogProductAttributeOptionEntityToAdd | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True on success | +
The catalogProductAttributeOptionEntityToAdd content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +label | +Array of catalogProductAttributeOptionLabel | +
| int | +order | +Option order | +
| int | +is_default | +Defines whether the option is a default one | +
The catalogProductAttributeOptionLabel content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString | + store_id |
+Array of store view IDs | +
| string | + value |
+Text label | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
| 104 | +Incorrect attribute type. | +
| 108 | +Unable to add option. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeCode = "new_attribute";
+$optionToAdd = array(
+ "label" => array(
+ array(
+ "store_id" => 0,
+ "value" => "New Option"
+ )
+ ),
+ "order" => 0,
+ "is_default" => 0
+);
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.addOption",
+ array(
+ $attributeCode,
+ $optionToAdd
+ )
+);
+ <?php
+$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+//V2
+$session = $client->login('apiUser', 'apiKey');
+
+// V2 WS-I Mode
+//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+//$session = $response->result;
+
+$attributeCode = "new_attribute";
+
+//v2
+
+$label = array (
+ array(
+ "store_id" => array("0"),
+ "value" => "some random data"
+ )
+ );
+
+$data = array(
+ "label" => $label,
+ "order" => "10",
+ "is_default" => "1"
+ );
+
+$orders = $client->catalogProductAttributeAddOption($session, $attributeCode, $data);
+
+
+
+//V2 WSI
+//WSDL WSI does not describe this method
+//$result = $client->catalogProductAttributeAddOption(...);
+//$orders = $result->result->complexObjectArray;
+
+var_dump ($orders);
+?>
+ Allows you to create a new product attribute.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +data | +Array of catalogProductAttributeEntityToCreate | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created attribute | +
The catalogProductAttributeEntityToCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + attribute_code |
+Attribute code | +
| string |
+ frontend_input |
+ Attribute type |
+
| string |
+ scope |
+ Attribute scope. Possible values are as follows: 'store', 'website', or 'global' |
+
| string |
+ default_value |
+Attribute default value | +
| int | + is_unique |
+Defines whether the attribute is unique | +
| int | + is_required |
+ Defines whether the attribute is required |
+
| ArrayOfString | + apply_to |
+ Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
+
| int | + is_configurable |
+ Defines whether the attribute can be used for configurable products |
+
| int |
+ is_searchable |
+Defines whether the attribute can be used in Quick Search | +
| int |
+ is_visible_in_advanced_search |
+Defines whether the attribute can be used in Advanced Search | +
| int |
+ is_comparable |
+Defines whether the attribute can be compared on the frontend | +
| int |
+ is_used_for_promo_rules |
+Defines whether the attribute can be used for promo rules | +
| int |
+ is_visible_on_front |
+Defines whether the attribute is visible on the frontend | +
| int |
+ used_in_product_listing |
+Defines whether the attribute can be used in product listing | +
| associativeArray | + additional_fields |
+Array of additional fields | +
| array | + frontend_label |
+Array of catalogProductAttributeFrontendLabel | +
The catalogProductAttributeFrontendLabelEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + store_id |
+Store ID | +
| string | + label |
+Text label | +
Notes: The "label" value for the "store_id" value set to 0 must be specified. An attribute cannot be created without specifying the label for store_id=0.
+ +The AdditionaFieldsEntity array of additional fields for the text type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +frontend_class | +Input Validation for Store Owner. Possible values are as follows: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | +
| boolean | +is_html_allowed_on_front | +Defines whether the HTML tags are allowed on the frontend | +
| boolean | +used_for_sort_by | +Defines whether it is used for sorting in product listing | +
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_wysiwyg_enabled | +Enable WYSIWYG flag | +
| boolean | +is_html_allowed_on_front | + Defines whether the HTML tags are allowed on the frontend |
+
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | +Defines whether it is used in layered navigation | +
| boolean | +is_filterable_in_search | +Defines whether it is used in search results layered navigation | +
| int | +position | +Position | +
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | + Defines whether it is used in layered navigation |
+
| boolean | +is_filterable_in_search | + Defines whether it is used in search results layered navigation |
+
| int | +position | +Position | +
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 102 | +Invalid request parameters. | +
| 103 | +Attribute code is invalid. Please use only letters (a-z), numbers (0-9) or underscore (_) in this field, first character should be a letter. | +
| 104 | +Incorrect attribute type. | +
| 105 | +Unable to save attribute. | +
<?php
+
+$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$attributeToUpdate = array(
+ "scope" => "global",
+ "default_value" => "100",
+ "frontend_input" => "text",
+ "is_unique" => 0,
+ "is_required" => 0,
+ "is_configurable" => 0,
+ "is_searchable" => 0,
+ "is_visible_in_advanced_search" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(
+ "is_filterable" => 1,
+ "is_filterable_in_search" => 1,
+ "position" => 1,
+ "used_for_sort_by" => 1
+ ),
+ "frontend_label" => array(
+ array(
+ "store_id" => 0,
+ "label" => "Updated attribute"
+ )
+ )
+);
+
+
+$attributeCode = 'code1';
+
+$result = $client->call($session, 'product_attribute.update', array($attributeCode, $attributeToUpdate));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+
+?>
+ <?php
+//ini_set("soap.wsdl_cache_enabled", 0);
+
+$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+//V2
+$session = $client->login('apiUser', 'apiKey');
+
+// V2 WS-I Mode
+//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+//$session = $response->result;
+
+
+//v2
+
+$data = array(
+ "attribute_code" => "test_attribute",
+ "frontend_input" => "text",
+ "scope" => "1",
+ "default_value" => "1",
+ "is_unique" => 0,
+ "is_required" => 0,
+ "apply_to" => array("simple"),
+ "is_configurable" => 0,
+ "is_searchable" => 0,
+ "is_visible_in_advanced_search" => 0,
+ "is_comparable" => 0,
+ "is_used_for_promo_rules" => 0,
+ "is_visible_on_front" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(),
+ "frontend_label" => array(array("store_id" => "0", "label" => "some label"))
+ );
+
+$orders = $client->catalogProductAttributeCreate($session, $data);
+
+
+
+//V2 WSI
+//WSDL WSI Sample is not complete
+//$result = $client->catalogProductAttributeCreate(array("sessionId" => $session, "data" => $data));
+//$orders = $result->result->complexObjectArray;
+
+echo 'Number of results: ' . count($orders) . '<br/>';
+var_dump ($orders);
+?>
+ Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ sessionId |
+Session ID | +
| string |
+ storeView |
+Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute.currentStore', 'english');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeCurrentStore($sessionId, 'english');
+var_dump($result);
+ Allows you to get full information about a required attribute with the list of options.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +attribute | +Attribute code or ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductAttributeEntity | +
The catalogProductAttributeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +attribute_id | +Attribute ID | +
| string |
+ attribute_code |
+Attribute code | +
| string |
+ frontend_input |
+ Attribute type |
+
| string |
+ scope |
+Attribute scope | +
| string |
+ default_value |
+Attribute default value | +
| int | + is_unique |
+Defines whether the attribute is unique | +
| int | + is_required |
+ Defines whether the attribute is required |
+
| ArrayOfString | + apply_to |
+ Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
+
| int | + is_configurable |
+ Defines whether the attribute can be used for configurable products |
+
| int | + is_searchable |
+ Defines whether the attribute can be used in Quick Search |
+
| int | + is_visible_in_advanced_search |
+ Defines whether the attribute can be used in Advanced Search |
+
| int | + is_comparable |
+ Defines whether the attribute can be compared on the frontend |
+
| int | + is_used_for_promo_rules |
+ Defines whether the attribute can be used for promo rules |
+
| int | + is_visible_on_front |
+Defines whether the attribute is visible on the frontend | +
| int | + used_in_product_listing |
+ Defines whether the attribute can be used in product listing |
+
| associativeArray |
+ additional_fields |
+Array of additional fields | +
| array | + options |
+Array of catalogAttributeOptionEntity | +
| array | + frontend_label |
+Array of catalogProductAttributeFrontendLabel | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + label |
+Text label | +
| string | + value |
+Option ID | +
The catalogProductAttributeFrontendLabelEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + store_id |
+Store ID | +
| string | + label |
+Text label | +
The AdditionaFieldsEntity array of additional fields for the text type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +frontend_class | +Input Validation for Store Owner. Possible values: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | +
| boolean | +is_html_allowed_on_front | +Defines whether the HTML tags are allowed on the frontend | +
| boolean | +used_for_sort_by | +Defines whether it is used for sorting in product listing | +
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_wysiwyg_enabled | +Enable WYSIWYG flag | +
| boolean | +is_html_allowed_on_front | + Defines whether the HTML tags are allowed on the frontend |
+
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | +Defines whether it used in layered navigation | +
| boolean | +is_filterable_in_search | +Defines whether it is used in search results layered navigation | +
| int | +position | +Position | +
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | + Defines whether it used in layered navigation |
+
| boolean | +is_filterable_in_search | + Defines whether it is used in search results layered navigation |
+
| int | +position | +Position | +
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_attribute.info', '11');
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeInfo($sessionId, '11');
+var_dump($result);
+ array + 'attribute_id' => string '11' (length=3) + 'attribute_code' => string 'new_special_price' (length=17) + 'frontend_input' => string 'text' (length=4) + 'default_value' => null + 'is_unique' => string '0' (length=1) + 'is_required' => string '0' (length=1) + 'apply_to' => + array + empty + 'is_configurable' => string '0' (length=1) + 'is_searchable' => string '0' (length=1) + 'is_visible_in_advanced_search' => string '0' (length=1) + 'is_comparable' => string '0' (length=1) + 'is_used_for_promo_rules' => string '0' (length=1) + 'is_visible_on_front' => string '0' (length=1) + 'used_in_product_listing' => string '0' (length=1) + 'frontend_label' => + array + 0 => + array + 'store_id' => int 0 + 'label' => string 'special price' (length=13) + 1 => + array + 'store_id' => int 2 + 'label' => string 'special price' (length=13) + 'scope' => string 'store' (length=5) + 'additional_fields' => + array + 'frontend_class' => null + 'is_html_allowed_on_front' => string '1' (length=1) + 'used_for_sort_by' => string '0' (length=1)+
Aliases:
+Allows you to retrieve the list of product attributes.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | + setId |
+ID of the attribute set | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeEntity | +
The catalogAttributeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + attribute_id |
+Attribute ID | +
| string | + code |
+Attribute code | +
| string |
+ type |
+Attribute type | +
| string |
+ required |
+Defines whether the attribute is required | +
| string |
+ scope |
+Attribute scope. Possible values: 'store', 'website', or 'global' | +
Faults:
+ +No faults
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setid = 4; // Existing attribute set id
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.list",
+ array(
+ $setId
+ )
+);
+echo "<pre>";
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeList($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeList((object)array('sessionId' => $sessionId->result, 'setId' => '4'));
+
+var_dump($result->result);
+ array + 0 => + array + 'attribute_id' => string '71' (length=2) + 'code' => string 'name' (length=4) + 'type' => string 'text' (length=4) + 'required' => string '1' (length=1) + 'scope' => string 'store' (length=5) + 1 => + array + 'attribute_id' => string '72' (length=2) + 'code' => string 'description' (length=11) + 'type' => string 'textarea' (length=8) + 'required' => string '1' (length=1) + 'scope' => string 'store' (length=5)+
Aliases:
+Allows you to retrieve the product attribute options.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ attributeId |
+Attribute ID or code | +
| string |
+ storeView |
+Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeOptionEntity | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Option label | +
| string | +value | +Option value | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeId = 11; // Existing selectable attribute ID
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.options",
+ array(
+ $attributeId
+ )
+);
+echo "<pre>";
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeOptions($sessionId, '11');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeOptions((object)array('sessionId' => $sessionId->result, 'attributeId' => '11'));
+
+var_dump($result->result);
+ array + 1 => + array + 'value' => string '5' (length=1) + 'label' => string 'blue' (length=4) + 2 => + array + 'value' => string '4' (length=1) + 'label' => string 'green' (length=5) + 3 => + array + 'value' => string '3' (length=1) + 'label' => string 'yellow' (length=6)+
Allows you to remove the required attribute from a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +attribute | +Attribute code or ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the attribute is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
| 106 | +This attribute cannot be deleted. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeCode = "11";
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.remove",
+ array(
+ $attributeCode
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeRemove($sessionId, '11');
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$session = $client->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $client->catalogProductAttributeRemove((object)array('sessionId' => $session->result, 'attribute' => '11'));
+
+var_dump ($result);
+ Allows you to remove the option for an attribute.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +attribute | +Attribute code or ID | +
| string |
+optionId | +Option ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the option is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
| 104 | +Incorrect attribute type. | +
| 109 | +Unable to remove option. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeCode = "2";
+$optionId = 11; // Existing option ID
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.removeOption",
+ array(
+ $attributeCode,
+ $optionId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeRemoveOption($sessionId, '2', '11');
+var_dump($result);
+ Allows you to retrieve the list of possible attribute types.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogAttributeOptionEntity | +
The catalogAttributeOptionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Option label | +
| string |
+ value |
+Option value | +
Faults:
+ +No Faults.
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.types"
+);
+
+echo "<pre>";
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeTypes($sessionId);
+var_dump($result);
+ array + 0 => + 'value' => 'text' + 'label' => 'Text Field' + 1 => + 'value' => 'textarea' + 'label' => 'Text Area' + 2 => + 'value' => 'date' + 'label' => 'Date' + 3 => + 'value' => 'boolean' + 'label' => 'Yes/No' + 4 => + 'value' => 'multiselect' + 'label' => 'Multiple Select' + 5 => + 'value' => 'select' + 'label' => 'Dropdown' + 6 => + 'value' => 'price' + 'label' => 'Price' + 7 => + 'value' => 'media_image' + 'label' => 'Media Image'+
Allows you to update the required attribute.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + attribute |
+Attribute code or ID | +
| array | +data | +Array of catalogProductAttributeEntityToUpdate | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the attribute is updated | +
The catalogProductAttributeEntityToUpdate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + scope |
+ Attribute scope. Possible values are as follows: 'store', 'website', or 'global' |
+
| string | + default_value |
+Attribute default value | +
| int | + is_unique |
+Defines whether the attribute is unique | +
| int | + is_required |
+Defines whether the attribute is required | +
| ArrayOfString | + apply_to |
+ Apply to. Empty for "Apply to all" or array of the following possible values: 'simple', 'grouped', 'configurable', 'virtual', 'bundle', 'downloadable', 'giftcard' |
+
| int | + is_configurable |
+Defines whether the attribute can be used for configurable products | +
| int |
+ is_searchable |
+ Defines whether the attribute can be used in Quick Search |
+
| int |
+ is_visible_in_advanced_search |
+ Defines whether the attribute can be used in Advanced Search |
+
| int |
+ is_comparable |
+ Defines whether the attribute can be compared on the frontend |
+
| int |
+ is_used_for_promo_rules |
+ Defines whether the attribute can be used for promo rules |
+
| int |
+ is_visible_on_front |
+ Defines whether the attribute can be visible on the frontend |
+
| int |
+ used_in_product_listing |
+ Defines whether the attribute can be used in product listing |
+
| associativeArray | + additional_fields |
+Array of additional fields | +
| array | + frontend_label |
+Array of catalogProductAttributeFrontendLabel | +
The AdditionaFieldsEntity array of additional fields for the text type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +frontend_class | +Input Validation for Store Owner. Possible values: 'validate-number' (Decimal Number), 'validate-digits' (Integer Number), 'validate-email', 'validate-url', 'validate-alpha' (Letters), 'validate-alphanum' (Letters (a-z, A-Z), or Numbers (0-9)) | +
| boolean | +is_html_allowed_on_front | + Defines whether the HTML tags are allowed on the frontend |
+
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The AdditionaFieldsEntity array of additional fields for the text area type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_wysiwyg_enabled | +Enable WYSIWYG flag | +
| boolean | +is_html_allowed_on_front | + Defines whether the HTML tags are allowed on the frontend |
+
The AdditionaFieldsEntity array of additional fields for the date and boolean types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The AdditionaFieldsEntity array of additional fields for the multiselect type is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | + Defines whether it used in layered navigation |
+
| boolean | +is_filterable_in_search | + Defines whether it is used in search results layered navigation |
+
| integer | +position | +Position | +
The AdditionaFieldsEntity array of additional fields for the select and price types is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +is_filterable | + Defines whether it used in layered navigation |
+
| boolean | +is_filterable_in_search | + Defines whether it is used in search results layered navigation |
+
| integer | +position | +Position | +
| boolean | +used_for_sort_by | + Defines whether it is used for sorting in product listing |
+
The catalogProductAttributeFrontendLabel content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +store_id | +Store ID | +
| string | +label | +Text label | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested attribute not found. | +
| 105 | +Unable to save attribute. | +
| 107 | +This attribute cannot be edited. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeToUpdate = array(
+ "scope" => "global",
+ "is_unique" => 1,
+ "is_required" => 1,
+ "is_configurable" => 1,
+ "is_searchable" => 1,
+ "is_visible_in_advanced_search" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(
+ "is_filterable" => 1,
+ "is_filterable_in_search" => 0,
+ "position" => 2,
+ "used_for_sort_by" => 0
+ ),
+ "frontend_label" => array(
+ array(
+ "store_id" => 0,
+ "label" => "A Test Attribute"
+ )
+ )
+);
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute.update",
+ array(
+ $attributeToUpdate
+ )
+);
+ <?php
+//ini_set("soap.wsdl_cache_enabled", 0);
+
+$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+//V2
+$session = $client->login('apiUser', 'apiKey');
+
+// V2 WS-I Mode
+//$response = $client->login(array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+//$session = $response->result;
+
+
+//v2
+$attributeCode = "code1";
+$data = array(
+ "frontend_input" => "text",
+ "scope" => "1",
+ "default_value" => "1",
+ "is_unique" => 0,
+ "is_required" => 0,
+ "apply_to" => array("simple"),
+ "is_configurable" => 0,
+ "is_searchable" => 0,
+ "is_visible_in_advanced_search" => 0,
+ "is_comparable" => 0,
+ "is_used_for_promo_rules" => 0,
+ "is_visible_on_front" => 0,
+ "used_in_product_listing" => 0,
+ "additional_fields" => array(),
+ "frontend_label" => array(array("store_id" => "0", "label" => "some random label updated"))
+ );
+
+$orders = $client->catalogProductAttributeUpdate($session, $attributeCode, $data);
+
+
+
+//V2 WSI
+//WSDL WSI Sample is not complete
+//$result = $client->catalogProductAttributeCreate(array("sessionId" => $session, "data" => $data));
+//$orders = $result->result->complexObjectArray;
+
+echo 'Number of results: ' . count($orders) . '<br/>';
+var_dump ($orders);
+?>
+ Aliases:
+Allows you to upload a new product image.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ product |
+Product ID or code | +
| array | + data |
+Array of catalogProductAttributeMediaCreateEntity | +
| string | + storeView |
+Store view ID or code (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +result | +Image file name (e.g., "/i/m/image.png") | +
The catalogProductAttributeMediaCreateEntity content is as follows:
+ +| Type | +Name | + Description |
+
|---|---|---|
| array | + file |
+ Array of catalogProductImageFileEntity |
+
| string | + label |
+Image label | +
| string | + position |
+Image position | +
| ArrayOfString | + types |
+Array of types | +
| string | + exclude |
+Defines whether the image will associate only to one of three image types | +
| string | + remove |
+Remove image flag | +
The catalogProductImageFileEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +content | +Image content (base_64 encoded) | +
| string | +mime | +Image mime type (e.g., image/jpeg) | +
| string | +name | +Image name | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 2;
+$file = array(
+ 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+ 'mime' => 'image/jpeg'
+);
+
+$result = $proxy->call(
+ $session,
+ 'catalog_product_attribute_media.create',
+ array(
+ $productId,
+ array('file'=>$file, 'label'=>'Label', 'position'=>'100', 'types'=>array('thumbnail'), 'exclude'=>0)
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 2;
+$file = array(
+ 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+ 'mime' => 'image/jpeg'
+);
+
+$result = $proxy->catalogProductAttributeMediaCreate(
+ $session,
+ $productId,
+ array('file' => $file, 'label' => 'Label', 'position' => '100', 'types' => array('thumbnail'), 'exclude' => 0)
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaCreate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'data' => ((object)array(
+'label' => 'image_label',
+'position' => '1',
+'types' => array('thumbnail'),
+'exclude' => '0',
+'file' => ((object)array(
+'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+'mime' => 'image/png',
+'name' => 'image'
+))))));
+
+var_dump($result->result);
+ Aliases:
+Allows you to set/get the current store view.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeView | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +storeView | +Store view ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.currentStore', 'english');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaCurrentStore($sessionId, 'english');
+var_dump($result);
+ Aliases:
+Allows you to retrieve information about the specified product image.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ file |
+Name of the image file (e.g., /b/l/blackberry8100_2.jpg) | +
| string |
+ storeView |
+Store view ID or code (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductImageEntity | +
The catalogProductImageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + file |
+Image file name | +
| string |
+ label |
+Image file label | +
| string |
+ position |
+Image file position | +
| string |
+ exclude |
+Defines whether the image will associate only to one of three image types | +
| string |
+ url |
+Image URL | +
| ArrayOfString | + types |
+Array of types | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.info', array('product' => '2', 'file' => '/b/l/blackberry8100_2.jpg'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaInfo($sessionId, '2', '/b/l/blackberry8100_2.jpg');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaInfo((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'file' => '/i/m/image.png'));
+
+var_dump($result->result);
+ array + 'file' => string '/b/l/blackberry8100_2.jpg' (length=25) + 'label' => string '' (length=0) + 'position' => string '1' (length=1) + 'exclude' => string '0' (length=1) + 'url' => string 'http://magentohost/media/catalog/product/b/l/blackberry8100_2.jpg' (length=71) + 'types' => + array + 0 => string 'image' (length=5) + 1 => string 'small_image' (length=11) + 2 => string 'thumbnail' (length=9)+
Aliases:
+Allows you to retrieve the list of product images.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ storeView |
+Store view ID or code (optional) | +
| string | +identifierType | +Defines whether the product ID or sku is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductImageEntity | +
The catalogProductImageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + file |
+Image file name | +
| string |
+ label |
+Image label | +
| string |
+ position |
+Image position | +
| string |
+ exclude |
+Defines whether the image will associate only to one of three image types | +
| string |
+ url |
+Image URL | +
| ArrayOfString | + types |
+Array of types | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.list', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaList($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaList((object)array('sessionId' => $sessionId->result, 'productId' => '2'));
+
+var_dump($result->result);
+ array + 0 => + array + 'file' => string '/b/l/blackberry8100_2.jpg' (length=25) + 'label' => string '' (length=0) + 'position' => string '1' (length=1) + 'exclude' => string '0' (length=1) + 'url' => string 'http://magentopath/blackberry8100_2.jpg' (length=71) + 'types' => + array + 0 => string 'image' (length=5) + 1 => string 'small_image' (length=11) + 2 => string 'thumbnail' (length=9)+
Aliases:
+Allows you to remove the image from a product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ file |
+Image file name (e.g., /b/l/blackberry8100_2.jpg) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the image is removed from a product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.remove', array('product' => '3', 'file' => '/b/l/blackberry8100_2.jpg'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaRemove($sessionId, '3', '/b/l/blackberry8100_2.jpg');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaRemove((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'file' => '/b/l/blackberry8100_2.jpg'));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve product image types including standard image, small_image, thumbnail, etc. Note that if the product attribute set contains attributes of the Media Image type (Catalog Input Type for Store Owner > Media Image), it will also be returned in the response.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +setId | +ID of the product attribute set | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductAttributeMediaTypeEntity | +
The catalogProductAttributeMediaTypeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +code | +Image type code | +
| string | +scope | +Image scope (store, website, or global) | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_media.types', '4');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeMediaTypes($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaTypes((object)array('sessionId' => $sessionId->result, 'setId' => '4'));
+
+var_dump($result->result);
+ array + 0 => + array + 'code' => string 'image' (length=5) + 'scope' => string 'store' (length=5) + 1 => + array + 'code' => string 'small_image' (length=11) + 'scope' => string 'store' (length=5) + 2 => + array + 'code' => string 'thumbnail' (length=9) + 'scope' => string 'store' (length=5)+
Aliases:
+Allows you to update the product image.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+ product\productId |
+Product ID or code | +
| string |
+ file |
+Image file name (e.g., /i/m/image.jpeg) | +
| array | + data |
+Array of catalogProductAttributeMediaCreateEntity | +
| string |
+ storeView |
+Store view ID or code | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Notes: You should specify only those parameters which you want to be updated. Parameters that were not specified in the request, will preserve the previous values.
+ +Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +Result of product image updating | +
The catalogProductAttributeMediaCreateEntity content is as follows:
+ +| Type | +Name | + Description |
+
|---|---|---|
| array | + file |
+ Array of catalogProductImageFileEntity |
+
| string | + label |
+Product image label | +
| string | + position |
+Product image position | +
| ArrayOfString | + types |
+Array of types | +
| string | + exclude |
+Defines whether the image will associate only to one of three image types | +
| string | + remove |
+Image remove flag | +
The catalogProductImageFileEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +content | +Product image content (base_64 encoded) | +
| string | +mime | +Image mime type (e.g., image/jpeg) | +
| string | +name | +Image name | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 1;
+$file = '/i/m/image.jpg';
+
+$newFile = array(
+ 'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+ 'mime' => 'image/jpeg'
+);
+
+$result = $client->call(
+ $session,
+ 'catalog_product_attribute_media.update',
+ array(
+ $productId,
+ $file,
+ array('file' => $newFile, 'label' => 'New label', 'position' => '50', 'types' => array('image'), 'exclude' => 1)
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 1;
+$file = '/i/m/image.jpg';
+
+$newFile = array(
+'content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z',
+'mime' => 'image/jpeg'
+);
+
+$result = $client->catalogProductAttributeMediaUpdate(
+$session,
+$productId,
+$file,
+array('file' => $newFile, 'label' => 'New label', 'position' => '50', 'types' => array('image'), 'exclude' => 1)
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeMediaUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'file' => '/t/u/tulips.jpg', 'data' => ((object)array(
+'label' => 'tulips',
+'position' => '1',
+'remove' => '0',
+'types' => array('small_image')
+))));
+
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage product images.
+ +Resource Name: catalog_product_attribute_media
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested store view not found. | +
| 101 | +Product not exists. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested image not exists in product images’ gallery. | +
| 104 | +Image creation failed. Details in error message. | +
| 105 | +Image not updated. Details in error message. | +
| 106 | +Image not removed. Details in error message. | +
| 107 | +Requested product doesn’t support images | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$newImage = array(
+ 'file' => array(
+ 'name' => 'file_name',
+ 'content' => base64_encode(file_get_contents('product.jpg')),
+ 'mime' => 'image/jpeg'
+ ),
+ 'label' => 'Cool Image Through Soap',
+ 'position' => 2,
+ 'types' => array('small_image'),
+ 'exclude' => 0
+);
+
+$imageFilename = $proxy->call($sessionId, 'product_media.create', array('Sku', $newImage));
+
+
+var_dump($imageFilename);
+
+// Newly created image file
+var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
+
+$proxy->call($sessionId, 'product_media.update', array(
+ 'Sku',
+ $imageFilename,
+ array('position' => 2, 'types' => array('image') /* Lets do it main image for product */)
+));
+
+// Updated image file
+var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
+
+// Remove image file
+$proxy->call($sessionId, 'product_media.remove', array('Sku', $imageFilename));
+
+// Images without our file
+var_dump($proxy->call($sessionId, 'product_media.list', 'Sku'));
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve product attribute sets.
+ +Resource Name: catalog_product_attribute_set
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Attribute set with requested id does not exist. | +
| 101 | +Invalid data given. | +
| 102 | +Error while creating attribute set. Details in error message. | +
| 103 | +Error while removing attribute set. Details in error message. | +
| 104 | +Attribute set with requested id does not exist. | +
| 105 | +Unable to remove attribute set as it has related goods. Use forceProductsRemove parameter to remove attribute set with all goods. | +
| 106 | +Attribute with requested id does not exist. | +
| 107 | +Error while adding attribute to attribute set. Details in error message. | +
| 108 | +Attribute group with requested id does not exist. | +
| 109 | +Requested attribute is already in requested attribute set. | +
| 110 | +Error while removing attribute from attribute set. Details in error message. | +
| 111 | +Requested attribute is not in requested attribute set. | +
| 112 | +Requested group exist already in requested attribute set. | +
| 113 | +Error while adding group to attribute set. Details in error message. | +
| 114 | +Error while renaming group. Details in error message. | +
| 115 | +Error while removing group from attribute set. Details in error message. | +
| 116 | +Group can not be removed as it contains system attributes. | +
| 117 | +Group can not be removed as it contains attributes, used in configurable products. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+echo "<pre>";
+// create new set
+$setName = "New Test Set";
+$skeletonId = 4;
+
+$setId = $proxy->call(
+ $sessionId,
+ "product_attribute_set.create",
+ array(
+ $setName,
+ $skeletonId
+ )
+);
+
+// Get list
+$setList = $proxy->call(
+ $sessionId,
+ "product_attribute_set.list"
+);
+echo "Set list:\n";
+print_r($setList);
+
+// create group
+$groupName = "Test Group";
+$groupId = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupAdd",
+ array(
+ $setId,
+ $groupName
+ )
+);
+
+// rename group
+$newGroupName = "New Test Group";
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupRename",
+ array(
+ $groupId,
+ $newGroupName
+ )
+);
+
+// add attribute
+$attributeId = 83;
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.attributeAdd",
+ array(
+ $attributeId,
+ $setId
+ )
+);
+
+//remove attribute
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.attributeRemove",
+ array(
+ $attributeId,
+ $setId
+ )
+);
+
+// remove group
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupRemove",
+ array(
+ $groupId
+ )
+);
+
+// remove set
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.remove",
+ array(
+ $setId
+ )
+);
+ Allows you to add an existing attribute to an attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeId | +Attribute ID | +
| string |
+attributeSetId | +Attribute set ID | +
| string |
+attributeGroupId | +Group ID (optional) | +
| string |
+sortOrder | +Sort order (optional) | +
Note: If the attributeGroupId parameter is not passed, the attribute is added to the General group by default.
+ +Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +isAdded | +True if the attribute is added to an attribute set | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 104 | +Attribute set with requested id does not exist. | +
| 106 | +Attribute with requested id does not exist. | +
| 107 | +Error while adding attribute to attribute set. Details in error message. | +
| 108 | +Attribute group with requested id does not exist. | +
| 109 | +Requested attribute is already in requested attribute set. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setId = 5;
+$attributeId = 83;
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.attributeAdd",
+ array(
+ $attributeId,
+ $setId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setId = 5;
+$attributeId = 83;
+
+$result = $proxy->catalogProductAttributeSetAttributeAdd(
+ $sessionId,
+ $attributeId,
+ $setId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetAttributeAdd((object)array('sessionId' => $sessionId->result, 'attributeId' => '5', 'attributeSetId' => '83'));
+var_dump($result->result);
+ Allows you to remove an existing attribute from an attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeId | +Attribute ID | +
| string |
+attributeSetId | +Attribute set ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +isRemoved | +True if the attribute is removed from an attribute set | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 104 | +Attribute set with requested id does not exist. | +
| 106 | +Attribute with requested id does not exist. | +
| 110 | +Error while removing attribute from attribute set. Details in error message. | +
| 111 | +Requested attribute is not in requested attribute set. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setId = 5;
+$attributeId = 83;
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.attributeRemove",
+ array(
+ $attributeId,
+ $setId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetAttributeRemove($sessionId, '5', '83');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetAttributeRemove((object)array('sessionId' => $sessionId->result, 'attributeId' => '5', 'attributeSetId' => '83'));
+var_dump($result->result);
+ Allows you to create a new attribute set based on another attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +attributeSetName | +Attribute set name | +
| string |
+skeletonSetId | +Attribute set ID basing on which the new attribute set will be created | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +setId | +ID of the created attribute set | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Attribute set with requested id does not exist. | +
| 101 | +Invalid data given. | +
| 102 | +Error while creating attribute set. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setName = "New Attribute Set";
+$skeletonId = 4;
+
+$newSetId = $proxy->call(
+ $sessionId,
+ "product_attribute_set.create",
+ array(
+ $setName,
+ $skeletonId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$attributeSetName = 'New Attribute Set';
+$skeletonId = 4;
+
+$result = $client->catalogProductAttributeSetCreate(
+ $sessionId,
+ $attributeSetName,
+ $skeletonId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetCreate((object)array('sessionId' => $sessionId->result, 'attributeSetName' => 'New Attribute Set', 'skeletonSetId' => '4'));
+var_dump($result->result);
+ Allows you to add a new group for attributes to the attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeSetId | +Attribute set ID | +
| string | +groupName | +Group name | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created group | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 112 | +Requested group exist already in requested attribute set. | +
| 113 | +Error while adding group to attribute set. Details in error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_attribute_set.groupAdd', array('attributeSetId' => '9', 'groupName' => 'new_group'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetGroupAdd($sessionId, '9', 'new_group');
+var_dump($result);
+ $proxy = new SoapClient('http://maentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetGroupAdd((object)array('sessionId' => $sessionId->result, 'attributeSetId' => '9', 'groupName' => 'new_group'));
+var_dump($result->result);
+ Allows you to remove a group from an attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeGroupId | +Group ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the group is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 108 | +Attribute group with requested id does not exist. | +
| 115 | +Error while removing group from attribute set. Details in error message. | +
| 116 | +Group can not be removed as it contains system attributes. | +
| 117 | +Group can not be removed as it contains attributes, used in configurable products. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$groupId = 70;
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupRemove",
+ array(
+ $groupId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetGroupRemove($sessionId, '70');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetGroupRemove((object)array('sessionId' => $sessionId->result, 'attributeGroupId' => '70'));
+var_dump($result->result);
+ Allows you to rename a group in the attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+groupId | +ID of the group that will be renamed | +
| string | +groupName | +New name for the group | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the group is renamed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 108 | +Attribute group with requested id does not exist. | +
| 114 | +Error while renaming group. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$groupId = 100;
+$groupName = "New Group";
+
+echo "Renaming group...";
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.groupRename",
+ array(
+ $groupId,
+ $groupName
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetGroupRename($sessionId, '100', 'New Group');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetGroupRename((object)array('sessionId' => $sessionId->result, 'groupId' => '100', 'groupName' => 'New Group'));
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of product attribute sets.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductAttributeSetEntity | +
The catalogProductAttributeSetEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +set_id | +ID of the attribute set | +
| string | +name | +Attribute set name | +
Faults:
+ +No faults.
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_set.list');
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'set_id' => string '4' (length=1) + 'name' => string 'Default' (length=7) + 1 => + array + 'set_id' => string '9' (length=1) + 'name' => string 'products_set' (length=12)+
Allows you to remove an existing attribute set.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+attributeSetId | +Attribute set ID | +
| string |
+forceProductsRemove | +Force product remove flag (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean\int | +isRemoved | +True (1) if the attribute set is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 103 | +Error while removing attribute set. Details in error message. | +
| 104 | +Attribute set with requested id does not exist. | +
| 105 | +Unable to remove attribute set as it has related goods. Use forceProductsRemove parameter to remove attribute set with all goods. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$setId = 5;
+
+$result = $proxy->call(
+ $sessionId,
+ "product_attribute_set.remove",
+ array(
+ $setId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductAttributeSetRemove($sessionId, '5');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeSetRemove((object)array('sessionId' => $sessionId->result, 'attributeSetId' => '5'));
+var_dump($result->result);
+ Aliases: product_custom_option
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 102 | +Provided data is invalid. | +
| 103 | +Error while saving an option. Details are in the error message. | +
| 104 | +Store with requested code/id does not exist. | +
| 105 | +Option with requested id does not exist. | +
| 106 | +Invalid option type provided. Call 'types' to get list of allowed option types. | +
| 107 | +Error while deleting an option. Details are in the error message. | +
Allows you to add a new custom option for a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+productId | +Product ID | +
| array | +data | +Array of catalogProductCustomOptionToAdd | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the custom option is added | +
The catalogProductCustomOptionToAdd content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Option title | +
| string |
+ type |
+Option type | +
| string |
+ sort_order |
+Option sort order | +
| int | + is_require |
+Defines whether the option is required | +
| array | + additional_fields |
+Array of catalogProductCustomOptionAdditionalFields | +
The catalogProductCustomOptionAdditionalFieldsEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option title | +
| string |
+ price |
+Custom option price | +
| string |
+ price_type |
+ Price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option SKU |
+
| string |
+ max_characters |
+ Maximum number of characters for the customer input on the frontend (optional) |
+
| string |
+ sort_order |
+Custom option sort order | +
| string |
+ file_extension |
+ List of file extensions allowed to upload by the user on the frontend (optional) |
+
| string |
+ image_size_x |
+ Width limit for uploaded images (optional) |
+
| string |
+ image_size_y |
+ Height limit for uploaded images (optional) |
+
| string |
+ value_id |
+Value ID | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 102 | +Provided data is invalid. | +
| 103 | +Error while saving an option. Details are in the error message. | +
| 104 | +Store with requested code/id does not exist. | +
| 106 | +Invalid option type provided. Call 'types' to get list of allowed option types. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$productId = 1;// Existing product ID
+
+// Add custom option of Text Field type
+$customTextFieldOption = array(
+ "title" => "Custom Text Field Option Title",
+ "type" => "field",
+ "is_require" => 1,
+ "sort_order" => 0,
+ "additional_fields" => array(
+ array(
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_text_option_sku",
+ "max_characters" => 255
+ )
+ )
+);
+$resultCustomTextFieldOptionAdd = $proxy->call(
+ $sessionId,
+ "product_custom_option.add",
+ array(
+ $productId,
+ $customTextFieldOption
+ )
+);
+
+// Add custom option of File type
+$customFileOption = array(
+ "title" => "Custom File Option Title",
+ "type" => "file",
+ "is_require" => 1,
+ "sort_order" => 5,
+ "additional_fields" => array(
+ array(
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_file_option_sku",
+ "file_extension" => "jpg",
+ "image_size_x" => 800,
+ "image_size_y" => 600
+ )
+ )
+);
+$resultCustomFileOptionAdd = $proxy->call(
+ $sessionId,
+ "product_custom_option.add",
+ array(
+ $productId,
+ $customFileOption
+ )
+);
+
+// Add custom option of Dropdown type
+$customDropdownOption = array(
+ "title" => "Custom Dropdown Option Title",
+ "type" => "drop_down",
+ "is_require" => 1,
+ "sort_order" => 10,
+ "additional_fields" => array(
+ array(
+ "title" => "Dropdown row #1",
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_select_option_sku_1",
+ "sort_order" => 0
+ ),
+ array(
+ "title" => "Dropdown row #2",
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_select_option_sku_2",
+ "sort_order" => 5
+ )
+ )
+);
+$resultCustomDropdownOptionAdd = $proxy->call(
+ $sessionId,
+ "product_custom_option.add",
+ array(
+ $productId,
+ $customDropdownOption
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductCustomOptionAdd($sessionId, '1', array('title' => 'title',
+'type' => 'field',
+'sort_order' => '1',
+'is_require' => 1,
+'additional_fields' => array(array(
+'price' => '15',
+'price_type' => 'fixed',
+'sku' => 'sku',
+'max_characters' => '100'
+))));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionAdd((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'store' => '1', 'data' => ((object)array(
+'title' => 'title',
+'type' => 'field',
+'sort_order' => '1',
+'is_require' => 1,
+'additional_fields' => array(array(
+'price' => '15',
+'price_type' => 'fixed',
+'sku' => 'sku',
+'max_characters' => '100'
+))))));
+var_dump($result->result);
+ Allows you to retrieve full information about the custom option in a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +optionId | +Option ID | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductCustomOptionInfoEntity | +
The catalogProductCustomOptionInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option title | +
| string |
+ type |
+ Custom option type. Can have one of the following values: "fixed" or "percent" |
+
| string |
+ sort_order |
+Custom option sort order | +
| int | + is_require |
+Defines whether the custom option is required | +
| array | + additional_fields |
+Array of catalogProductCustomOptionAdditionalFields | +
The catalogProductCustomOptionAdditionalFields content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option title | +
| string |
+ price |
+Custom option price | +
| string |
+ price_type |
+ Price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option SKU |
+
| string |
+ max_characters |
+ Maximum number of characters for the customer input on the frontend (optional) |
+
| string |
+ sort_order |
+Custom option sort order | +
| string |
+ file_extension |
+ List of file extensions allowed to upload by the user on the frontend (optional; for the File input type) |
+
| string |
+ image_size_x |
+ Width limit for uploaded images (optional; for the File input type) |
+
| string |
+ image_size_y |
+ Height limit for uploaded images (optional; for the File input type) |
+
| string |
+ value_id |
+Value ID | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 104 | +Store with requested code/id does not exist. | +
| 105 | +Option with requested id does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option.info', '1');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionInfo($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionInfo((object)array('sessionId' => $sessionId->result, 'optionId' => '1'));
+var_dump($result->result);
+ array + 'title' => string 'model' (length=5) + 'type' => string 'drop_down' (length=9) + 'is_require' => string '1' (length=1) + 'sort_order' => string '0' (length=1) + 'additional_fields' => + array + 0 => + array + 'value_id' => string '1' (length=1) + 'title' => string 'monoblock' (length=9) + 'price' => string '139.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'sku' => string 'monoblock' (length=9) + 'sort_order' => string '0' (length=1) + 1 => + array + 'value_id' => string '2' (length=1) + 'title' => string 'slider' (length=6) + 'price' => string '239.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'sku' => string 'slider' (length=6) + 'sort_order' => string '0' (length=1)+
Allows you to retrieve the list of custom options for a specific product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+productId | +Product ID | +
| string | +store | +Store view ID or code (optional but required for WS-I mode) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | + Array of catalogProductCustomOptionList |
+
The catalogProductCustomOptionList content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +option_id | +Custom option ID | +
| string |
+ title |
+Custom option title | +
| string |
+ type |
+Custom option type | +
| string |
+ sort_order |
+Custom option sort order | +
| int | + is_require |
+Defines whether the custom option is required | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 104 | +Store with requested code/id does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option.list', '1');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionList($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionList((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'store' => '1'));
+var_dump($result->result);
+ array + 0 => + array + 'option_id' => string '1' (length=1) + 'title' => string 'model' (length=5) + 'type' => string 'drop_down' (length=9) + 'is_require' => string '1' (length=1) + 'sort_order' => string '0' (length=1)+
Allows you to remove a custom option from the product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +optionId | +Custom option ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the custom option is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 105 | +Option with requested id does not exist. | +
| 107 | +Error while deleting an option. Details are in the error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$optionId = 1;// Existing option ID
+
+$result = $proxy->call(
+ $sessionId,
+ "product_custom_option.remove",
+ array(
+ $optionId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionRemove($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionRemove((object)array('sessionId' => $sessionId->result, 'optionId' => '1'));
+var_dump($result->result);
+ Allows you to retrieve the list of available custom option types.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductCustomOptionTypes | +
The catalogProductCustomOptionTypesEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +label | +Custom option label | +
| string | + value |
+Custom option value | +
Faults:
+ +No faults
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option.types');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionTypes($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionTypes((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'label' => string 'Field' (length=5) + 'value' => string 'field' (length=5) + 1 => + array + 'label' => string 'Area' (length=4) + 'value' => string 'area' (length=4) + 2 => + array + 'label' => string 'File' (length=4) + 'value' => string 'file' (length=4) + 3 => + array + 'label' => string 'Drop-down' (length=9) + 'value' => string 'drop_down' (length=9) + 4 => + array + 'label' => string 'Radio Buttons' (length=13) + 'value' => string 'radio' (length=5) + 5 => + array + 'label' => string 'Checkbox' (length=8) + 'value' => string 'checkbox' (length=8) + 6 => + array + 'label' => string 'Multiple Select' (length=15) + 'value' => string 'multiple' (length=8) + 7 => + array + 'label' => string 'Date' (length=4) + 'value' => string 'date' (length=4) + 8 => + array + 'label' => string 'Date & Time' (length=11) + 'value' => string 'date_time' (length=9) + 9 => + array + 'label' => string 'Time' (length=4) + 'value' => string 'time' (length=4)+
Allows you to update the required product custom option.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +optionId | +Option ID | +
| array | +data | +Array of catalogProductCustomOptionToUpdate | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the custom option is updated | +
The catalogProductCustomOptionToUpdate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Title of the custom option to be updated | +
| string |
+ type |
+Custom option type | +
| string |
+ sort_order |
+Custom option sort order | +
| int | + is_require |
+Defines whether the custom option is required | +
| array | + additional_fields |
+Array of catalogProductCustomOptionAdditionalFields | +
The catalogProductCustomOptionAdditionalFields content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option title | +
| string |
+ price |
+Custom option price | +
| string |
+ price_type |
+ Price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option SKU |
+
| string |
+ max_characters |
+ Maximum number of characters for the customer input on the frontend (optional) |
+
| string |
+ sort_order |
+Custom option sort order | +
| string |
+ file_extension |
+ List of file extensions allowed to upload by the user on the frontend (optional; for the File input type) |
+
| string |
+ image_size_x |
+ Width limit for uploaded images (optional; for the File input type) |
+
| string |
+ image_size_y |
+ Height limit for uploaded images (optional; for the File input type) |
+
| string |
+ value_id |
+Value ID | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product with requested id does not exist. | +
| 102 | +Provided data is invalid. | +
| 103 | +Error while saving an option. Details are in the error message. | +
| 104 | +Store with requested code/id does not exist. | +
| 105 | +Option with requested id does not exist. | +
| 106 | +Invalid option type provided. Call 'types' to get list of allowed option types. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$selectOptionId = 1379;
+$selectOptionValueId = 794;
+$textOptionId = 1380;
+$fileOptionId = 1381;
+
+// Update custom option of Text Field type
+$customTextFieldOption = array(
+ "title" => "Custom Text Field Option Title Updated",
+ "type" => "field",
+ "is_require" => 1,
+ "sort_order" => 20,
+ "additional_fields" => array(
+ array(
+ "price" => 13.00,
+ "price_type" => "fixed",
+ "sku" => "custom_text_option_sku_updated",
+ "max_characters" => 127
+ )
+ )
+);
+$resultCustomTextFieldOptionUpdate = $proxy->call(
+ $sessionId,
+ "product_custom_option.update",
+ array(
+ $textOptionId,
+ $customTextFieldOption
+ )
+);
+
+// Update custom option of File type
+$customFileOption = array(
+ "title" => "Custom File Option Title Updated",
+ "additional_fields" => array(
+ array(
+ "image_size_x" => 800,
+ "image_size_y" => 999
+ )
+ )
+);
+$resultCustomFileOptionUpdate = $proxy->call(
+ $sessionId,
+ "product_custom_option.update",
+ array(
+ $fileOptionId,
+ $customFileOption
+ )
+);
+
+
+// Update custom option of Dropdown type
+$customDropdownOption = array(
+ "title" => "Custom Dropdown Option Title Updated to Multiselect",
+ "type" => "multiple",
+ "additional_fields" => array(
+ array(
+ "value_id" => $selectOptionValueId,
+ "price" => 14.00,
+ "price_type" => 'percent',
+ "sku" => "custom_select_option_sku_1 updated",
+ "sort_order" => 26
+ )
+ )
+);
+$resultCustomDropdownOptionUpdate = $proxy->call(
+ $sessionId,
+ "product_custom_option.update",
+ array(
+ $selectOptionId,
+ $customDropdownOption
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductCustomOptionUpdate($sessionId, '1', array(
+'title' => 'title_updated',
+'is_require' => 0,
+'sort_order' => '2'
+));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionUpdate((object)array('sessionId' => $sessionId->result, 'optionId' => '1', 'data' => ((object)array(
+'title' => 'title_updated',
+'is_require' => 0,
+'sort_order' => '2'
+))));
+var_dump($result->result);
+ Aliases: product_custom_option_value
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Option value with requested id does not exist. | +
| 102 | +Error while adding an option value. Details are in the error message. | +
| 103 | +Option with requested id does not exist. | +
| 104 | +Invalid option type. | +
| 105 | +Store with requested code/id does not exist. | +
| 106 | +Can not delete option. | +
| 107 | +Error while updating an option value. Details are in the error message. | +
| 108 | +Title field is required. | +
| 109 | +Option should have at least one value. Can not delete last value. | +
Allows you to add a new custom option value to a custom option. Note that the custom option value can be added only to the option with the Select Input Type.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + optionId |
+Option ID | +
| array | +data | +Array of catalogProductCustomOptionValueAdd | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the custom option value is added | +
The catalogProductCustomOptionValueAdd content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Custom option value title | +
| string |
+ price |
+Custom option value price | +
| string |
+ price_type |
+Type of the custom option value price. Can have one of the following values: "fixed" or "percent" | +
| string |
+ sku |
+Custom option value row SKU | +
| string |
+ sort_order |
+Custom option value sort order | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Option value with requested id does not exist. | +
| 102 | +Error while adding an option value. Details are in the error message. | +
| 104 | +Invalid option type. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$productOptionId = 1;// Existing product option ID
+
+// Add custom option value
+$customOptionValue = array(
+ "title" => "Some value text 1",
+ "price" => 10.00,
+ "price_type" => "fixed",
+ "sku" => "custom_text_option_sku",
+ "sort_order" => 0
+);
+$resultCustomOptionValueAdd = $proxy->call(
+ $sessionId,
+ "product_custom_option_value.add",
+ array(
+ $productOptionId,
+ array($customOptionValue)
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductCustomOptionValueAdd($sessionId, '10', array(array(
+'title' => 'value',
+'price' => '99.99',
+'price_type' => 'fixed',
+'sku' => 'sku',
+'sort_order' => '1'
+)));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueAdd((object)array('sessionId' => $sessionId->result, 'optionId' => '10', 'data' => array(array(
+'title' => 'value',
+'price' => '99.99',
+'price_type' => 'fixed',
+'sku' => 'sku',
+'sort_order' => '1'
+))));
+var_dump($result->result);
+ Allows you to retrieve full information about the specified product custom option value.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +valueId | +Value ID | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array |
+result | +Array of catalogProductCustomOptionValueInfoEntity | +
The catalogProductCustomOptionValueInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + value_id |
+ Option value ID |
+
| string |
+ option_id |
+Option ID | +
| string |
+ sku |
+ Custom option value row SKU |
+
| string |
+ sort_order |
+Option value sort order | +
| string |
+ default_price |
+ Option value default price |
+
| string |
+ default_price_type |
+ Default price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ store_price |
+ Option value store price |
+
| string |
+ store_price_type |
+ Store price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ price |
+Option value price | +
| string |
+ price_type |
+Price type. Possible values are as follows: "fixed" or "percent" | +
| string |
+ default_title |
+Option value default title | +
| string |
+ store_title |
+Option value store title | +
| string |
+ title |
+Option value title | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | + Option value with requested id does not exist. |
+
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option_value.info', '5');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionValueInfo($sessionId, '5');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueInfo((object)array('sessionId' => $sessionId->result, 'valueId' => '5'));
+
+var_dump($result->result);
+ array + 'option_id' => string '5' (length=1) + 'sku' => string 'slider' (length=6) + 'sort_order' => string '0' (length=1) + 'default_title' => string 'slider' (length=6) + 'store_title' => string 'slider' (length=6) + 'title' => string 'slider' (length=6) + 'default_price' => string '239.9900' (length=8) + 'default_price_type' => string 'fixed' (length=5) + 'store_price' => string '239.9900' (length=8) + 'store_price_type' => string 'fixed' (length=5) + 'price' => string '239.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'value_id' => string '2' (length=1)+
Allows you to retrieve the list of product custom option values. Note that the method is available only for the option Select Input Type.
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+optionId | +Option ID | +
| string | +store | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array |
+result | +Array of catalogProductCustomOptionValueList | +
The catalogProductCustomOptionValueListEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +value_id | +Custom option value ID | +
| string |
+ title |
+Custom option value title | +
| string |
+ price |
+ Option value price |
+
| string |
+ price_type |
+ Price type. Possible values: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option value SKU |
+
| string |
+ sort_order |
+ Option value sort order (optional) |
+
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Provided data is invalid. | +
| 102 | +Error while adding an option value. Details are in the error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_custom_option_value.list', '3');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionValueList($sessionId, '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueList((object)array('sessionId' => $sessionId->result, 'optionId' => '3'));
+
+var_dump($result->result);
+ array + 0 => + array + 'value_id' => string '1' (length=1) + 'title' => string 'monoblock' (length=9) + 'price' => string '139.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'sku' => string 'monoblock' (length=9) + 'sort_order' => string '0' (length=1) + 1 => + array + 'value_id' => string '2' (length=1) + 'title' => string 'slider' (length=6) + 'price' => string '239.9900' (length=8) + 'price_type' => string 'fixed' (length=5) + 'sku' => string 'slider' (length=6) + 'sort_order' => string '0' (length=1)+
Allows you to remove the custom option value from a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+valueId | +Custom option value ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the custom option value is removed | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 103 | +Option with requested id does not exist. | +
| 106 | +Can not delete option. | +
| 109 | +Option should have at least one value. Can not delete last value. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productOptionId = 4;// Existing option ID
+// Get last value from option values list
+$optionValues = $proxy->call($sessionId, "product_custom_option_value.list", array($productOptionId));
+$optionValue = reset($optionValues);
+$valueId = $optionValue['value_id'];
+
+$result = $proxy->call(
+ $sessionId,
+ "product_custom_option_value.remove",
+ array(
+ $valueId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductCustomOptionValueRemove($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueRemove((object)array('sessionId' => $sessionId->result, 'valueId' => '4'));
+var_dump($result->result);
+ Allows you to update the product custom option value.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+valueId | +Value ID | +
| array | +data | +Array of catalogProductCustomOptionValueUpdateEntity | +
| string | +storeId | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the custom option value is updated | +
The catalogProductCustomOptionValueUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Option value title | +
| string |
+ price |
+Option value price | +
| string |
+ price_type |
+ Price type. Possible values are as follows: "fixed" or "percent" |
+
| string |
+ sku |
+ Custom option value row SKU |
+
| string |
+ sort_order |
+Custom option value sort order | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Option value with requested id does not exist. | +
| 103 | +Option with requested id does not exist. | +
| 104 | +Invalid option type. | +
| 107 | +Error while updating an option value. Details are in the error message. | +
| 108 | +Title field is required. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productOptionId = 1;// Existing option ID
+
+// Get last value from option values list
+$optionValues = $proxy->call($sessionId, "product_custom_option_value.list", array($productOptionId));
+$optionValue = reset($optionValues);
+$valueId = $optionValue['value_id'];
+// Update custom option value
+$customOptionValue = array(
+ "title" => "new title",
+ "price" => 12.00,
+ "price_type" => "percent",
+ "sku" => "custom_text_option_2",
+ "sort_order" => 2
+);
+$resultCustomOptionValueUpdate = $proxy->call(
+ $sessionId,
+ "product_custom_option_value.update",
+ array(
+ $valueId,
+ $customOptionValue
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductCustomOptionValueUpdate($sessionId, '2', array(
+'title' => 'value',
+'price' => '20',
+'price_type' => 'fixed',
+'sku' => 'sku'
+));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductCustomOptionValueUpdate((object)array('sessionId' => $sessionId->result, 'valueId' => '2', 'data' => ((object)array(
+'title' => 'value',
+'sku' => 'sku',
+'price' => '199',
+'price_type' => 'percent'
+))));
+
+var_dump($result->result);
+ Allows you to add a new link to a downloadable product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + productId |
+Product ID | +
| array | + resource |
+Array of catalogProductDownloadableLinkAddEntity | +
| string | + resourceType |
+Resource type. Can have one of the following values: "sample" or "link". | +
| string | + store |
+Store view ID or code (optional) | +
| string | + identifierType |
+Type of the product identifier. Can have one of the following values: "sku" or "id". | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +Result of adding a link to the downloadable product | +
The catalogProductDownloadableLinkAddEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Link title | +
| string | + price |
+Custom option value row price | +
| int | + is_unlimited |
+Defines whether the number of downloads is unlimited | +
| int | + number_of_downloads |
+Maximum number of possible downloads | +
| int | + is_shareable |
+Defines whether the link is shareable | +
| array | + sample |
+Array of catalogProductDownloadableLinkAddSampleEntity | +
| string | + type |
+Type of the data source. Can have one of the following values: "file" or "url" | +
| array | + file |
+Array of catalogProductDownloadableLinkFileEntity | +
| string | + link_url |
+Link URL address | +
| string | + sample_url |
+Sample URL address | +
| int | + sort_order |
+Link sort order | +
The catalogProductDownloadableLinkAddSampleEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +type | + Type of the data source. Can have one of the following values: "file" or "url" |
+
| array | + file |
+Array of catalogProductDownloadableLinkFileEntity | +
| string | + url |
+URL to upload | +
The catalogProductDownloadableLinkFileEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + name |
+File name | +
| string | + base64_content |
+ BASE64 encoded file |
+
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 414 | + Unable to save action. Details in error message. |
+
| 415 | + Validation error has occurred. |
+
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$filesPath = '/var/www/ws/tests/WebService/etc/Modules/Downloadable/Product/Link';
+$downloadableProductId = 'downloadable_demo_product';
+
+$items = array(
+ 'small' => array(
+ 'link' => array(
+ 'title' => 'Test file',
+ 'price' => '123',
+ 'is_unlimited' => '1',
+ 'number_of_downloads' => '111',
+ 'is_shareable' => '0',
+ 'sample' => array(
+ 'type' => 'file',
+ 'file' =>
+ array(
+ 'filename' => 'files/test.txt',
+ ),
+ 'url' => 'http://www.magentocommerce.com/img/logo.gif',
+ ),
+ 'type' => 'file',
+ 'file' =>
+ array(
+ 'filename' => 'files/test.txt',
+ ),
+ 'link_url' => 'http://www.magentocommerce.com/img/logo.gif',
+ ),
+ 'sample' => array(
+ 'title' => 'Test sample file',
+ 'type' => 'file',
+ 'file' => array(
+ 'filename' => 'files/image.jpg',
+ ),
+ 'sample_url' => 'http://www.magentocommerce.com/img/logo.gif',
+ 'sort_order' => '3',
+ )
+ ),
+ 'big' => array(
+ 'link' => array(
+ 'title' => 'Test url',
+ 'price' => '123',
+ 'is_unlimited' => '0',
+ 'number_of_downloads' => '111',
+ 'is_shareable' => '1',
+ 'sample' => array(
+ 'type' => 'url',
+ 'file' => array(
+ 'filename' => 'files/book.pdf',
+ ),
+ 'url' => 'http://www.magentocommerce.com/img/logo.gif',
+ ),
+ 'type' => 'url',
+ 'file' => array(
+ 'filename' => 'files/song.mp3',
+ ),
+ 'link_url' => 'http://www.magentocommerce.com/img/logo.gif',
+ ),
+ 'sample' => array(
+ 'title' => 'Test sample url',
+ 'type' => 'url',
+ 'file' => array(
+ 'filename' => 'files/image.jpg',
+ ),
+ 'sample_url' => 'http://www.magentocommerce.com/img/logo.gif',
+ 'sort_order' => '3',
+ )
+ )
+);
+
+$result = true;
+foreach ($items as $item) {
+ foreach ($item as $key => $value) {
+ if ($value['type'] == 'file') {
+ $filePath = $filesPath . '/' . $value['file']['filename'];
+ $value['file'] = array('name' => str_replace('/', '_', $value['file']['filename']), 'base64_content' => base64_encode(file_get_contents($filePath)), 'type' => $value['type']);
+ }
+ if ($value['sample']['type'] == 'file') {
+ $filePath = $filesPath . '/' . $value['sample']['file']['filename'];
+ $value['sample']['file'] = array('name' => str_replace('/', '_', $value['sample']['file']['filename']), 'base64_content' => base64_encode(file_get_contents($filePath)));
+ }
+ if (!$proxy->call(
+ $sessionId,
+ 'product_downloadable_link.add',
+ array($downloadableProductId, $value, $key)
+ )
+ ) {
+ $result = false;
+ }
+ }
+}
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDownloadableLinkAdd((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'resourceType' => 'link', 'resource' => ((object)array(
+'title' => 'link',
+'price' => '10.99',
+'sample' => array(
+'type' => 'url',
+'url' => 'http://sometesturl.com')
+))));
+
+var_dump($result->result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDownloadableLinkAdd((object)array('sessionId' => $sessionId->result, 'productId' => '3', 'resourceType' => 'link', 'resource' => ((object)array(
+'title' => 'link_2',
+'price' => '11.99',
+'type' => 'file',
+'file' => array(
+'name' => 'file_test',
+'base64_content' => '/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAIBAQIBAQICAgICAgICAwUDAwMDAwYEBAMFBwYHBwcGBwcICQsJCAgKCAcHCg0KCgsMDAwMBwkODw0MDgsMDAz/2wBDAQICAgMDAwYDAwYMCAcIDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAwMDAz/wAARCAAXABcDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwDLooor8XP4DCiiigAooooAKKKKAP/Z'
+)
+))));
+
+var_dump($result->result);
+ Allows you to retrieve a list of links of a downloadable product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +productId | +Product ID or SKU | +
| string | +store | +Store view ID or code (optional) | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the request | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductDownloadableLinkListEntity | +
The catalogProductDownloadableLinkListEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +links | +Array of catalogProductDownloadableLinkEntity | +
| array | +samples | +Array of catalogProductDownloadableLinkSampleEntity | +
The catalogProductDownloadableLinkEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + link_id |
+Link ID | +
| string | + title |
+Link title | +
| string | + price |
+ Downloadable link price value |
+
| int | + number_of_downloads |
+Maximum number of possible downloads | +
| int | + is_unlimited |
+Defines whether the number of downloads is unlimited | +
| int | + is_shareable |
+Defines whether the link is shareable | +
| string | + link_url |
+Link URL address | +
| string | + link_type |
+ Type of the link data source. Can have one of the following values: "file" or "url" |
+
| string | + sample_file |
+Sample file name | +
| string | + sample_url |
+Sample URL | +
| string | + sample_type |
+ Type of sample data source. Can have one of the following values: "file" or "url" |
+
| int | + sort_order |
+Link sort order | +
| array | + file_save |
+Array of catalogProductDownloadableLinkFileInfoEntity | +
| array | + sample_file_save |
+Array of catalogProductDownloadableLinkFileInfoEntity | +
The catalogProductDownloadableLinkSampleEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sample_id |
+Sample ID | +
| string |
+ product_id |
+Product ID | +
| string |
+ sample_file |
+Sample file name | +
| string |
+ sample_url |
+Sample URL | +
| string |
+ sample_type |
+Sample type. Can have one of the following values: "file" or "url" | +
| string |
+ sort_order |
+Sort order | +
| string |
+ default_title |
+Default title | +
| string |
+ store_title |
+Store title | +
| string |
+ title |
+Sample title | +
The catalogProductDownloadableLinkFileInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + file |
+File | +
| string | + name |
+File name | +
| int | + size |
+File size | +
| string | + status |
+Status | +
Faults:
+No Faults
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$downloadableProductId = '5';
+
+$resultList = $proxy->call(
+ $sessionId,
+ 'product_downloadable_link.list',
+ array($downloadableProductId)
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductDownloadableLinkList($sessionId, '5', null, 'sku');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDownloadableLinkList((object)array('sessionId' => $sessionId->result, 'productId' => '5'));
+
+var_dump($result->result);
+ array + 'links' => + array + 0 => + array + 'link_id' => string '1' (length=1) + 'title' => string 'link 1' (length=11) + 'price' => string '30.0000' (length=7) + 'number_of_downloads' => string '0' (length=1) + 'is_shareable' => string '1' (length=1) + 'link_url' => null + 'link_type' => string 'file' (length=4) + 'sample_file' => string '/s/o/software.jpg' (length=17) + 'sample_url' => null + 'sample_type' => string 'file' (length=4) + 'sort_order' => string '1' (length=1) + 'file_save' => + array + ... + 'sample_file_save' => + array + ... + 'is_unlimited' => int 1 + 'samples' => + array + 0 => + array + 'sample_id' => string '1' (length=1) + 'product_id' => string '5' (length=1) + 'sample_url' => null + 'sample_file' => string '/s/o/software.jpg' (length=17) + 'sample_type' => string 'file' (length=4) + 'sort_order' => string '2' (length=1) + 'default_title' => string 'Sample 1' (length=8) + 'store_title' => string 'Sample 1' (length=8) + 'title' => string 'Sample 1' (length=8)+
Allows you to remove a link/sample from a downloadable product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +linkId/sampleId | +Link/sample ID | +
| string | +resourceType | +Resource type. Can have one of the following values: 'sample' or 'link' | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the link/sample is removed from a downloadable product | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 412 | + Link or sample with specified ID was not found. |
+
| 415 | + Validation error has occurred. |
+
| 416 | + Unable to remove link. Details in error message. |
+
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$sampleId = 7;
+$linkId = 9;
+
+$resultSample = $proxy->call(
+Â Â $sessionId,
+Â Â 'product_downloadable_link.remove',
+Â Â array($sampleId, 'sample')
+);
+
+$resultLink = $proxy->call(
+Â Â $sessionId,
+Â Â 'product_downloadable_link.remove',
+Â Â array($linkId, 'link')
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductDownloadableLinkRemove($sessionId, '7', 'sample');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductDownloadableLinkRemove((object)array('sessionId' => $sessionId->result, 'linkId' => '7', 'resourceType' => 'sample'));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to manage links for products, including related, cross-sells, up-sells, and grouped.
+ +Resource Name: catalog_product_link
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Given invalid link type. | +
| 101 | +Product not exists. | +
| 102 | +Invalid data given. Details in error message. | +
| 104 | +Product link not removed. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Get list of related products
+var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
+
+// Assign related product
+$proxy->call($sessionId, 'product_link.assign', array('related', 'Sku', 'Sku2', array('position'=>0, 'qty'=>56)));
+
+var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
+
+// Update related product
+$proxy->call($sessionId, 'product_link.update', array('related', 'Sku', 'Sku2', array('position'=>2)));
+
+var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
+
+// Remove related product
+$proxy->call($sessionId, 'product_link.remove', array('related', 'Sku', 'Sku2'));
+
+var_dump($proxy->call($sessionId, 'product_link.list', array('related', 'Sku')));
+ Aliases:
+Allows you to assign a product link (cross_sell, grouped, related, or up_sell) to another product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+ type |
+Type of the link (cross_sell, grouped, related, or up_sell) | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ linkedProduct\linkedProductId |
+Product ID or SKU for the link | +
| array | + data |
+Array of catalogProductLinkEntity | +
| string |
+ identifierType |
+Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the link is assigned to the product | +
The catalogProductLinkEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ type |
+Type of the link (cross_sell, grouped, related, or up_sell) | +
| string |
+ set |
+Product attribute set | +
| string |
+ sku |
+Product SKU | +
| string |
+ position |
+Position of the product | +
| string |
+ qty |
+Quantity of products | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apikey');
+
+$result = $client->call($session, 'catalog_product_link.assign', array('type' => 'related', 'product' => '1', 'linkedProduct' => '4'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkAssign($sessionId, 'related', '1', '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkAssign((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1', 'linkedProductId' => '4'));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the product link type attributes.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + type |
+Type of the link (cross_sell, up_sell, related, or grouped) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductLinkAttributeEntity | +
The catalogProductLinkAttributeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +code | +Attribute code | +
| string | +type | +Attribute type | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_link.attributes', 'related');
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkAttributes($sessionId, 'related');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkAttributes((object)array('sessionId' => $sessionId->result, 'type' => 'related'));
+
+var_dump($result->result);
+ array + 0 => + array + 'code' => string 'position' (length=8) + 'type' => string 'int' (length=3)+
Aliases:
+Allows you to retrieve the list of linked products for a specific product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + type |
+Type of the link (cross_sell, up_sell, related, or grouped) | +
| string | + product\productId |
+Product ID or SKU | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductLinkEntity | +
The catalogProductLinkEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ type |
+Type of the link | +
| string |
+ set |
+Product attribute set | +
| string |
+ sku |
+Product SKU | +
| string |
+ position |
+Position | +
| string |
+ qty |
+Quantity | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_link.list', array('type' => 'related', 'product' => '1'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkList($sessionId, 'related', '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkList((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1'));
+
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '3' (length=1) + 'type' => string 'simple' (length=6) + 'set' => string '4' (length=1) + 'sku' => string 'canonxt' (length=7) + 'position' => string '1' (length=1) + 1 => + array + 'product_id' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'set' => string '4' (length=1) + 'sku' => string 'canon_powershot' (length=15) + 'position' => string '0' (length=1)+
Aliases:
+Allows you to remove the product link from a specific product.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ type |
+Type of the link (cross_sell, up_sell, related, or grouped) | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ linkedProduct\linkedProductId |
+Product ID or SKU for the link | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the link is removed from a product | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_link.remove', array('type' => 'related', 'product' => '1', 'linkedProduct' => '4'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkRemove($sessionId, 'related', '1', '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkRemove((object)array('sessionId' => $sessionId->result, 'type' => 'related', 'productId' => '1', 'linkedProductId' => '4'));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of product link types.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| ArrayOfString | +result | +Array of link types | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'product_link.types');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductLinkTypes($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkTypes((object)array('sessionId' => $sessionId->result));
+
+var_dump($result->result);
+ array + 0 => string 'related' (length=7) + 1 => string 'up_sell' (length=7) + 2 => string 'cross_sell' (length=10) + 3 => string 'grouped' (length=7)+
Aliases:
+Allows you to update the product link.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string |
+ type |
+Type of the link (cross_sell, grouped, related, or up_sell) | +
| string |
+ product\productId |
+Product ID or SKU | +
| string |
+ linkedProduct\linkedProductId |
+Product ID or SKU for the link | +
| array | + data |
+Array of catalogProductLinkEntity | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean\int | +result | +True (1) if the link is updated | +
The catalogProductLinkEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string |
+ type |
+Type of the link | +
| string |
+ set |
+Product attribute set | +
| string |
+ sku |
+Product SKU | +
| string |
+ position |
+Position | +
| string |
+ qty |
+Quantity | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = '1';
+$linkedProductId = '2';
+$data = array(
+ 'position' => '50'
+);
+
+$result = $proxy->call(
+ $session,
+ 'catalog_product_link.update',
+ array(
+ 'cross_sell',
+ $productId,
+ $linkedProductId,
+ $data
+ )
+);
+ <?php
+
+$client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$session = $client->login('apiUser', 'apiKey');
+
+$data = array(
+ "position" => 15
+ );
+
+$identifierType = "product_id";
+$type = "related";
+$product = "1";
+$linkedProduct = "3";
+
+$orders = $client->catalogProductLinkUpdate($session, $type, $product, $linkedProduct, $data, $identifierType);
+
+echo 'Number of results: ' . count($orders) . '<br/>';
+var_dump ($orders);
+?>
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductLinkUpdate((object)array('sessionId' => $sessionId->result, 'type' => 'cross_sell', 'productId' => '1', 'linkedProductId' => '2', 'data' => ((object)array(
+'position' => '1'
+))));
+
+var_dump($result->result);
+ Allows you to operate with product tags.
+ + +Aliases: product_tag
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 102 | +Requested product does not exist. | +
| 103 | +Requested customer does not exist. | +
| 104 | +Requested tag does not exist. | +
| 105 | +Provided data is invalid. | +
| 106 | +Error while saving tag. Details in error message. | +
| 107 | +Error while removing tag. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$productId = 2;
+$customerId = 10002;
+$store = 'default';
+
+// Add tags
+$data = array('product_id' => $productId, 'store' => $store, 'customer_id' => $customerId, 'tag' => "First 'Second tag' Third");
+echo "Adding Tag... ";
+$addResult = $proxy->call(
+ $sessionId,
+ "product_tag.add",
+ array($data)
+);
+echo ((count($addResult) == 3) ? "Done!" : "Fail!");
+echo "<br />";
+print_r($addResult);
+$tagId = reset($addResult);
+
+// Get tag info
+echo "<br />Get Tag Info (id = $tagId)... ";
+$infoResult = $proxy->call(
+ $sessionId,
+ "product_tag.info",
+ array($tagId, $store)
+);
+echo "Done!<br />";
+print_r($infoResult);
+
+// Update tag data
+$data = array('status' => -1, 'base_popularity' => 12, 'name' => 'Changed name');
+echo "<br />Update Tag (id = $tagId)... ";
+$updateResult = $proxy->call(
+ $sessionId,
+ "product_tag.update",
+ array($tagId, $data, $store)
+);
+echo ($updateResult ? "Done!" : "Fail!");
+
+// Retrieve list of tags by product
+echo "<br />Tag list for product with id = $productId... ";
+$listResult = $proxy->call(
+ $sessionId,
+ "product_tag.list",
+ array($productId, $store)
+);
+echo (count($listResult) ? "Done!" : "Fail!");
+echo "<br />";
+print_r($listResult);
+
+// Remove existing tag
+echo "<br />Remove Tag (id = $tagId)... ";
+$removeResult = $proxy->call(
+ $sessionId,
+ "product_tag.remove",
+ array($tagId)
+);
+echo ($removeResult ? "Done!" : "Fail!");
+ Aliases: product_tag
+ + +Allows you to add one or more tags to a product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +data | +Array of catalogProductTagAddEntity | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Associative array of added tags with the tag name as a key and the tag ID as a value | +
The catalogProductTagAddEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + tag |
+ Tag to be added (can contain several tags separated with white spaces). A tag that contains several words should be enclosed in single quotes. |
+
| string |
+ product_id |
+Product ID | +
| string |
+ customer_id |
+Customer ID | +
| string |
+ store |
+Store ID | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 102 | +Requested product does not exist. | +
| 103 | +Requested customer does not exist. | +
| 105 | +Provided data is invalid. | +
| 106 | +Error while saving tag. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$data = array('product_id' => 2, 'store' => 'default', 'customer_id' => 10002, 'tag' => "First 'Second tag' Third");
+echo "Adding Tag... ";
+$addResult = $proxy->call(
+ $sessionId,
+ "product_tag.add",
+ array($data)
+);
+echo ((count($addResult) == 3) ? "Done!" : "Fail!");
+echo "<br />";
+print_r($addResult);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->catalogProductTagAdd($sessionId, array(
+'tag' => 'album',
+'product_id' => '3',
+'customer_id' => '1',
+'store' => '0'
+));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagAdd((object)array('sessionId' => $sessionId->result, 'data' => ((object)array(
+'tag' => 'album',
+'product_id' => '3',
+'customer_id' => '1',
+'store' => '0'
+))));
+var_dump($result->result);
+ Aliases: product_tag
+ + +Allows you to retrieve information about the required product tag.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +tagId | +Tag ID | +
| string | +store | +Store view code or ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductTagInfoEntity | +
The catalogProductTagInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +name | +Tag name | +
| string | +status | +Tag status | +
| string | +base_popularity | +Tag base popularity for a specific store | +
| associativeArray | +products | +Associative array of tagged products with related product ID as a key and popularity as a value | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 104 | +Requested tag does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_tag.info', array('tagId' => '4', 'store' => '2'));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductTagInfo($sessionId, '4', '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagInfo((object)array('sessionId' => $sessionId->result, 'tagId' => '4', 'store' => '2'));
+var_dump($result->result);
+ array + 'status' => string '1' (length=1) + 'name' => string 'digital' (length=7) + 'base_popularity' => int 0 + 'products' => + array + 1 => string '1' (length=1) + 3 => string '1' (length=1) + 4 => string '1' (length=1)+
Aliases: product_tag
+ + +Allows you to retrieve the list of tags for a specific product.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +productId | +Product ID | +
| string | +store | +Store view code or ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductTagListEntity | +
The catalogProductTagListEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + tag_id |
+Tag ID | +
| string | + name |
+Tag name | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 102 | +Requested product does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_tag.list', array('productId' => '4', 'store' => '2'));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductTagList($sessionId, '4', '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagList((object)array('sessionId' => $sessionId->result, 'productId' => '4', 'store' => '2'));
+var_dump($result->result);
+ array + 3 => + array + 'tag_id' => string '3' (length=1) + 'name' => string 'canon' (length=5) + 4 => + array + 'tag_id' => string '4' (length=1) + 'name' => string 'digital' (length=7)+
Aliases: product_tag
+ + +Allows you to remove an existing product tag.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +tagId | +Tag ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the product tag is removed | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 104 | +Requested tag does not exist. | +
| 107 | +Error while removing tag. Details in error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_tag.remove', '3');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductTagRemove($sessionId, '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagRemove((object)array('sessionId' => $sessionId->result, 'tagId' => '3'));
+var_dump($result->result);
+ Aliases: product_tag
+ + +Allows you to update information about an existing product tag.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +tagId | +ID of the tag to be updated | +
| array | +data | +Array of catalogProductTagUpdateEntity | +
| string | +store | +Store view code or ID (optional; required for WS-I compliance mode) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product tag is updated | +
The catalogProductTagUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + name |
+Tag name | +
| string |
+ status |
+Tag status. Can have the following values: -1 - Disabled, 0 - Pending, 1- Approved | +
| string |
+ base_popularity |
+Tag base popularity | +
Faults:
+ +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store does not exist. | +
| 104 | +Requested tag does not exist. | +
| 105 | +Provided data is invalid. | +
| 106 | +Error while saving tag. Details in error message. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_tag.update', array('tagId' => '4', 'data' => array('name' => 'digital_1')));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+
+$sessionId = $proxy->login('apiUser', 'apiKey');Â
+Â
+$result = $proxy->catalogProductTagUpdate($sessionId, '1', array(
+'name' => 'tag',
+'status' => '1'
+)); Â Â
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTagUpdate((object)array('sessionId' => $sessionId->result, 'tagId' => '1', 'store' => '0', 'data' => ((object)array(
+'name' => 'tag',
+'status' => '1',
+'base_popularity' => null
+))));
+var_dump($result->result);
+ The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve and update product tier prices.
+ +Resource Name: catalog_product_attribute_tier_price
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Product not exists. | +
| 101 | +Invalid data given. Details in error message. | +
| 102 | +Tier prices not updated. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Get tier prices
+$tierPrices = $proxy->call($sessionId, 'product_tier_price.info', 'Sku');
+
+var_dump($tierPrices);
+
+// Add new
+$tierPrices[] = array(
+ 'website' => 'all',
+ 'customer_group_id' => 'all',
+ 'qty' => 68,
+ 'price' => 18.20
+);
+
+// Update tier prices
+$proxy->call($sessionId, 'product_tier_price.update', array('Sku', $tierPrices));
+
+// Compare values
+var_dump($proxy->call($sessionId, 'product_tier_price.info', 'Sku'));
+
+var_dump($tierPrices);
+ Aliases:
+Allows you to retrieve information about product tier prices.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + product\productId |
+Product ID or SKU | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductTierPriceEntity | +
The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+Customer group ID | +
| string | + website |
+Website | +
| int | + qty |
+Quantity of items to which the price will be applied | +
| double | + price |
+Price that each item will cost | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_attribute_tier_price.info', 'productId');
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$productId = 1;
+
+$result = $client->catalogProductAttributeTierPriceInfo(
+ $session,
+ $productId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductAttributeTierPriceInfo((object)array('sessionId' => $sessionId->result, 'productId' => '1'));
+
+var_dump($result->result);
+ array + 0 => + array + 'customer_group_id' => string '1' (length=1) + 'website' => string 'all' (length=3) + 'qty' => string '2.0000' (length=6) + 'price' => string '129.9900' (length=8)+
array + 0 => + object(stdClass)[2] + public 'customer_group_id' => string '0' (length=1) + public 'website' => string 'all' (length=3) + public 'qty' => int 5 + public 'price' => float 99 + 1 => + object(stdClass)[3] + public 'customer_group_id' => string '0' (length=1) + public 'website' => string 'all' (length=3) + public 'qty' => int 10 + public 'price' => float 98+
Aliases:
+Allows you to update the product tier prices.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + product\productId |
+Product ID or SKU | +
| array | + tierPrices |
+Array of catalogProductTierPriceEntity | +
| string | +identifierType | +Defines whether the product ID or SKU is passed in the 'product' parameter | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean\int | +result | +True (1) if the product tier price is updated | +
The catalogProductTierPriceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + customer_group_id |
+Customer group ID | +
| string | + website |
+Website | +
| int | + qty |
+Quantity of items to which the price will be applied | +
| double | + price |
+Price that each item will cost | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$productId = 1;
+$tierPrices = array(
+ array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
+);
+
+$result = $proxy->call(
+ $sessionId,
+ 'product_attribute_tier_price.update',
+ array(
+ $productId,
+ $tierPrices
+ )
+);
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+
+$productId = 1;
+$tierPrices = array(
+ array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
+);
+
+$result = $proxy->catalogProductAttributeTierPriceUpdate(
+ $sessionId,
+ $productId,
+ $tierPrices
+);
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+
+$productId = 1;
+$tierPrices = array(
+ array('customer_group_id' => '0', 'website' => '0', 'qty' => '50', 'price' => '9.90')
+);
+
+$result = $proxy->catalogProductAttributeTierPriceUpdate((object)array(
+'sessionId' => $sessionId->result,
+'productId' => $productId,
+'tierPrices' => $tierPrices
+));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of product types.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogProductTypeEntity | +
The catalogProductTypeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +type | +Product type | +
| string | +label | +Product label in the Admin Panel | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'catalog_product_type.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogProductTypeList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogProductTypeList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'type' => string 'simple' (length=6) + 'label' => string 'Simple Product' (length=14) + 1 => + array + 'type' => string 'grouped' (length=7) + 'label' => string 'Grouped Product' (length=15) + 2 => + array + 'type' => string 'configurable' (length=12) + 'label' => string 'Configurable Product' (length=20) + 3 => + array + 'type' => string 'virtual' (length=7) + 'label' => string 'Virtual Product' (length=15) + 4 => + array + 'type' => string 'bundle' (length=6) + 'label' => string 'Bundle Product' (length=14) + 5 => + array + 'type' => string 'downloadable' (length=12) + 'label' => string 'Downloadable Product' (length=20)+
The Mage_Catalog module allows you to manage categories and products.
+ +Allows you to retrieve product types.
+ +Resource Name: catalog_product_type
+ +Aliases:
+Methods:
+$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$types = $proxy->call($sessionId, 'product_type.list');
+
+var_dump($types);
+ The Mage_CatalogInventory module allows you to retrieve and update stock attributes, such as status and quantity.
+ +Allows you to retrieve and update the stock data.
+ +Resource Name: cataloginventory_stock_item
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 101 | +Product not exists. | +
| 102 | +Product inventory not updated. Details in error message. | +
Change manage_stock setting to ‘off’ in the inventory area.
+ +$attributeSets = $client->call($session, ‘product_stock.update’, array(’SKU’,array(’manage_stock’=>'0’,’use_config_manage_stock’=>'0’)));
+ +The use_config_manage_stock unchecks the ‘Use Config Settings’ box which allows you to make changes to this product and not to use the global settings that are set by default.
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Get stock info
+var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
+
+// Update stock info
+$proxy->call($sessionId, 'product_stock.update', array('Sku', array('qty'=>50, 'is_in_stock'=>1)));
+
+var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
+ $client = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sid = $client->login('apiUser', 'apiKey');
+
+print_r(
+ $client->call(
+ $sid,
+ 'product_stock.list',
+ array(
+ array( // Notice the nested array
+ 'sku1',
+ 'sku2',
+ 'sku3',
+ ...
+ 'skuN'
+ )
+ )
+ )
+);
+ Aliases:
+Allows you to retrieve the list of stock data by product IDs.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| ArrayOfString |
+ products/productIds (for WS-I mode) |
+List of product IDs or SKUs | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of catalogInventoryStockItemEntity | +
The catalogInventoryStockItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+Product ID | +
| string | + sku |
+Product SKU | +
| string | + qty |
+Product quantity | +
| string | + is_in_stock |
+Defines whether the product is in stock | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cataloginventory_stock_item.list', '1');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->catalogInventoryStockItemList($sessionId, array('1', '2'));
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogInventoryStockItemList((object)array('sessionId' => $sessionId->result, 'productIds' => array(1,2)));
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '1' (length=1) + 'sku' => string 'n2610' (length=5) + 'qty' => string '98.0000' (length=7) + 'is_in_stock' => string '1' (length=1)+
Aliases:
+Allows you to update the required product stock data.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + product\productId |
+Product ID or SKU | +
| array | + data |
+Array of catalogInventoryStockItemUpdateEntity | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +Result of stock item updating | +
The catalogInventoryStockItemUpdateEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + qty |
+Quantity of items to be updated | +
| int | + is_in_stock |
+Defines whether the item is in stock | +
| int |
+ manage_stock |
+Manage stock flag | +
| int |
+ use_config_manage_stock |
+Use config manage stock | +
| int |
+ min_qty |
+Minimum quantity for items to be in stock | +
| int |
+ use_config_min_qty |
+Use config settings flag (value defined in the Inventory System Configuration) | +
| int |
+ min_sale_qty |
+Minimum quantity allowed in the shopping cart | +
| int |
+ use_config_min_sale_qty |
+Use config settings flag | +
| int |
+ max_sale_qty |
+Maximum quantity allowed in the shopping cart | +
| int |
+ use_config_max_sale_qty |
+Use config settings flag | +
| int |
+ is_qty_decimal |
+Defines whether the quantity is decimal | +
| int |
+ backorders |
+Backorders status | +
| int |
+ use_config_backorders |
+Use config settings flag (for backorders) | +
| int |
+ notify_stock_qty |
+Stock quantity below which a notification will appear | +
| int |
+ use_config_notify_stock_qty |
+Use config settings flag (for stock quantity) | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$productId = '1';
+$stockItemData = array(
+ 'qty' => '100',
+ 'is_in_stock ' => 1,
+ 'manage_stock ' => 1,
+ 'use_config_manage_stock' => 0,
+ 'min_qty' => 2,
+ 'use_config_min_qty ' => 0,
+ 'min_sale_qty' => 1,
+ 'use_config_min_sale_qty' => 0,
+ 'max_sale_qty' => 10,
+ 'use_config_max_sale_qty' => 0,
+ 'is_qty_decimal' => 0,
+ 'backorders' => 1,
+ 'use_config_backorders' => 0,
+ 'notify_stock_qty' => 10,
+ 'use_config_notify_stock_qty' => 0
+);
+
+$result = $client->call(
+ $session,
+ 'product_stock.update',
+ array(
+ $productId,
+ $stockItemData
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+Â
+$result = $proxy->catalogInventoryStockItemUpdate($sessionId, 1, array(
+'qty' => '49',
+'is_in_stock' => 1
+));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->catalogInventoryStockItemUpdate((object)array('sessionId' => $sessionId->result, 'productId' => '1', 'data' => array(
+'qty' => '49',
+'is_in_stock' => 1
+)));
+
+var_dump($result->result);
+ Allows you to create an empty shopping cart.
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + storeId |
+Store view ID or code (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| int | +ID of the created empty shopping cart | +
Faults:
+No Faults
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCreate($sessionId, '3');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCreate((object)array('sessionId' => $sessionId->result, 'store' => '3'));
+
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to manage shopping carts.
+ +Resource Name: cart
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1003 | +Can not create a quote. | +
| 1004 | +Can not create a quote because quote with such identifier is already exists | +
| 1005 | +You did not set all required agreements | +
| 1006 | +The checkout type is not valid. Select single checkout type. | +
| 1007 | +Checkout is not available for guest | +
| 1008 | +Can not create an order. | +
The following example illustrates the work with shopping cart (creation of a shopping cart, setting customer and customer addresses, adding products to the shopping cart, updating products in the shopping cart, removing products from the shopping cart, getting the list of products/shipping methods/payment methods, setting payment/shipping methods, adding/removing coupon, getting total prices/full information about shopping cart/list of licenses, and creating an order.
+$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Create a quote, get quote identifier
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+// Set customer, for example guest
+$customerAsGuest = array(
+ "firstname" => "testFirstname",
+ "lastname" => "testLastName",
+ "email" => "testEmail",
+ "website_id" => "0",
+ "store_id" => "0",
+ "mode" => "guest"
+);
+$resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customerAsGuest) );
+
+// Set customer addresses, for example guest's addresses
+$arrAddresses = array(
+ array(
+ "mode" => "shipping",
+ "firstname" => "testFirstname",
+ "lastname" => "testLastname",
+ "company" => "testCompany",
+ "street" => "testStreet",
+ "city" => "testCity",
+ "region" => "testRegion",
+ "postcode" => "testPostcode",
+ "country_id" => "id",
+ "telephone" => "0123456789",
+ "fax" => "0123456789",
+ "is_default_shipping" => 0,
+ "is_default_billing" => 0
+ ),
+ array(
+ "mode" => "billing",
+ "firstname" => "testFirstname",
+ "lastname" => "testLastname",
+ "company" => "testCompany",
+ "street" => "testStreet",
+ "city" => "testCity",
+ "region" => "testRegion",
+ "postcode" => "testPostcode",
+ "country_id" => "id",
+ "telephone" => "0123456789",
+ "fax" => "0123456789",
+ "is_default_shipping" => 0,
+ "is_default_billing" => 0
+ )
+);
+$resultCustomerAddresses = $proxy->call($sessionId, "cart_customer.addresses", array($shoppingCartId, $arrAddresses));
+
+// add products into shopping cart
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call($sessionId, "cart_product.add", array($shoppingCartId, $arrProducts));
+
+// update product in shopping cart
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 5
+ ),
+);
+$resultCartProductUpdate = $proxy->call($sessionId, "cart_product.update", array($shoppingCartId, $arrProducts));
+
+// remove products from shopping cart, for example by SKU
+$arrProducts = array(
+ array(
+ "sku" => "testSKU"
+ ),
+);
+$resultCartProductRemove = $proxy->call($sessionId, "cart_product.remove", array($shoppingCartId, $arrProducts));
+
+// get list of products
+$shoppingCartProducts = $proxy->call($sessionId, "cart_product.list", array($shoppingCartId));
+print_r( $shoppingCartProducts );
+
+// get list of shipping methods
+$resultShippingMethods = $proxy->call($sessionId, "cart_shipping.list", array($shoppingCartId));
+print_r( $resultShippingMethods );
+
+// set shipping method
+$randShippingMethodIndex = rand(1, count($resultShippingMethods) );
+$shippingMethod = $resultShippingMethods[$randShippingMethodIndex]["code"];
+
+$resultShippingMethod = $proxy->call($sessionId, "cart_shipping.method", array($shoppingCartId, $shippingMethod));
+
+// get list of payment methods
+$resultPaymentMethods = $proxy->call($sessionId, "cart_payment.list", array($shoppingCartId));
+print_r($resultPaymentMethods);
+
+// set payment method
+$paymentMethod = array(
+ "method" => "checkmo"
+);
+$resultPaymentMethod = $proxy->call($sessionId, "cart_payment.method", array($shoppingCartId, $paymentMethod));
+
+// add coupon
+$couponCode = "aCouponCode";
+$resultCartCouponRemove = $proxy->call($sessionId, "cart_coupon.add", array($shoppingCartId, $couponCode));
+
+// remove coupon
+$resultCartCouponRemove = $proxy->call($sessionId, "cart_coupon.remove", array($shoppingCartId));
+
+// get total prices
+$shoppingCartTotals = $proxy->call($sessionId, "cart.totals", array($shoppingCartId));
+print_r( $shoppingCartTotals );
+
+// get full information about shopping cart
+$shoppingCartInfo = $proxy->call($sessionId, "cart.info", array($shoppingCartId));
+print_r( $shoppingCartInfo );
+
+// get list of licenses
+$shoppingCartLicenses = $proxy->call($sessionId, "cart.licenseAgreement", array($shoppingCartId));
+print_r( $shoppingCartLicences );
+
+// check if license is existed
+$licenseForOrderCreation = null;
+if (count($shoppingCartLicenses)) {
+ $licenseForOrderCreation = array();
+ foreach ($shoppingCartLicenses as $license) {
+ $licenseForOrderCreation[] = $license['agreement_id'];
+ }
+}
+
+// create order
+$resultOrderCreation = $proxy->call($sessionId,"cart.order",array($shoppingCartId, null, $licenseForOrderCreation));
+ Allows you to retrieve full information about the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | +quoteId | +Shopping cart ID (quote ID) | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartInfoEntity | +
The shoppingCartInfoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + store_id |
+Store ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ converted_at |
+Date of conversion | +
| int | + quote_id |
+Quote ID | +
| int | + is_active |
+Active flag | +
| int | + is_virtual |
+Defines whether the product is a virtual one | +
| int | + is_multi_shipping |
+Defines whether multi shipping is available | +
| double | + items_count |
+Items quantity | +
| double | + items_qty |
+Total items quantity | +
| string |
+ orig_order_id |
+Original order ID | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ store_to_quote_rate |
+Store to quote rate | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ quote_currency_code |
+Quote currency code | +
| string |
+ grand_total |
+Grand total | +
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ checkout_method |
+Checkout method | +
| string |
+ customer_id |
+Customer ID | +
| string |
+ customer_tax_class_id |
+Customer tax class ID | +
| int | + customer_group_id |
+Customer group ID | +
| string |
+ customer_email |
+Customer email address | +
| string |
+ customer_prefix |
+Customer prefix | +
| string |
+ customer_firstname |
+Customer first name | +
| string |
+ customer_middlename |
+Customer middle name | +
| string |
+ customer_lastname |
+Customer last name | +
| string |
+ customer_suffix |
+Customer suffix | +
| string |
+ customer_note |
+Customer note | +
| string |
+ customer_note_notify |
+Customer notification flag | +
| string |
+ customer_is_guest |
+Defines whether the customer is a guest | +
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ reserved_order_id |
+Reserved order ID | +
| string |
+ password_hash |
+Password hash | +
| string |
+ coupon_code |
+Coupon code | +
| string |
+ global_currency_code |
+Global currency code | +
| double | + base_to_global_rate |
+Base to global rate | +
| double | + base_to_quote_rate |
+Base to quote rate | +
| string |
+ customer_taxvat |
+Customer taxvat value | +
| string |
+ customer_gender |
+Customer gender | +
| double | + subtotal |
+Subtotal | +
| double | + base_subtotal |
+Base subtotal | +
| double | + subtotal_with_discount |
+Subtotal with discount | +
| double | + base_subtotal_with_discount |
+Base subtotal with discount | +
| string |
+ ext_shipping_info |
++ |
| string |
+ gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
| double | + customer_balance_amount_used |
+Used customer balance amount | +
| double | + base_customer_balance_amount_used |
+Used base customer balance amount | +
| string |
+ use_customer_balance |
+Defines whether to use the customer balance | +
| string |
+ gift_cards_amount |
+Gift cards amount | +
| string |
+ base_gift_cards_amount |
+Base gift cards amount | +
| string |
+ gift_cards_amount_used |
+Used gift cards amount | +
| string |
+ use_reward_points |
+Defines whether to use reward points | +
| string |
+ reward_points_balance |
+Reward points balance | +
| string |
+ base_reward_currency_amount |
+Base reward currency amount | +
| string |
+ reward_currency_amount |
+Reward currency amount | +
| array | + shipping_address |
+Array of shoppingCartAddressEntity | +
| array | + billing_address |
+Array of shoppingCartAddressEntity | +
| array | + items |
+Array of shoppingCartItemEntity | +
| array | + payment |
+Array of shoppingCartPaymentEntity | +
The shoppingCartAddressEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + address_id |
+Shopping cart address ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ customer_id |
+Customer ID | +
| int | + save_in_address_book |
+Defines whether to save the address in the address book | +
| string |
+ customer_address_id |
+Customer address ID | +
| string |
+ address_type |
+Address type | +
| string |
+ email |
+Email address | +
| string |
+ prefix |
+Customer prefix | +
| string |
+ firstname |
+Customer first name | +
| string |
+ middlename |
+Customer middle name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ suffix |
+Customer suffix | +
| string |
+ company |
+Company name | +
| string |
+ street |
+Street | +
| string |
+ city |
+City | +
| string |
+ region |
+Region | +
| string |
+ region_id |
+Region ID | +
| string |
+ postcode |
+Postcode | +
| string |
+ country_id |
+Country ID | +
| string |
+ telephone |
+Telephone number | +
| string |
+ fax |
+Fax | +
| int | + same_as_billing |
+Defines whether the address is the same as the billing one | +
| int | + free_shipping |
+Defines whether free shipping is used | +
| string |
+ shipping_method |
+Shipping method | +
| string |
+ shipping_description |
+Shipping description | +
| double | + weight |
+Weight | +
The shoppingCartItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + item_id |
+Cart item ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ product_id |
+Product ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ parent_item_id |
+Parent item ID | +
| int | + is_virtual |
+Defines whether the product is a virtual one | +
| string |
+ sku |
+Product SKU | +
| string |
+ name |
+Product name | +
| string |
+ description |
+Description | +
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ additional_data |
+Additional data | +
| string |
+ free_shipping |
+Free shipping | +
| string |
+ is_qty_decimal |
+Defines whether the quantity is decimal | +
| string |
+ no_discount |
+Defines whether no discount is applied | +
| double | + weight |
+Weight | +
| double |
+ qty |
+Quantity | +
| double |
+ price |
+Price | +
| double |
+ base_price |
+Base price | +
| double |
+ custom_price |
+Custom price | +
| double |
+ discount_percent |
+Discount percent | +
| double |
+ discount_amount |
+Discount amount | +
| double |
+ base_discount_amount |
+Base discount amount | +
| double |
+ tax_percent |
+Tax percent | +
| double |
+ tax_amount |
+Tax amount | +
| double |
+ base_tax_amount |
+Base tax amount | +
| double |
+ row_total |
+Row total | +
| double |
+ base_row_total |
+Base row total | +
| double |
+ row_total_with_discount |
+Row total with discount | +
| double |
+ row_weight |
+Row weight | +
| string | + product_type |
+Product type | +
| double |
+ base_tax_before_discount |
+Base tax before discount | +
| double |
+ tax_before_discount |
+Tax before discount | +
| double |
+ original_custom_price |
+Original custom price | +
| double |
+ base_cost |
+Base cost | +
| double |
+ price_incl_tax |
+Price including tax | +
| double |
+ base_price_incl_tax |
+Base price including tax | +
| double |
+ row_total_incl_tax |
+Row total including tax | +
| double | + base_row_total_incl_tax |
+Base row total including tax | +
| string | + gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
| string |
+ gift_message_available |
+Defines whether the gift message is available | +
| double |
+ weee_tax_applied |
+Applied fix product tax | +
| double |
+ weee_tax_applied_amount |
+ Applied fix product tax amount |
+
| double |
+ weee_tax_applied_row_amount |
+ Applied fix product tax row amount |
+
| double |
+ base_weee_tax_applied_amount |
+ Applied fix product tax amount (in base currency) |
+
| double |
+ base_weee_tax_applied_row_amount |
+ Applied fix product tax row amount (in base currency) |
+
| double |
+ weee_tax_disposition |
+Fixed product tax disposition | +
| double |
+ weee_tax_row_disposition |
+ Fixed product tax row disposition |
+
| double |
+ base_weee_tax_disposition |
+ Fixed product tax disposition (in base currency) |
+
| double | + base_weee_tax_row_disposition |
+ Fixed product tax row disposition (in base currency) |
+
| string |
+ tax_class_id |
+Tax class ID | +
The shoppingCartPaymentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + payment_id |
+Payment ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ method |
+Payment method | +
| string |
+ cc_type |
+Credit card type | +
| string |
+ cc_number_enc |
+Credit card number | +
| string |
+ cc_last4 |
+Last four digits on the credit card | +
| string |
+ cc_cid_enc |
+Credit card CID | +
| string |
+ cc_owner |
+Credit card owner | +
| string |
+ cc_exp_month |
+Credit card expiration month | +
| string |
+ cc_exp_year |
+Credit card expiration year | +
| string |
+ cc_ss_owner |
+Credit card owner (Switch/Solo) | +
| string |
+ cc_ss_start_month |
+ Credit card start month (Switch/Solo) |
+
| string |
+ cc_ss_start_year |
+ Credit card start year (Switch/Solo) |
+
| string |
+ cc_ss_issue |
+ Credit card issue number (Switch/Solo) |
+
| string |
+ po_number |
+Purchase order number | +
| string |
+ additional_data |
+Additional data | +
| string |
+ additional_information |
+Additional information | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart.info', '15');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartInfo($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartInfo((object)array('sessionId' => $sessionId->result, 'quoteId' => '15'));
+
+var_dump($result->result);
+ Allows you to retrieve the website license agreement for the quote according to the website (store).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID (quote identifier) | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartLicenseEntity | +
The shoppingCartLicenseEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + agreement_id |
+License agreement ID | +
| string |
+ name |
+License name | +
| string |
+ content |
+License content | +
| int | + is_active |
+Defines whether the license is active | +
| int | + is_html |
+Defines whether the license is HTML | +
Faults:
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart.license', '15');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartLicense($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartLicense((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
+var_dump($result->result);
+ array + 0 => + array + 'agreement_id' => string '1' (length=1) + 'name' => string 'license' (length=4) + 'content' => string 'terms and conditions' (length=20) + 'content_height' => null + 'checkbox_text' => string 'terms' (length=5) + 'is_active' => string '1' (length=1) + 'is_html' => string '0' (length=1)+
Allows you to create an order from a shopping cart (quote).
+Before placing the order, you need to add the customer, customer address, shipping and payment methods.
Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping Cart ID (quote ID) | +
| string | +storeId | +Store view ID or code (optional) | +
| ArrayOfString | + licenses |
+Website license ID (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +result | +Result of creating an order | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+$resultOrderCreation = $proxy->call(
+ $sessionId,
+ "cart.order",
+ array(
+ $shoppingCartId
+ )
+);
+ /**
+ * Example of order creation
+ * Preconditions are as follows:
+ * 1. Create a customer
+ * 2. Create a simple product */
+
+$user = 'apiUser';
+$password = 'apiKey';
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+ $sessionId = $proxy->login($user, $password);
+ $cartId = $proxy->shoppingCartCreate($sessionId, 1);
+ // load the customer list and select the first customer from the list
+ $customerList = $proxy->customerCustomerList($sessionId, array());
+ $customer = (array) $customerList[0];
+ $customer['mode'] = 'customer';
+ $proxy->shoppingCartCustomerSet($sessionId, $cartId, $customer);
+ // load the product list and select the first product from the list
+ $productList = $proxy->catalogProductList($sessionId);
+ $product = (array) $productList[0];
+ $product['qty'] = 1;
+ $proxy->shoppingCartProductAdd($sessionId, $cartId, array($product));
+
+ $address = array(
+ array(
+ 'mode' => 'shipping',
+ 'firstname' => $customer['firstname'],
+ 'lastname' => $customer['lastname'],
+ 'street' => 'street address',
+ 'city' => 'city',
+ 'region' => 'region',
+ 'telephone' => 'phone number',
+ 'postcode' => 'postcode',
+ 'country_id' => 'country ID',
+ 'is_default_shipping' => 0,
+ 'is_default_billing' => 0
+ ),
+ array(
+ 'mode' => 'billing',
+ 'firstname' => $customer['firstname'],
+ 'lastname' => $customer['lastname'],
+ 'street' => 'street address',
+ 'city' => 'city',
+ 'region' => 'region',
+ 'telephone' => 'phone number',
+ 'postcode' => 'postcode',
+ 'country_id' => 'country ID',
+ 'is_default_shipping' => 0,
+ 'is_default_billing' => 0
+ ),
+ );
+ // add customer address
+ $proxy->shoppingCartCustomerAddresses($sessionId, $cartId, $address);
+ // add shipping method
+ $proxy->shoppingCartShippingMethod($sessionId, $cartId, 'flatrate_flatrate');
+
+ $paymentMethod = array(
+ 'po_number' => null,
+ 'method' => 'checkmo',
+ 'cc_cid' => null,
+ 'cc_owner' => null,
+ 'cc_number' => null,
+ 'cc_type' => null,
+ 'cc_exp_year' => null,
+ 'cc_exp_month' => null
+ );
+ // add payment method
+ $proxy->shoppingCartPaymentMethod($sessionId, $cartId, $paymentMethod);
+ // place the order
+ $orderId = $proxy->shoppingCartOrder($sessionId, $cartId, null, null);
+ Allows you to retrieve total prices for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID (quote identifier) | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartTotalsEntity | +
The shoppingCartTotalsEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + title |
+Title | +
| float | + amount |
+Total amount | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart.totals', '15');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartTotals($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartTotals((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
+var_dump($result->result);
+ array + 0 => + array + 'title' => string 'Subtotal' (length=8) + 'amount' => float 388.69 + 1 => + array + 'title' => string '0 Reward points' (length=15) + 'amount' => float 0 + 2 => + array + 'title' => string 'Gift Cards' (length=10) + 'amount' => float 0 + 3 => + array + 'title' => string 'Store Credit' (length=12) + 'amount' => float 0 + 4 => + array + 'title' => string 'Grand Total' (length=11) + 'amount' => float 388.69 + 5 => + array + 'title' => null + 'amount' => null+
The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to add and remove coupon codes for a shopping cart.
+ +Resource Name: cart_coupon
+ +Methods:
+Note: In Magento, quotes and shopping carts are logically related, but technically different. The shopping cart is a wrapper for a quote, and it is used primarily by the frontend logic. The cart is represented by the Mage_Checkout_Model_Cart class and the quote is represented by the Mage_Sales_Model_Quote class.
+ +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1081 | +Coupon could not be applied because quote is empty. | +
| 1082 | +Coupon could not be applied. | +
| 1083 | +Coupon is not valid. | +
Allows you to add a coupon code for a shopping cart (quote). The shopping cart must not be empty.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +couponCode | +Coupon code | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the coupon code is added | +
Faults:
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$couponCode = "aCouponCode";
+$resultCartCouponRemove = $proxy->call(
+ $sessionId,
+ "cart_coupon.add",
+ array(
+ $shoppingCartId,
+ $couponCode
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCouponAdd($sessionId, '15', 'aCouponCode');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCouponAdd((object)array('sessionId' => $sessionId->result, 'quoteId' => 15, 'couponCode' => 'aCouponCode', 'store' => '3'));
+var_dump($result->result);
+ Allows you to remove a coupon code from a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the coupon code is removed | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$resultCartCouponRemove = $proxy->call(
+ $sessionId,
+ "cart_coupon.remove",
+ array(
+ $shoppingCartId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCouponRemove($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCouponRemove((object)array('sessionId' => $sessionId->result, 'quoteId' => 15, 'store' => '3'));
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to add customer information and addresses into a shopping cart.
+ +Resource Name: cart_customer
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1041 | +Customer is not set. | +
| 1042 | +The customer’s identifier is not valid or customer is not existed | +
| 1043 | +Customer could not be created. | +
| 1044 | +Customer data is not valid. | +
| 1045 | +Customer’s mode is unknown | +
| 1051 | +Customer address data is empty. | +
| 1052 | +Customer’s address data is not valid. | +
| 1053 | +The customer’s address identifier is not valid | +
| 1054 | +Customer address is not set. | +
| 1055 | +Customer address identifier do not belong customer, which set in quote | +
Allows you to set the customer addresses in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +customerAddressData | +Array of shoppingCartCustomerAddressEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True if the address is set | +
The shoppingCartCustomerAddressEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + mode |
+Mode: billing or shipping | +
| string |
+ address_id |
+Address ID | +
| string |
+ firstname |
+Customer first name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ company |
+Company name | +
| string |
+ street |
+Street | +
| string |
+ city |
+City | +
| string |
+ region |
+Region | +
| string |
+ region_id |
+Region ID | +
| string |
+ postcode |
+Post code | +
| string |
+ country_id |
+Country ID | +
| string |
+ telephone |
+Telephone number | +
| string |
+ fax |
+Fax number | +
| int | + is_default_billing |
+Defines whether the address is a default billing address | +
| int | + is_default_shipping |
+ Defines whether the address is a default shipping address |
+
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+$arrAddresses = array(
+ array(
+ "mode" => "shipping",
+ "firstname" => "testFirstname",
+ "lastname" => "testLastname",
+ "company" => "testCompany",
+ "street" => "testStreet",
+ "city" => "testCity",
+ "region" => "testRegion",
+ "postcode" => "testPostcode",
+ "country_id" => "id",
+ "telephone" => "0123456789",
+ "fax" => "0123456789",
+ "is_default_shipping" => 0,
+ "is_default_billing" => 0
+ ),
+ array(
+ "mode" => "billing",
+ "address_id" => "customer_address_id"
+ )
+);
+
+$resultCustomerAddresses = $proxy->call(
+ $sessionId,
+ "cart_customer.addresses",
+ array(
+ $shoppingCartId,
+ $arrAddresses,
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+Â
+$sessionId = $proxy->login('apiUser', 'apiKey');Â
+Â Â
+$result = $proxy->shoppingCartCustomerAddresses($sessionId, 10, array(array(
+'mode' => 'billing',
+'firstname' => 'first name',
+'lastname' => 'last name',
+'street' => 'street address',
+'city' => 'city',
+'region' => 'region',
+'postcode' => 'postcode',
+'country_id' => 'US',
+'telephone' => '123456789',
+'is_default_billing' => 1
+))); Â Â
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCustomerAddresses((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'customerAddressData' => array(array(
+'mode' => 'billing',
+'firstname' => 'first name',
+'lastname' => 'last name',
+'street' => 'street address',
+'city' => 'city',
+'region' => 'region',
+'postcode' => 'postcode',
+'country_id' => 'US',
+'telephone' => '123456789',
+'is_default_billing' => 1
+))));
+var_dump($result->result);
+ Allows you to add information about the customer to a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +customerData | +Array of shoppingCartCustomerEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True if information is added | +
The shoppingCartCustomerEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + mode |
+Customer mode | +
| int | + customer_id |
+Customer ID | +
| string | + email |
+Customer email address | +
| string |
+ firstname |
+Customer first name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ password |
+Customer password | +
| string |
+ confirmation |
+Confirmation flag | +
| int | + website_id |
+Website ID | +
| int | + store_id |
+Store ID | +
| int | + group_id |
+Group ID | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$customerAsGuest = array(
+ "firstname" => "testFirstname",
+ "lastname" => "testLastName",
+ "email" => "testEmail",
+ "website_id" => "0",
+ "store_id" => "0",
+ "mode" => "guest"
+);
+$resultCustomerSet = $proxy->call($sessionId, 'cart_customer.set', array( $shoppingCartId, $customerAsGuest) );
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$session = $client->login('apiUser', 'apiKey');
+
+$quoteId = $client->shoppingCartCreate($session);
+
+$customerData = array(
+ "firstname" => "testFirstname",
+ "lastname" => "testLastName",
+ "email" => "testEmail@mail.com",
+ "mode" => "guest",
+ "website_id" => "0"
+ );
+
+$resultCustomerSet = $client->shoppingCartCustomerSet($session, $quoteId, $customerData);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to retrieve and set payment methods for a shopping cart.
+ +Resource Name: cart_payment
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1071 | +Payment method data is empty. | +
| 1072 | +Customer’s billing address is not set. Required for payment method data. | +
| 1073 | +Customer’s shipping address is not set. Required for payment method data. | +
| 1074 | +Payment method is not allowed | +
| 1075 | +Payment method is not set. | +
Allows you to retrieve a list of available payment methods for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | + quoteId |
+Shopping cart ID | +
| string | + store |
+Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartPaymentMethodResponseEntity | +
The shoppingCartPaymentMethodResponseEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + code |
+Payment method code | +
| string | + title |
+Payment method title | +
| associativeArray | + cc_types |
+Array of credit card types | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart_payment.list', 'quoteId');
+var_dump($result);
+ array + 0 => + array + 'code' => string 'checkmo' (length=7) + 'title' => string 'Check / Money order' (length=19) + 'ccTypes' => null + 1 => + array + 'code' => string 'ccsave' (length=6) + 'title' => string 'Credit Card (saved)' (length=19) + 'ccTypes' => + array + 'AE' => string 'American Express' (length=16) + 'VI' => string 'Visa' (length=4) + 'MC' => string 'MasterCard' (length=10) + 'DI' => string 'Discover' (length=8)+
Allows you to set a payment method for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +method | +Array of shoppingCartPaymentMethodEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True on success | +
The shoppingCartPaymentMethodEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + po_number |
+Purchase order number | +
| string |
+ method |
+Payment method | +
| string |
+ cc_cid |
+Credit card CID | +
| string |
+ cc_owner |
+Credit card owner | +
| string |
+ cc_number |
+Credit card number | +
| string |
+ cc_type |
+Credit card type | +
| string |
+ cc_exp_year |
+Credit card expiration year | +
| string |
+ cc_exp_month |
+Credit card expiration month | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+$paymentMethod = array(
+ "method" => "checkmo"
+);
+
+$resultPaymentMethod = $proxy->call(
+ $sessionId,
+ "cart_payment.method",
+ array(
+ $shoppingCartId,
+ $paymentMethod
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartPaymentMethod($sessionId, 10, array(
+'po_number' => null,
+'method' => 'checkmo',
+'cc_cid' => null,
+'cc_owner' => null,
+'cc_number' => null,
+'cc_type' => null,
+'cc_exp_year' => null,
+'cc_exp_month' => null
+));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartPaymentMethod((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'method' => array(
+'po_number' => null,
+'method' => 'checkmo',
+'cc_cid' => null,
+'cc_owner' => null,
+'cc_number' => null,
+'cc_type' => null,
+'cc_exp_year' => null,
+'cc_exp_month' => null
+)));
+
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to manage products in a shopping cart.
+ +Resource Name: cart_product
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1021 | +Product’s data is not valid. | +
| 1022 | +Product(s) could not be added. | +
| 1023 | +Quote could not be saved during adding product(s) operation. | +
| 1024 | +Product(s) could not be updated. | +
| 1025 | +Quote could not be saved during updating product(s) operation. | +
| 1026 | +Product(s) could not be removed. | +
| 1027 | +Quote could not be saved during removing product(s) operation. | +
| 1028 | +Customer is not set for quote. | +
| 1029 | +Customer’s quote is not existed. | +
| 1030 | +Quotes are identical. | +
| 1031 | +Product(s) could not be moved. | +
| 1032 | +One of quote could not be saved during moving product(s) operation. | +
Allows you to create/modify shopping cart and create an order after complete filling the shopping cart. Consists of two main parts: Shopping Cart and Checkout processes.
+ +Module: Mage_Checkout
+ +Resource: cart_product
+ +Allows you to add one or more products to the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | + Shopping cart ID (quote ID) |
+
| array |
+ products\productsData |
+ An array with the list of shoppingCartProductEntity |
+
| string |
+ storeId |
+ Store view ID or code (optional) |
+
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True on success (if the product is added to the shopping cart) | +
The shoppingCartProductEntity array attributes are as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +ID of the product to be added to the shopping cart (quote) (optional) | +
| string |
+ sku |
+ SKU of the product to be added to the shopping cart (quote) (optional) |
+
| double |
+ qty |
+ Number of products to be added to the shopping cart (quote) (optional) |
+
| associativeArray |
+ options |
+ An array in the form of option_id => content (optional) |
+
| associativeArray |
+ bundle_option |
+An array of bundle item options (optional) | +
| associativeArray |
+ bundle_option_qty |
+An array of bundle items quantity (optional) | +
| ArrayOfString |
+ links |
+An array of links (optional) | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$quoteId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ "options" => array( Â
+ optionId_1 => optionValue_1,
+ ...,
+ optionId_n => optionValue_n
+ )
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call(
+ $sessionId,
+ "cart_product.add",
+ array(
+ $quoteId,
+ $arrProducts
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartProductAdd($sessionId, 10, array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '5',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+)));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartProductAdd((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '1',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+))));
+
+
+var_dump($result->result);
+ Allows you to retrieve the list of products in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartProductResponseEntity | +
The shoppingCartProductResponseEntity (catalogProductEntity) content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +Product ID | +
| string |
+ sku |
+Product SKU | +
| string |
+ name |
+Product name | +
| string |
+ set |
+Product attribute set | +
| string |
+ type |
+Product type | +
| ArrayOfString |
+ category_ids |
+Array of category IDs | +
| ArrayOfString |
+ website_ids |
+Array of website IDs | +
Faults:
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'cart_product.list', '15');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartProductList($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartProductList((object)array('sessionId' => $sessionId->result, 'quoteId' => 15));
+var_dump($result->result);
+ array + 0 => + array + 'product_id' => string '3' (length=1) + 'sku' => string 'canonxt' (length=7) + 'name' => string 'Canon Digital Rebel XT 8MP Digital SLR Camera' (length=45) + 'set' => string '4' (length=1) + 'type' => string 'simple' (length=6) + 'category_ids' => + array + 0 => string '5' (length=1) + 'website_ids' => + array + 0 => string '2' (length=1)+
Allows you to move products from the current quote to a customer quote.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +productsData | +Array of shoppingCartProductEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True if the product is moved to customer quote | +
The shoppingCartProductEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +Product ID | +
| string | + sku |
+Product SKU | +
| double | + qty |
+Product quantity | +
| associativeArray |
+ options |
+Product custom options | +
| associativeArray |
+ bundle_option |
+An array of bundle item options (optional) | +
| associativeArray | + bundle_option_qty |
+An array of bundle items quantity (optional) | +
| ArrayOfString | + links |
+An array of links (optional) | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call(
+ $sessionId,
+ "cart_product.add",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+$arrProducts = array(
+ array(
+ "product_id" => "1"
+ ),
+);
+$resultCartProductMove = $proxy->call(
+ $sessionId,
+ "cart_product.moveToCustomerQuote",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+ Allows you to remove one or several products from a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +productsData | +Array of shoppingCartProductEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is removed | +
The shoppingCartProductEntity content is as follows:
+ + +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +Product ID | +
| string | + sku |
+Product SKU | +
| double | + qty |
+Product quantity | +
| associativeArray |
+ options |
+Product custom options | +
| associativeArray |
+ bundle_option |
+An array of bundle item options (optional) | +
| associativeArray | + bundle_option_qty |
+An array of bundle items quantity (optional) | +
| ArrayOfString | + links |
+An array of links (optional) | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call(
+ $sessionId,
+ "cart_product.add",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+$arrProducts = array(
+ array(
+ "product_id" => "1"
+ ),
+);
+$resultCartProductUpdate = $proxy->call(
+ $sessionId,
+ "cart_product.remove",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartProductRemove($sessionId, 10, array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '1',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+)));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartProductRemove((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '1',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+))));
+
+
+var_dump($result->result);
+ Allows you to update one or several products in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| array | +productsData | +Array of shoppingCartProductEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the product is updated | +
The shoppingCartProductEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +product_id | +Product ID | +
| string | + sku |
+Product SKU | +
| double | + qty |
+Product quantity | +
| associativeArray |
+ options |
+Product custom options | +
| associativeArray |
+ bundle_option |
+An array of bundle item options (optional) | +
| associativeArray | + bundle_option_qty |
+An array of bundle items quantity (optional) | +
| ArrayOfString | + links |
+An array of links (optional) | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$shoppingCartIncrementId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 2
+ ),
+ array(
+ "sku" => "testSKU",
+ "quantity" => 4
+ )
+);
+$resultCartProductAdd = $proxy->call(
+ $sessionId,
+ "cart_product.add",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+$arrProducts = array(
+ array(
+ "product_id" => "1",
+ "qty" => 5
+ ),
+);
+$resultCartProductUpdate = $proxy->call(
+ $sessionId,
+ "cart_product.update",
+ array(
+ $shoppingCartId,
+ $arrProducts
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartProductUpdate($sessionId, 10, array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '2',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+)));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartProductUpdate((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'productsData' => array(array(
+'product_id' => '4',
+'sku' => 'simple_product',
+'qty' => '5',
+'options' => null,
+'bundle_option' => null,
+'bundle_option_qty' => null,
+'links' => null
+))));
+
+
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to retrieve and set shipping methods for a shopping cart.
+ +Resource Name: cart_shipping
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1061 | +Can not make operation because of customer shipping address is not set | +
| 1062 | +Shipping method is not available | +
| 1063 | +Can not set shipping method. | +
| 1064 | +Can not receive list of shipping methods. | +
Allows you to retrieve the list of available shipping methods for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +storeId | +Store view ID or code (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of shoppingCartShippingMethodEntity | +
The shoppingCartShippingMethodEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + code |
+Code | +
| string |
+ carrier |
+Carrier | +
| string |
+ carrier_title |
+Carrier title | +
| string |
+ method |
+Shipping method | +
| string |
+ method_title |
+Shipping method title | +
| string |
+ method_description |
+Shipping method description | +
| double | + price |
+Shipping price | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->call($sessionId, 'cart_shipping.list', 10);
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartShippingList($sessionId, 10);
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartShippingList((object)array('sessionId' => $sessionId->result, 'quoteId' => 10));
+var_dump($result->result);
+ Allows you to set a shipping method for a shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| int | +quoteId | +Shopping cart ID | +
| string | +method | +Shipping method code | +
| string | +storeId | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | +result | +True if the shipping method is set | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->call($sessionId, 'cart_shipping.method', array(10, 'freeshipping_freeshipping'));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->shoppingCartShippingMethod($sessionId, 10, 'freeshipping_freeshipping');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartShippingMethod((object)array('sessionId' => $sessionId->result, 'quoteId' => 10, 'shippingMethod' => 'freeshipping_freeshipping'));
+var_dump($result->result);
+ The Mage_Checkout module allows you to manage shopping carts and the checkout process. This module allows you to create an order once filling the shopping cart is complete.
+ +Allows you to add and remove coupon codes for a shopping cart.
+ +Resource Name: cart_coupon
+ +Methods:
+Allows you to add customer information and addresses into a shopping cart.
+ +Resource Name: cart_customer
+ +Methods:
+Allows you to retrieve and set payment methods for a shopping cart.
+ +Resource Name: cart_payment
+ +Methods:
+Allows you to manage products in a shopping cart.
+ +Resource Name: cart_product
+ +Methods:
+Allows you to retrieve and set shipping methods for a shopping cart.
+ +Resource Name: cart_shipping
+ +Methods:
+Allows you to manage shopping carts.
+ +Resource Name: cart
+ +Methods:
+The Core API allows you to manage a set of common resources used in Magento. However, you may choose to have your own set of resources to manage, or you may wish to extend the Core API to handle additional resources.
+ +This tutorial leads you through the process of creating a custom API for a customer module that handles basic customer information.
+ +Note: This tutorial applies to v1 of the API.
+ +To learn more about the Core API, to read Magento Core API calls.
+ +For general information about the Magento API, go to the Introduction.
+ +Create a file named api.xml in the /etc folder in the customer module. Start with the empty structure, as follows:
+<config> + <api> + <resources> + </resources> + <acl> + <resources> + <all> + </all> + </resources> + </acl> + </api> +</config>+
Add an element named customer in the <resources> element. Add a <methods> element, with elements for list, create, info, update and remove methods for customer resource.
+ +Note that:
+<config> + <api> +.... + <resources> + <customer translate="title" module="customer"> + <title>Customer Resource</title> + <methods> + <list translate="title" module="customer"> + <title>Retrieve customers</title> + </list> + <create translate="title" module="customer"> + <title>Create customer</title> + </create> + <info translate="title" module="customer"> + <title>Retrieve customer data</title> + </info> + <update translate="title" module="customer"> + <title>Update customer data</title> + </update> + <delete> + <title>Delete customer</title> + </delete> + </methods> + <faults module="customer"> + </faults> + </customer> + </resources> +.... + </api> +</config>+
The resource can return some faults, so add a <faults> element in the customer element, and list the various faults.
+<config> + <api> +.... + <resources> + <customer translate="title" module="customer"> +.... + <faults module="customer"> <!-- module="customer" specifies the module which will be used for translation. --> + <data_invalid> <!-- if we get invalid input data for customers --> + <code>100</code > + <!-- we cannot know all the errors that can appear, their details can be found in error message for call --> + <message>Invalid customer data. Details in error message.</message> + </data_invalid> + <filters_invalid> + <code>101</code > + <message>Invalid filters specified. Details in error message.</message> + </filters_invalid> + <not_exists> + <code>102</code > + <message>Customer doesn't exist.</message> + </not_exists> + <not_deleted> + <code>103</code > + <message>Customer was not deleted. Details in error message.</message> + </not_deleted> + </faults> + </customer> + </resources> +.... + </api> +</config>+
In order to prevent unauthorized access to our custom API, you must first list the resources that are restricted within the <acl> element.
+<config> + <api> +.... + <acl> + <resources> + <customer translate="title" module="customer"> + <title>Customers</title> + <list translate="title" module="customer"> + <title>View All</title> + </list> + <create translate="title" module="customer"> + <title>Create</title> + </create> + <info translate="title" module="customer"> + <title>Get Info</title> + </info> + <update translate="title" module="customer"> + <title>Update</title> + </update> + <delete translate="title" module="customer"> + <title>Delete</title> + </delete> + </customer> + </resources> + </acl> + </api> +</config>+
Then, map ACL resources to API resource methods by adding an <acl> element to each part of the resource that needs restricting:
+<config> + <api> + <resources> + <customer translate="title" module="customer"> + <title>Customer Resource</title> + <acl>customer</acl> + <methods> + <list translate="title" module="customer"> + <title>Retrieve customers</title> + <acl>customer/list</acl> + </list> + <create translate="title" module="customer"> + <title>Create customer</title> + <acl>customer/create</acl> + </create> + <info translate="title" module="customer"> + <title>Retrieve customer data</title> + <acl>customer/info</acl> + </info> + <update translate="title" module="customer"> + <title>Update customer data</title> + <acl>customer/update</acl> + </update> + <delete> + <title>Delete customer</title> + <acl>customer/delete</acl> + </delete> + </methods> + .... + </customer> + </resources> +.... + </api> +</config>+
Next, write some PHP code to access the resources. Start by creating a class called Mage_Customer_Model_Customer_Api that extends Mage_Api_Model_Resource_Abstract. Save it into a file called api.php.
+class Mage_Customer_Model_Customer_Api extends Mage_Api_Model_Resource_Abstract
+{
+
+ public function create($customerData)
+ {
+ }
+
+ public function info($customerId)
+ {
+ }
+
+ public function items($filters)
+ {
+ }
+
+ public function update($customerId, $customerData)
+ {
+ }
+
+ public function delete($customerId)
+ {
+ }
+}
+ Note that you cannot create method "list" because it’s a PHP keyword, so instead the method is named items. In order to make this work, add a <method> element into the <list> element in api.xml, as shown below.
+<config> + <api> + <resources> + <customer translate="title" module="customer"> + <model>customer/api</model> <!-- our model --> + <title>Customer Resource</title> + <acl>customer</acl> + <methods> + <list translate="title" module="customer"> + <title>Retrieve customers</title> + <method>items</method> <!-- we have another method name inside our resource --> + <acl>customer/list</acl> + </list> +.... + </methods> +.... + </resources> +.... + </api> +</config>+
Now add some simple functionality to the Mage_Customer_Model_Api methods you created.
+ +Create a customer:
+public function create($customerData)
+ {
+ try {
+ $customer = Mage::getModel('customer/customer')
+ ->setData($customerData)
+ ->save();
+ } catch (Mage_Core_Exception $e) {
+ $this->_fault('data_invalid', $e->getMessage());
+ // We cannot know all the possible exceptions,
+ // so let's try to catch the ones that extend Mage_Core_Exception
+ } catch (Exception $e) {
+ $this->_fault('data_invalid', $e->getMessage());
+ }
+ return $customer->getId();
+ }
+ Retrieve customer info:
+public function info($customerId)
+ {
+ $customer = Mage::getModel('customer/customer')->load($customerId);
+ if (!$customer->getId()) {
+ $this->_fault('not_exists');
+ // If customer not found.
+ }
+ return $customer->toArray();
+ // We can use only simple PHP data types in webservices.
+ }
+ Retrieve list of customers using filtering:
+public function items($filters)
+ {
+ $collection = Mage::getModel('customer/customer')->getCollection()
+ ->addAttributeToSelect('*');
+
+ if (is_array($filters)) {
+ try {
+ foreach ($filters as $field => $value) {
+ $collection->addFieldToFilter($field, $value);
+ }
+ } catch (Mage_Core_Exception $e) {
+ $this->_fault('filters_invalid', $e->getMessage());
+ // If we are adding filter on non-existent attribute
+ }
+ }
+
+ $result = array();
+ foreach ($collection as $customer) {
+ $result[] = $customer->toArray();
+ }
+
+ return $result;
+ }
+ Update a customer:
+public function update($customerId, $customerData)
+ {
+ $customer = Mage::getModel('customer/customer')->load($customerId);
+
+ if (!$customer->getId()) {
+ $this->_fault('not_exists');
+ // No customer found
+ }
+
+ $customer->addData($customerData)->save();
+ return true;
+ }
+ Delete a customer:
+public function delete($customerId)
+ {
+ $customer = Mage::getModel('customer/customer')->load($customerId);
+
+ if (!$customer->getId()) {
+ $this->_fault('not_exists');
+ // No customer found
+ }
+
+ try {
+ $customer->delete();
+ } catch (Mage_Core_Exception $e) {
+ $this->_fault('not_deleted', $e->getMessage());
+ // Some errors while deleting.
+ }
+
+ return true;
+ }
+ In order to create custom webservice adapter, implement the Mage_Api_Model_Server_Adapter_Interface, which is shown below.
+interface Mage_Api_Model_Server_Adapter_Interface
+{
+ /**
+ * Set handler class name for webservice
+ *
+ * @param string $handler
+ * @return Mage_Api_Model_Server_Adapter_Interface
+ */
+ function setHandler($handler);
+
+ /**
+ * Retrieve handler class name for webservice
+ *
+ * @return string [basc]
+ */
+ function getHandler();
+
+ /**
+ * Set webservice API controller
+ *
+ * @param Mage_Api_Controller_Action $controller
+ * @return Mage_Api_Model_Server_Adapter_Interface
+ */
+ function setController(Mage_Api_Controller_Action $controller);
+
+ /**
+ * Retrieve webservice API controller
+ *
+ * @return Mage_Api_Controller_Action
+ */
+ function getController();
+
+ /**
+ * Run webservice
+ *
+ * @return Mage_Api_Model_Server_Adapter_Interface
+ */
+ function run();
+
+ /**
+ * Dispatch webservice fault
+ *
+ * @param int $code
+ * @param string $message
+ */
+ function fault($code, $message);
+
+} // Class Mage_Api_Model_Server_Adapter_Interface End
+ Here is an example implementation for XML-RPC:
+class Mage_Api_Model_Server_Adapter_Customxmlrpc
+ extends Varien_Object
+ implements Mage_Api_Model_Server_Adapter_Interface
+{
+ /**
+ * XmlRpc Server
+ *
+ * @var Zend_XmlRpc_Server
+ */
+ protected $_xmlRpc = null;
+
+ /**
+ * Set handler class name for webservice
+ *
+ * @param string $handler
+ * @return Mage_Api_Model_Server_Adapter_Xmlrpc
+ */
+ public function setHandler($handler)
+ {
+ $this->setData('handler', $handler);
+ return $this;
+ }
+
+ /**
+ * Retrieve handler class name for webservice
+ *
+ * @return string
+ */
+ public function getHandler()
+ {
+ return $this->getData('handler');
+ }
+
+ /**
+ * Set webservice API controller
+ *
+ * @param Mage_Api_Controller_Action $controller
+ * @return Mage_Api_Model_Server_Adapter_Xmlrpc
+ */
+ public function setController(Mage_Api_Controller_Action $controller)
+ {
+ $this->setData('controller', $controller);
+ return $this;
+ }
+
+ /**
+ * Retrieve webservice API controller
+ *
+ * @return Mage_Api_Controller_Action
+ */
+ public function getController()
+ {
+ return $this->getData('controller');
+ }
+
+ /**
+ * Run webservice
+ *
+ * @param Mage_Api_Controller_Action $controller
+ * @return Mage_Api_Model_Server_Adapter_Xmlrpc
+ */
+ public function run()
+ {
+ $this->_xmlRpc = new Zend_XmlRpc_Server();
+ $this->_xmlRpc->setClass($this->getHandler());
+ $this->getController()->getResponse()
+ ->setHeader('Content-Type', 'text/xml')
+ ->setBody($this->_xmlRpc->handle());
+ return $this;
+ }
+
+ /**
+ * Dispatch webservice fault
+ *
+ * @param int $code
+ * @param string $message
+ */
+ public function fault($code, $message)
+ {
+ throw new Zend_XmlRpc_Server_Exception($message, $code);
+ }
+} // Class Mage_Api_Model_Server_Adapter_Customxmlrpc End
+ Notes: The setHandler, getHandler, setController and getController methods have a simple implementation that uses the Varien_Object getData and setData methods.
+ +The run and fault methods are a native implementation for an XML-RPC webservice. The run method defines webservice logic in this adapter for creating an XML-RPC server to handle XML-RPC requests.
+public function run()
+Â Â {
+Â Â Â Â $this->_xmlRpc = new Zend_XmlRpc_Server();
+Â Â Â Â $this->_xmlRpc->setClass($this->getHandler());
+Â Â Â Â $this->getController()->getResponse()
+Â Â Â Â Â Â ->setHeader('Content-Type', 'text/xml')
+Â Â Â Â Â Â ->setBody($this->_xmlRpc->handle());
+Â Â Â Â return $this;
+Â Â }
+ The "fault" method allows you to send fault exceptions for XML-RPC service when handling requests.
+public function fault($code, $message)
+Â Â {
+Â Â Â Â throw new Zend_XmlRpc_Server_Exception($message, $code);
+Â Â }
+ The following are common error messages that you might receive when creating your own custom API.
+ +Invalid API path
+ +This error occurs when the methods listed in the api.xml file do not correspond exactly with those used in your PHP file.
+ +For example, in your api.xml file, you might have this:
+<config> + <api> + <resources> + <checkout_cart translate="title" module="checkout"> + <model>checkout/cart_api</model> + <title>Cart API</title> + <methods> + <list translate="title" module="checkout"> + <title>Retrieve cart data</title> + <method>info</method> + </list> + </methods> + </checkout_cart> + </resources> + ... + </api> +</config>+
You should have a corresponding info method in your PHP file.
+class Mage_Checkout_Model_Cart_Api extends Mage_Cart_Model_Api_Resource
+{
+ public function info()
+ {
+ ...
+ }
+}
+ If you are missing this method, the error "Invalid API path" will be returned.
+ diff --git a/guides/v19.x/api/soap/customer/customer.create.html b/guides/v19.x/api/soap/customer/customer.create.html new file mode 100644 index 0000000000..8438b74918 --- /dev/null +++ b/guides/v19.x/api/soap/customer/customer.create.html @@ -0,0 +1,193 @@ +--- +layout: v1x_soap +title: Customer Create +--- + + +Allows you to export/import customers from/to Magento.
+ +Create a new customer.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +customerData | + Array of customerCustomerEntityToCreate |
+
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created customer | +
The customerCustomerEntityToCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +Customer email | +|
| string | +firstname | +Customer first name | +
| string | +lastname | +Customer last name | +
| string | +password | +Customer password | +
| int | +website_id | +Website ID | +
| int | +store_id | +Store ID | +
| int | +group_id | +Group ID | +
| string | +prefix | +Customer prefix (optional) | +
| string | +suffix | +Customer suffix (optional) | +
| string | +dob | +Customer date of birth (optional) | +
| string | +taxvat | +Customer tax/VAT number (optional) | +
| int | +gender | +Customer gender: 1 - Male, 2 - Female (optional) | +
| string | +middlename | +Customer middle name/initial (optional) | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session,'customer.create',array(array('email' => 'mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1)));
+
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->customerCustomerCreate($session, array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerCreate((object)array('sessionId' => $sessionId->result, 'customerData' => ((object)array(
+'email' => 'customer-mail@example.org',
+'firstname' => 'John',
+'lastname' => 'Dou',
+'password' => '123123',
+'website_id' => '0',
+'group_id' => '1'
+))));
+var_dump($result->result);
+ Allows you to export/import customers from/to Magento
+ +Delete the required customer.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +Customer ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the customer is deleted | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer.delete', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerCustomerDelete($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerDelete((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
+var_dump($result->result);
+ The Mage_Customer module allows you to create, retrieve, update, and delete customers and customer addresses.
+ +Allows you to create, retrieve, update, and delete data about customers.
+ +Resource Name: customer
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Invalid customer data. Details in error message. | +
| 101 | +Invalid filters specified. Details in error message. | +
| 102 | +Customer does not exist. | +
| 103 | +Customer not deleted. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+$newCustomer = array(
+ 'firstname' => 'First',
+ 'lastname' => 'Last',
+ 'email' => 'test@example.com',
+ //for my version of magento (1.3.2.4) you SHOULD NOT
+ // hash the password, as in:
+ // 'password_hash' => 'password'
+ 'password_hash' => md5('password'),
+ // password hash can be either regular or salted md5:
+ // $hash = md5($password);
+ // $hash = md5($salt.$password).':'.$salt;
+ // both variants are valid
+ 'store_id' => 0,
+ 'website_id' => 0
+);
+
+$newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
+
+// Get new customer info
+var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));
+
+
+// Update customer
+$update = array('firstname'=>'Changed Firstname');
+$proxy->call($sessionId, 'customer.update', array($newCustomerId, $update));
+
+var_dump($proxy->call($sessionId, 'customer.info', $newCustomerId));
+
+// Delete customer
+$proxy->call($sessionId, 'customer.delete', $newCustomerId);
+ Allows you to retrieve the customer groups.
+ +Resource Name: customer_group
+ +Methods:
+Allows you to export/import customers from/to Magento.
+ +Retrieve information about the specified customer.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +ID of the required customer | +
| ArrayOfString | +attributes | +Array of attributes | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +customerInfo | +Array of customerCustomerEntity | +
The customerCustomerEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +customer_id | +ID of the customer | +
| string | +created_at | +Date when the customer was created | +
| string | +updated_at | +Date when the customer was updated | +
| string | +increment_id | +Increment ID | +
| int | +store_id | +Store ID | +
| int | +website_id | +Website ID | +
| string | +created_in | +Store view the customer was created in | +
| string | +Customer email | +|
| string | +firstname | +Customer first name | +
| string | +middlename | +Customer middle name | +
| string | +lastname | +Customer last name | +
| int | +group_id | +Customer group ID | +
| string | +prefix | +Customer prefix | +
| string | +suffix | +Customer suffix | +
| string | +dob | +Customer date of birth | +
| string | +taxvat | +Tax/VAT number | +
| boolean | +confirmation | +Confirmation flag | +
| string | +password_hash | +Password hash | +
| string | +rp_token | +Reset password token | +
| string | +rp_token_created_at | +Date when the password was reset | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer.info', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerCustomerInfo($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerInfo((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
+var_dump($result->result);
+ array + 'customer_id' => string '2' (length=1) + 'created_at' => string '2012-03-29 12:37:23' (length=19) + 'updated_at' => string '2012-03-30 12:59:21' (length=19) + 'increment_id' => null + 'store_id' => string '2' (length=1) + 'website_id' => string '2' (length=1) + 'confirmation' => null + 'created_in' => string 'English' (length=7) + 'default_billing' => null + 'default_shipping' => string '2' (length=1) + 'disable_auto_group_change' => string '0' (length=1) + 'dob' => null + 'email' => string 'john@example.com' (length=16) + 'firstname' => string 'johny' (length=5) + 'gender' => null + 'group_id' => string '1' (length=1) + 'lastname' => string 'doe' (length=3) + 'middlename' => null + 'password_hash' => string 'cccfb3ecf54c9644a34106783148eff2:sp' (length=35) + 'prefix' => null + 'rp_token' => string '15433dd072f1f4e5aae83231b93f72d0' (length=32) + 'rp_token_created_at' => string '2012-03-30 15:10:31' (length=19) + 'suffix' => null + 'taxvat' => null+
Allows you to retrieve the list of customers.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +filters | +Array of filters by customer attributes (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +storeView | +Array of customerCustomerEntity | +
The customerCustomerEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +customer_id | +ID of the customer | +
| string | +created_at | +Date when the customer was created | +
| string | +updated_at | +Date of when the customer was updated | +
| string | +increment_id | +Increment ID | +
| int | +store_id | +Store ID | +
| int | +website_id | +Website ID | +
| string | +created_in | +Created in | +
| string | +Customer email | +|
| string | +firstname | +Customer first name | +
| string | +middlename | +Customer middle name | +
| string | +lastname | +Customer last name | +
| int | +group_id | +Group ID | +
| string | +prefix | +Customer prefix | +
| string | +suffix | +Customer suffix | +
| string | +dob | +Customer date of birth | +
| string | +taxvat | +Taxvat value | +
| boolean | +confirmation | +Confirmation flag | +
| string | +password_hash | +Password hash | +
Note: The password_hash parameter will only match exactly with the same MD5 and salt as was used when Magento stored the value. If you try to match with an unsalted MD5 hash, or any salt other than what Magento used, it will not match. This is just a straight string comparison.
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer.list');
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerCustomerList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'group_id',
+ 'value' => array('key' => 'in', 'value' => '1,3')
+ )
+ )
+);
+$result = $client->customerCustomerList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerList((object)array('sessionId' => $sessionId->result, 'filters' => null));
+var_dump($result->result);
+ array + 0 => + array + 'customer_id' => string '2' (length=1) + 'created_at' => string '2012-03-29 12:37:23' (length=19) + 'updated_at' => string '2012-04-03 11:20:18' (length=19) + 'store_id' => string '2' (length=1) + 'website_id' => string '2' (length=1) + 'created_in' => string 'English' (length=7) + 'default_billing' => string '3' (length=1) + 'default_shipping' => string '3' (length=1) + 'disable_auto_group_change' => string '0' (length=1) + 'email' => string 'test@example.com' (length=16) + 'firstname' => string 'John' (length=4) + 'group_id' => string '1' (length=1) + 'lastname' => string 'Doe' (length=3) + 'password_hash' => string 'cccfb3ecf54c9644a34106783148eff2:sp' (length=35) + 'rp_token' => string '15433dd072f1f4e5aae83231b93f72d0' (length=32) + 'rp_token_created_at' => string '2012-03-30 15:10:31' (length=19) + 1 => + array + 'customer_id' => string '4' (length=1) + 'created_at' => string '2012-04-03 11:21:15' (length=19) + 'updated_at' => string '2012-04-03 11:22:57' (length=19) + 'store_id' => string '0' (length=1) + 'website_id' => string '2' (length=1) + 'created_in' => string 'Admin' (length=5) + 'default_billing' => string '8' (length=1) + 'default_shipping' => string '8' (length=1) + 'disable_auto_group_change' => string '0' (length=1) + 'email' => string 'shon@example.com' (length=16) + 'firstname' => string 'Shon' (length=4) + 'group_id' => string '1' (length=1) + 'lastname' => string 'McMiland' (length=8) + 'password_hash' => string '5670581cabba4e2189e5edee99ed0c86:5q' (length=35)+
Update information about the required customer. Note that you need to pass only those arguments which you want to be updated.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +Customer ID | +
| array | +customerData | +Array of customerCustomerEntityToCreate | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the customer is updated | +
The customerCustomerEntityToCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +customer_id | +Customer ID | +
| string | +Customer email | +|
| string | +firstname | +Customer first name | +
| string | +lastname | +Customer last name | +
| string | +password | +Customer password | +
| int | +group_id | +Group ID | +
| string | +prefix | +Customer prefix | +
| string | +suffix | +Customer suffix | +
| string | +dob | +Customer date of birth | +
| string | +taxvat | +Customer tax/VAT number | +
| int | +gender | +Customer gender: 1 - Male, 2 - Female | +
| string | +middlename | +Customer middle name/initial | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer.update', array('customerId' => '2', 'customerData' => array('firstname' => 'John', 'lastname' => 'Doe', 'email' => 'test@example.com', 'password' => 'john22')));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->customerCustomerUpdate($session, '2', array('email' => 'customer-mail@example.org', 'firstname' => 'Dough', 'lastname' => 'Deekson', 'password' => 'password', 'website_id' => 1, 'store_id' => 1, 'group_id' => 1));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerCustomerUpdate((object)array('sessionId' => $sessionId->result, 'customerId' => '2', 'customerData' => ((object)array(
+'email' => 'customer-mail@example.org',
+'firstname' => 'Dough',
+'lastname' => 'Deekson'
+))));
+var_dump($result->result);
+ Allows you to create, retrieve, update, and delete address data for a required customer.
+ +Resource Name: customer_address
+ +Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Invalid address data. Details in error message. | +
| 101 | +Customer not exists. | +
| 102 | +Address not exists. | +
| 103 | +Address not deleted. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+
+// Create new customer
+$newCustomer = array(
+ 'firstname' => 'First',
+ 'lastname' => 'Last',
+ 'email' => 'test@example.com',
+ 'password' => 'password',
+ 'store_id' => 0,
+ 'website_id' => 0
+);
+
+$newCustomerId = $proxy->call($sessionId, 'customer.create', array($newCustomer));
+
+//Create new customer address
+$newCustomerAddress = array(
+ 'firstname' => 'First',
+ 'lastname' => 'Last',
+ 'country_id' => 'USA',
+ 'region_id' => '43',
+ 'region' => 'New York',
+ 'city' => 'New York',
+ 'street' => array('street1','street2'),
+ 'telephone' => '5555-555',
+ 'postcode' => 10021,
+
+ 'is_default_billing' => true,
+ 'is_default_shipping' => true
+);
+
+$newAddressId = $proxy->call($sessionId, 'customer_address.create', array($newCustomerId, $newCustomerAddress));
+
+var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
+
+//Update customer address
+$proxy->call($sessionId, 'customer_address.update', array($newAddressId, array('firstname'=>'Changed Firstname')));
+
+var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
+
+// Delete customer address
+$proxy->call($sessionId, 'customer_address.delete', $newAddressId);
+
+var_dump($proxy->call($sessionId, 'customer_address.list', $newCustomerId));
+ Create a new address for the customer
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +Customer ID | +
| array | +addressdata | +Array of customerAddressEntityCreate | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +result | +ID of the created customer address | +
The customerAddressEntityCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + city |
+Name of the city | +
| string |
+ company |
+Name of the company | +
| string |
+ country_id |
+Country ID | +
| string |
+ fax |
+Fax | +
| string |
+ firstname |
+Customer first name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ middlename |
+Customer middle name | +
| string |
+ postcode |
+Postcode | +
| string |
+ prefix |
+Customer prefix | +
| int | + region_id |
+ID of the region | +
| string |
+ region |
+Name of the region | +
| ArrayOfString | + street |
+Array of street addresses | +
| string |
+ suffix |
+Customer suffix | +
| string |
+ telephone |
+Telephone number | +
| boolean | + is_default_billing |
+True if the address is the default one for billing | +
| boolean | + is_default_shipping |
+True if the address is the default one for shipping | +
Note: If you want to leave any address fields empty, specify them as empty ones in the request body.
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call(
+$session,
+'customer_address.create',
+array('customerId' => 2, 'addressdata' => array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE)));
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->customerAddressCreate($session, '2', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressCreate((object)array('sessionId' => $sessionId->result, 'customerId' => '2', 'addressData' => ((object)array(
+'city' => 'Weaverville',
+'country_id' => 'US',
+'postcode' => '96093',
+'region' => 'Texas',
+'street' => array('Street line 1', 'Streer line 2'),
+'telephone' => '847-431-7700',
+'lastname' => 'Doe',
+'firstname' => 'John',
+'is_default_billing' => true
+))));
+var_dump($result->result);
+ Delete the required customer address.
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +addressId | +Address ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the customer address is deleted | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer_address.delete', '4');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerAddressDelete($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressDelete((object)array('sessionId' => $sessionId->result, 'addressId' => '4'));
+var_dump($result->result);
+ Retrieve information about the required customer address.
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +addressId | +Address ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +info | +Array of customerAddressEntityItem | +
The customerAddressEntityItem content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + customer_address_id |
+ID of the customer address | +
| string | + created_at |
+Date when the address was created | +
| string | + updated_at |
+Date when the address was updated | +
| string | + increment_id |
+Increment ID | +
| string | + city |
+name of the city | +
| string | + company |
+Name of the company | +
| string | + country_id |
+ID of the country | +
| string | + fax |
+Fax | +
| string | + firstname |
+Customer first name | +
| string | + lastname |
+Customer last name | +
| string | + middlename |
+Customer middle name | +
| string | + postcode |
+Customer postcode | +
| string | + prefix |
+Customer prefix | +
| string | + region |
+Name of the region | +
| int | + region_id |
+Region ID | +
| string | + street |
+Name of the street | +
| string | + suffix |
+Customer suffix | +
| string | + telephone |
+Telephone number | +
| boolean | + is_default_billing |
+True if the address is the default one for billing | +
| boolean | + is_default_shipping |
+True if the address is the default one for shipping | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer_address.info', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerAddressInfo($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressInfo((object)array('sessionId' => $sessionId->result, 'addressId' => '2'));
+var_dump($result->result);
+ array + 'customer_address_id' => string '2' (length=1) + 'created_at' => string '2012-03-29 13:20:08' (length=19) + 'updated_at' => string '2012-03-29 13:20:08' (length=19) + 'increment_id' => null + 'city' => string 'Las Vegas' (length=9) + 'company' => null + 'country_id' => string 'US' (length=2) + 'fax' => null + 'firstname' => string 'johny' (length=5) + 'lastname' => string 'doe' (length=3) + 'middlename' => null + 'postcode' => string '89032' (length=5) + 'prefix' => null + 'region' => string 'Nevada' (length=6) + 'region_id' => string '39' (length=2) + 'street' => string '3406 Hiney Road' (length=15) + 'suffix' => null + 'telephone' => string '702-283-9556' (length=12) + 'vat_id' => null + 'vat_is_valid' => null + 'vat_request_date' => null + 'vat_request_id' => null + 'vat_request_success' => null + 'is_default_billing' => boolean false + 'is_default_shipping' => boolean true+
Retrieve the list of customer addresses.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +customerId | +Customer ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of customerAddressEntity | +
The customerAddressEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + customer_address_id |
+ID of the customer address | +
| string | + created_at |
+Date when the address was created | +
| string | + updated_at |
+Date when the address was updated | +
| string | + increment_id |
+Increment ID | +
| string | + city |
+City | +
| string | + company |
+Name of the company | +
| string | + country_id |
+ID of the country | +
| string | + fax |
+Fax | +
| string | + firstname |
+Customer first name | +
| string | + lastname |
+Customer last name | +
| string | + middlename |
+Customer middle name | +
| string | + postcode |
+Customer postcode | +
| string | + prefix |
+Customer prefix | +
| string | + region |
+Name of the region | +
| int | + region_id |
+Region ID | +
| string | + street |
+Name of the street | +
| string | + suffix |
+Customer suffix | +
| string | + telephone |
+Telephone number | +
| boolean | + is_default_billing |
+True if the address is the default one for billing | +
| boolean | + is_default_shipping |
+True if the address is the default one for shipping | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer_address.list', '2');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerAddressList($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressList((object)array('sessionId' => $sessionId->result, 'customerId' => '2'));
+var_dump($result->result);
+ array + 0 => + array + 'customer_address_id' => string '2' (length=1) + 'created_at' => string '2012-03-29 13:20:08' (length=19) + 'updated_at' => string '2012-03-29 13:39:29' (length=19) + 'city' => string 'Las Vegas' (length=9) + 'country_id' => string 'US' (length=2) + 'firstname' => string 'johny' (length=5) + 'lastname' => string 'doe' (length=3) + 'postcode' => string '89032' (length=5) + 'region' => string 'Nevada' (length=6) + 'region_id' => string '39' (length=2) + 'street' => string '3406 Hiney Road' (length=15) + 'telephone' => string '702-283-9556' (length=12) + 'is_default_billing' => boolean false + 'is_default_shipping' => boolean true + 1 => + array + 'customer_address_id' => string '3' (length=1) + 'created_at' => string '2012-03-29 13:39:29' (length=19) + 'updated_at' => string '2012-03-29 13:39:29' (length=19) + 'city' => string 'Corpus Christi' (length=14) + 'country_id' => string 'US' (length=2) + 'firstname' => string 'johny' (length=5) + 'lastname' => string 'doe' (length=3) + 'postcode' => string '78476' (length=5) + 'region' => string 'Texas' (length=5) + 'region_id' => string '57' (length=2) + 'street' => string '3672 Boone Street' (length=17) + 'telephone' => string '361-280-8488' (length=12) + 'vat_id' => string 'GB999 9999 73' (length=13) + 'is_default_billing' => boolean false + 'is_default_shipping' => boolean false+
Update address data of the required customer
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| int | +addressId | +Address ID | +
| array | +addressdata | +Array of customerAddressEntityCreate | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the customer address is updated | +
The customerAddressEntityCreate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + city |
+Name of the city | +
| string |
+ company |
+Name of the company | +
| string |
+ country_id |
+Country ID | +
| string |
+ fax |
+Fax | +
| string |
+ firstname |
+Customer first name | +
| string |
+ lastname |
+Customer last name | +
| string |
+ middlename |
+Customer middle name | +
| string |
+ postcode |
+Postcode | +
| string |
+ prefix |
+Customer prefix | +
| int | + region_id |
+ID of the region | +
| string |
+ region |
+Name of the region | +
| ArrayOfString | + street |
+Array of streets | +
| string |
+ suffix |
+Customer suffix | +
| string |
+ telephone |
+Telephone number | +
| boolean | + is_default_billing |
+True if the address is the default one for billing | +
| boolean | + is_default_shipping |
+True if the address is the default one for shipping | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call(
+$session,
+'customer_address.update',
+array('addressId' => 8, 'addressdata' => array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => TRUE, 'is_default_shipping' => FALSE)));
+var_dump ($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->customerAddressUpdate($session, '8', array('firstname' => 'John', 'lastname' => 'Doe', 'street' => array('Street line 1', 'Streer line 2'), 'city' => 'Weaverville', 'country_id' => 'US', 'region' => 'Texas', 'region_id' => 3, 'postcode' => '96093', 'telephone' => '530-623-2513', 'is_default_billing' => FALSE, 'is_default_shipping' => FALSE));
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerAddressUpdate((object)array('sessionId' => $sessionId->result, 'addressId' => '8', 'addressData' => ((object)array(
+'firstname' => 'John',
+'lastname' => 'Doe',
+'street' => array('Street line 1', 'Streer line 2'),
+'city' => 'Weaverville',
+'country_id' => 'US',
+'region' => 'Texas',
+'region_id' => 3,
+'postcode' => '96093',
+'telephone' => '530-623-2513',
+'is_default_billing' => TRUE,
+'is_default_shipping' => TRUE
+))));
+var_dump($result->result);
+ Allows you to export customer groups from Magento
+ +Retrieve the list of customer groups
+ + +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +An array of customerGroupEntity | +
The customerGroupEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + customer_group_id |
+ID of the customer group | +
| string | + customer_group_code |
+Customer group code | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'customer_group.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->customerGroupList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->customerGroupList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'customer_group_id' => string '0' (length=1) + 'customer_group_code' => string 'NOT LOGGED IN' (length=13) + 1 => + array + 'customer_group_id' => string '1' (length=1) + 'customer_group_code' => string 'General' (length=7) + 2 => + array + 'customer_group_id' => string '2' (length=1) + 'customer_group_code' => string 'Wholesale' (length=9) + 3 => + array + 'customer_group_id' => string '3' (length=1) + 'customer_group_code' => string 'Retailer' (length=8)+
The Mage_Directory module allows you to retrieve country and region data.
+ +Allows you to retrieve a list of countries.
+ +Resource Name: directory_country
+ +Aliases:
+Methods:
+Allows you to retrieve a list of regions within a country.
+ +Resource Name: directory_region
+ +Aliases:
+Methods:
+Allows you to retrieve the list of countries from Magento.
+ +Module: Mage_Directory
+ +Resource: directory_country
+ +Aliases:
+Retrieve the list of countries from Magento.
+ +Aliases:
+| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| Type | +Name | +Description | +
|---|---|---|
| array | +countries | +An array of directoryCountryEntity | +
The directoryCountryEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +country_id | +ID of the retrieved country | +
| string | +iso2_code | +ISO 2-alpha code | +
| string | +iso3_code | +ISO 3-alpha code | +
| string | +name | +Name of the retrieved country | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$countries = $proxy->call($sessionId, 'country.list');
+var_dump($countries); // Countries list.
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->directoryCountryList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->directoryCountryList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'country_id' => string 'AD' (length=2) + 'iso2_code' => string 'AD' (length=2) + 'iso3_code' => string 'AND' (length=3) + 'name' => string 'Andorra' (length=7) + 1 => + array + 'country_id' => string 'AE' (length=2) + 'iso2_code' => string 'AE' (length=2) + 'iso3_code' => string 'ARE' (length=3) + 'name' => string 'United Arab Emirates' (length=20) + 2 => + array + 'country_id' => string 'AF' (length=2) + 'iso2_code' => string 'AF' (length=2) + 'iso3_code' => string 'AFG' (length=3) + 'name' => string 'Afghanistan' (length=11)+
Allows you to export the list of regions from Magento
+ +Aliases:
+Retrieve the list of regions in the specified country.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +country | +Country code in ISO2 or ISO3 | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | + directoryRegionEntityArray |
+An array of directoryRegionEntity | +
The directoryRegionEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +region_id | +ID of the region | +
| string | +code | +Region code | +
| string | +name | +Name of the region | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Country not exists. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$regions = $proxy->call($sessionId, 'region.list', 'US');
+
+var_dump($regions); // Region list for USA.
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->directoryRegionList($sessionId,'US');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->directoryRegionList((object)array('sessionId' => $sessionId->result, 'country' => 'US'));
+var_dump($result->result);
+ array + 0 => + array + 'region_id' => string '1' (length=1) + 'code' => string 'AL' (length=2) + 'name' => string 'Alabama' (length=7) + 1 => + array + 'region_id' => string '2' (length=1) + 'code' => string 'AK' (length=2) + 'name' => string 'Alaska' (length=6) + 2 => + array + 'region_id' => string '3' (length=1) + 'code' => string 'AS' (length=2) + 'name' => string 'American Samoa' (length=14) + 3 => + array + 'region_id' => string '4' (length=1) + 'code' => string 'AZ' (length=2) + 'name' => string 'Arizona' (length=7)+
| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1003 | +Provided data is invalid | +
| 1004 | +Gift card account with requested code does not exist | +
| 1005 | +Error happened while adding gift card to quote | +
Allows you to add a gift card to the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +giftcardAccountCode | +Gift card account code | +
| int | +quoteId | +Shopping cart ID (quote ID) | +
| int | +storeId | +Store ID (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the gift card is added to the quote | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1004 | +Gift card account with requested code does not exist | +
| 1005 | +Error happened while adding gift card to quote | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$code = "giftcardAccountCode";
+$quoteId = 15;
+
+$giftcardList = $proxy->call(
+ $sessionId,
+ "cart_giftcard.add",
+ array(
+ $code,
+ $quoteId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartGiftcardAdd($sessionId, 'giftcardAccountCode', '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartGiftcardAdd((object)array('sessionId' => $sessionId->result, 'giftcardAccountCode' => 'giftcardAccountCode', 'quoteId' => '15', 'storeId' => '3'));
+
+var_dump($result->result);
+ Allows you to retrieve the list of gift cards used in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| string | +storeId | +Store ID (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of enterpriseGiftcardaccountListEntity | +
The enterpriseGiftcardaccountListEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +giftcardaccount_id | +Gift card account ID | +
| string |
+ code |
+Gift card code | +
| string |
+ used_amount |
+Used amount (in store currency) | +
| string |
+ base_amount |
+Base amount (in base currency) | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$quoteId = 15;
+
+$giftcardList = $proxy->call(
+ $sessionId,
+ "cart_giftcard.list",
+ array(
+ $quoteId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartGiftcardList($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartGiftcardList((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'storeId' => '3'));
+
+var_dump($result->result);
+ array + 0 => + array + 'giftcardaccount_id' => string '5' (length=1) + 'code' => string 'code' (length=12) + 'used_amount' => float 141.34 + 'base_amount' => string '200.0000' (length=8) + 1 => + array + 'giftcardaccount_id' => string '6' (length=1) + 'code' => string 'code' (length=12) + 'used_amount' => float 35.34 + 'base_amount' => string '50.0000' (length=7)+
Allows you to remove a gift card from the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +giftcardAccountCode | +Gift card account code | +
| string |
+quoteId | +Shopping cart ID (quote ID) | +
| string |
+storeId | +Store ID (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the gift card is removed from the shopping cart | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1004 | +Gift card account with requested code does not exist | +
| 1005 | +Error happened while adding gift card to quote | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$code = "giftcardAccountCode";
+$quoteId = 15;
+
+$giftcardList = $proxy->call(
+ $sessionId,
+ "cart_giftcard.remove",
+ array(
+ $code,
+ $quoteId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartGiftcardRemove($sessionId, 'giftcardAccountCode', '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartGiftcardRemove((object)array('sessionId' => $sessionId->result, 'giftcardAccountCode' => 'giftcardAccountCode', 'quoteId' => '15', 'storeId' => '3'));
+
+var_dump($result->result);
+ Allows you to retrieve information on a gift card and redeem gift card amount.
+ +Resource Name: giftcard_customer
+ + +Allows you to retrieve, add, and remove a gift card from/to a shopping cart.
+ +Resource Name: cart_giftcard
+ + +Allows you to create, update, remove, and retrieve information on a gift card account.
+ +Resource Name: giftcard_account
+ + +Allows you to operate with giftcards.
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
| 101 | +Invalid filters specified. Details in error message. | +
| 102 | +Unable to save data. | +
| 104 | +Provided email notification data is invalid | +
| 105 | +Provided gift card account data is invalid | +
| 106 | +Gift card account with requested id does not exist | +
| 107 | +Error occurs while deleting gift card | +
Allows you to create a new gift card account.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +giftcardAccountData | +Array of giftcardAccountCreateGiftcardAccountData | +
| array | +notificationData | +Array of giftcardAccountCreateNotificationData (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| string | +ID of the created gift card account | +
The giftcardAccountCreateGiftcardAccountData content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + status |
+Gift card status: available, used, redeemed, expired | +
| string |
+ date_expires |
+ Gift card expiration date in the YYYY-MM-DD format |
+
| string |
+ website_id |
+ Gift card website ID |
+
| string |
+ balance |
+ Initial gift card balance |
+
| string |
+ state |
+State: active or not active | +
| string |
+ is_redeemable |
+Defines whether the gift card is redeemable | +
The giftcardAccountCreateNotificationData content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + recipient_name |
+Recipient name | +
| string | + recipient_email |
+Recipient email address | +
| string | + recipient_store |
+Recipient store | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 105 | +Provided gift card account data is invalid. | +
| 104 | +Provided email notification data is invalid | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardToCreate = array(
+ "status" => 'available',
+ "is_redeemable" => 1,
+ "balance" => 200,
+ "website_id" => 2,
+ "date_expires" => null
+);
+
+$giftcardId = $proxy->call(
+ $sessionId,
+ "giftcard_account.create",
+ array(
+ $giftcardToCreate
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->giftcardAccountCreate($sessionId, array(
+'status' => 'available',
+'date_expires' => null,
+'website_id' => '2',
+'balance' => '200',
+'state' => '1',
+'is_redeemable' => '1'),
+array(
+'recipient_name' => 'name',
+'recipient_email' => 'email',
+'recipient_store' => null)
+);
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountCreate((object)array('sessionId' => $sessionId->result, 'giftcardAccountData' => array(
+'status' => 'available',
+'date_expires' => null,
+'website_id' => '2',
+'balance' => '200',
+'state' => '1',
+'is_redeemable' => '1'),
+'notificationData' => array(
+'recipient_name' => 'name',
+'recipient_email' => 'email',
+'recipient_store' => null)
+));
+
+var_dump($result->result);
+ Allows you to receive full information about the selected gift card account.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +giftcardAccountId | +Gift card account ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of giftcardAccountEntity | +
The giftcardAccountEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | +giftcard_id | +Gift card account ID | +
| string | + code |
+Gift card account code | +
| int | + store_id |
+Gift card account store ID | +
| string | + date_created |
+Creation date in the YYYY-MM-DD format | +
| string | + expire_date |
+Expiration date in the YYYY-MM-DD format | +
| int | + is_active |
+Defines whether the gift card account is active | +
| int | + is_redeemable |
+Defines whether the gift card account is redeemable | +
| string | + status |
+Gift card account status | +
| double | + balance |
+Gift card account initial balance | +
| array | + history |
+Array of giftcardAccountEntityHistory | +
The giftcardAccountEntityHistory content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + record_id |
+Record ID | +
| string | + date |
+Date | +
| string | + action |
+ History action |
+
| double | + balance_delta |
+Balance delta | +
| double | + balance |
+Balance | +
| string | + info |
+ Record comment |
+
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardId = 1;
+$giftcardInfo = $proxy->call(
+ $sessionId,
+ "giftcard_account.info",
+ array(
+ $giftcardId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardAccountInfo($sessionId, '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountInfo((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '1'));
+
+var_dump($result->result);
+ array + 'giftcard_id' => string '1' (length=1) + 'code' => string '02DQ9T1K0Y0V' (length=12) + 'store_id' => string '0' (length=1) + 'date_created' => string '2012-04-06' (length=10) + 'expire_date' => null + 'is_active' => string '0' (length=1) + 'status' => string 'Available' (length=9) + 'balance' => string '0.0000' (length=6) + 'is_redeemable' => string '1' (length=1) + 'history' => + array + 0 => + array + 'record_id' => string '1' (length=1) + 'date' => string '2012-04-06 14:31:57' (length=19) + 'action' => string 'Created' (length=7) + 'balance_delta' => string '0.0000' (length=6) + 'balance' => string '0.0000' (length=6) + 'info' => null+
Allows you to retrieve the list of available gift card accounts.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +filters | +Array of filters (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of giftcardAccountEntity | +
The giftcardAccountEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + giftcard_id |
+Gift card ID | +
| string | + code |
+Gift card code | +
| int | + store_id |
+Gift card store ID | +
| string | + date_created |
+ Creation date in the YYYY-MM-DD format |
+
| string | + expire_date |
+ Expiration date in the YYYY-MM-DD format |
+
| int | + is_active |
+Defines whether the gift card is active | +
| string | + status |
+Gift card status | +
| double | + balance |
+Gift card balance | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Invalid filters specified. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardList = $proxy->call(
+ $sessionId,
+ "giftcard_account.list"
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardAccountList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'state',
+ 'value' => array('key' => 'in', 'value' => '2,1')
+ )
+ )
+);
+$result = $client->giftcardAccountList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountList((object)array('sessionId' => $sessionId->result, 'filters' => null));
+
+var_dump($result->result);
+ array + 0 => + array + 'giftcard_id' => string '1' (length=1) + 'code' => string 'code' (length=12) + 'store_id' => string '2' (length=1) + 'date_created' => string '2012-04-06' (length=10) + 'expire_date' => string '2012-04-22' (length=10) + 'is_active' => string '0' (length=1) + 'status' => string 'Available' (length=9) + 'balance' => string '300.0000' (length=8) + 1 => + array + 'giftcard_id' => string '2' (length=1) + 'code' => string 'code' (length=12) + 'store_id' => string '2' (length=1) + 'date_created' => string '2012-04-09' (length=10) + 'expire_date' => string '2012-04-25' (length=10) + 'is_active' => string '1' (length=1) + 'status' => string 'Available' (length=9) + 'balance' => string '500.0000' (length=8)+
Allows you to remove the specified gift card account.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +giftcardAccountId | +Gift card account ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the gift card account is removed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 106 | +Gift card account with requested id does not exist | +
| 107 | +Error occurs while deleting gift card | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardId = 2;
+$result = $proxy->call(
+ $sessionId,
+ "giftcard_account.remove",
+ array(
+ $giftcardId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardAccountRemove($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountRemove((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '2'));
+
+var_dump($result->result);
+ Allows you to update the required gift card account.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +giftcardAccountId | +Gift card account ID | +
| array | +giftcardData | +Array of giftcardAccountEntityToUpdate | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True is the gift card account is updated | +
The giftcardAccountEntityToUpdate content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| boolean | + is_active |
+Defines whether the gift card account is active | +
| boolean | + is_redeemable |
+Defines whether the gift card account is redeemable | +
| int | + store_id |
+Store view ID | +
| double | + balance |
+Gift card account initial balance | +
| string | + date_expires |
+Expiration date in the YYYY-MM-DD format | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 102 | +Unable to save data. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$giftcardId = 1;
+$giftcardToUpdate = array(
+ "balance" => 700
+);
+
+$result = $proxy->call(
+ $sessionId,
+ "giftcard_account.update",
+ array(
+ $giftcardId,
+ $giftcardToUpdate
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+
+$sessionId = $proxy->login('apiUser', 'apiKey');Â
+Â
+$result = $proxy->giftcardAccountUpdate($sessionId, '3', array(
+'date_expires' => null,Â
+'store_id' => '2',Â
+'balance' => '700',Â
+'is_active' => TRUE,Â
+'is_redeemable' => TRUE)); Â Â
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardAccountUpdate((object)array('sessionId' => $sessionId->result, 'giftcardAccountId' => '3', 'giftcardData' => array(
+'balance' => '700',
+'is_active' => TRUE,
+'is_redeemable' => TRUE,
+'store_id' => '2',
+'date_expires' => null)));
+
+var_dump($result->result);
+ | Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
| 101 | +Gift card is not valid. | +
| 103 | +Redemption functionality is disabled. | +
| 104 | +Unable to redeem gift card. | +
Allows you to receive information about the gift card for a selected customer.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +code | +Gift card code | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of giftcardCustomerEntity | +
The giftcardCustomerEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| double | + balance |
+Gift card balance | +
| string | + expire_date |
+Gift card expiration date in the YYYY-MM-DD format | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
| 101 | +Gift card is not valid. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$code = "code";
+
+$giftcardInfo = $proxy->call(
+ $sessionId,
+ "giftcard_customer.info",
+ array(
+ $code
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardCustomerInfo($sessionId, 'code');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardCustomerInfo((object)array('sessionId' => $sessionId->result, 'code' => 'code'));
+
+var_dump($result->result);
+ array + 'balance' => string '500.0000' (length=8) + 'expire_date' => string '2012-04-25' (length=10)+
Allows you to redeem amount from a giftcard to the customer store credit.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +code | +Gift card code | +
| string |
+customer_id | +Customer ID | +
| string |
+store_id | +Store view ID | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the amount is redeemed | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Gift card does not exists. | +
| 101 | +Gift card is not valid. | +
| 103 | +Redemption functionality is disabled. | +
| 104 | +Unable to redeem gift card. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$code = "giftcardcode";
+$customerId = 1;
+$storeId = 1;
+
+$giftcardInfo = $proxy->call(
+ $sessionId,
+ "giftcard_customer.redeem",
+ array(
+ $code,
+ $customerId,
+ $storeId
+ )
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->giftcardCustomerRedeem($sessionId, 'giftcardcode', '1', '1');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftcardCustomerRedeem((object)array('sessionId' => $sessionId->result, 'code' => 'giftcardcode', 'customerId' => '1', 'storeId' => '1'));
+
+var_dump($result->result);
+ This module allows you to set a gift message for a quote or for a product in a quote.
+ + +| Fault Code | +Fault Message | +
|---|---|
| 1001 | +Can not make operation because store is not exists | +
| 1002 | +Can not make operation because quote is not exists | +
| 1101 | +Gift message data is not valid. | +
| 1102 | +Product's data is not valid. | +
| 1103 | +Quote item is not exists | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Create a quote, get quote identifier
+$shoppingCartId = $proxy->call( $sessionId, 'cart.create', array( 'magento_store' ) );
+
+// set gift message for quote
+$giftMessage = array (
+ 'from' => 'test',
+ 'to' => 'test',
+ 'message' => 'test'
+);
+
+$giftMessageSetForQuoteResult = $proxy->call($sessionId,"giftmessage.setForQuote", array($shoppingCartId, $giftMessage, 'magento_store'));
+print_r( $giftMessageSetForQuoteResult );
+
+
+// add products into shopping cart
+$arrProducts = array(
+ array(
+ 'product_id' => '1',
+ 'qty' => 2
+ ),
+ array(
+ 'sku' => 'testSKU',
+ 'qty' => 4
+ )
+);
+$resultCartProductAdd = $proxy->call($sessionId, 'cart_product.add', array($shoppingCartId, $arrProducts));
+
+// set gift message for product
+$giftMessage = array (
+ 'from' => 'test for Product',
+ 'to' => 'test for Product',
+ 'message' => 'test for Product'
+);
+
+/**
+* Note:
+* array for product should be the same as for cart_product.add
+*/
+$giftMessageSetForProductResult = $proxy->call(
+ $sessionId,
+ "giftmessage.setForQuoteProduct",
+ array(
+ $shoppingCartId,
+ array(
+ array(
+ 'product' => $arrProducts[0],
+ 'giftmessage' => $giftMessage,
+ ),
+ array(
+ 'product' => $arrProducts[1],
+ 'giftmessage' => $giftMessage,
+ )
+ ),
+ 'magento_store'
+ )
+);
+
+print_r( $giftMessageSetForProductResult );
+ Allows you to set a global gift message for the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| array | +giftMessage | +Array of giftMessageEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +giftMessageResponse | +
The giftMessageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + from |
+Gift message sender | +
| string |
+ to |
+Gift message recipient | +
| string |
+ message |
+Gift message text | +
The giftMessageResponse content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + entityId |
+Entity ID | +
| boolean | + result |
+Result of adding a message | +
| string | + error |
+Error | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'giftmessage.setForQuote', array('quoteId' => '10', 'giftMessage' => array('from' => 'John', 'to' => 'Sara', 'message' => 'Gift message text')));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+
+$sessionId = $proxy->login('apiUser', 'apiKey');Â
+Â
+$result = $proxy->giftMessageSetForQuote($sessionId, 10, array(
+'from' => 'John',
+'to' => 'Sara',
+'message' => 'Gift message text'
+)); Â
+Â
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftMessageSetForQuote((object)array('sessionId' => $sessionId->result, 'quoteId' => '10', 'giftMessage' => array(
+'from' => 'John',
+'to' => 'Sara',
+'message' => 'Gift message text'
+)));
+
+var_dump($result);
+ array + 'entityId' => string '15' (length=2) + 'result' => boolean true + 'error' => string '' (length=0)+
Allows you to set a gift message for an item in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteItemId | +Shopping cart (quote) item ID | +
| array | +giftMessage | +Array of giftMessageEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +giftMessageResponse | +
The giftMessageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + from |
+Gift message sender | +
| string | + to |
+Gift message recipient | +
| string | + message |
+Gift message | +
The giftMessageResponse content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + entityId |
+Entity ID | +
| boolean | + result |
+Result of adding a message | +
| string | + error |
+Error | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'giftmessage.setForQuoteItem', array('quoteItemId' => '1', 'giftMessage' => array('from' => 'John', 'to' => 'Sara', 'message' => 'Gift message text')));
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->giftMessageSetForQuoteItem($sessionId, '1', array(
+'from' => 'John',
+'to' => 'Sara',
+'message' => 'Gift message text'
+));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');Â
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));Â
+Â
+$result = $proxy->giftMessageSetForQuoteItem((object)array('sessionId' => $sessionId->result, 'quoteItemId' => '1', 'giftMessage' => array(
+'from' => 'John',
+'to' => 'Sara',
+'message' => 'Gift message text'
+))); Â
+Â
+var_dump($result);
+ array + 'entityId' => string '1' (length=1) + 'result' => boolean true + 'error' => string '' (length=0)+
Allows you to set a gift message for a product in the shopping cart (quote).
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| array | + productsAndMessages |
+Array of giftMessageAssociativeProductsEntity | +
| string | +store | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of giftMessageResponse | +
The giftMessageAssociativeProductsEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +product | +Array of shoppingCartProductEntity | +
| array | + message |
+Array of giftMessageEntity | +
The giftMessageResponse content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + entityId |
+Entity ID | +
| boolean | + result |
+Result | +
| string | + error |
+Error | +
The shoppingCartProductEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + product_id |
+ ID of the product |
+
| string | + sku |
+ SKU of the product |
+
| double | + qty |
+ Number of products |
+
| associativeArray |
+ options |
+An array of options | +
| associativeArray |
+ bundle_option |
+ An array of bundle item options |
+
| associativeArray |
+ bundle_option_qty |
+ An array of bundle items quantity |
+
| ArrayOfString | + links |
+ An array of links |
+
The giftMessageEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + from |
+Gift message sender | +
| string | + to |
+Gift message recipient | +
| string | + message |
+Gift message | +
Faults:
+No Faults.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->call($sessionId, 'giftmessage.setForQuoteProduct', array(10, array(
+'product' => array(
+ 'product_id' => '5',
+ 'sku' => 'sku',
+ 'qty' => '1',
+ 'options' => null,
+ 'bundle_option' => null,
+ 'bundle_option_qty' => null,
+ 'links' => null),
+'message' => array(
+ 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
+)));
+
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->giftMessageSetForQuoteProduct($sessionId, '10', array(array(
+'product' => array(
+ 'product_id' => '5',
+ 'sku' => 'sku',
+ 'qty' => '1',
+ 'options' => null,
+ 'bundle_option' => null,
+ 'bundle_option_qty' => null,
+ 'links' => null),
+'message' => array(
+ 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
+)));
+
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->giftMessageSetForQuoteProduct((object)array('sessionId' => $sessionId->result, 'quoteId' => '10', 'productsAndMessages' => array(array(
+'product' => array(
+ 'product_id' => '5',
+ 'sku' => 'sku',
+ 'qty' => '1',
+ 'options' => null,
+ 'bundle_option' => null,
+ 'bundle_option_qty' => null,
+ 'links' => null),
+'message' => array(
+ 'from' => 'Sara', 'to' => 'John', 'message' => 'Gift message text')
+))));
+
+var_dump($result->result);
+ Allows you to retrieve the customer store credit balance amount.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +customerId | +Customer ID | +
| string | +websiteId | +Website ID | +
Return:
+ +| Type | +Description | +
|---|---|
| string/float | +Virtual balance amount | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 101 | +No balance found with requested parameters. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$customerId = 4;
+$websiteId = 2;
+
+$balanceAmount = $proxy->call($sessionId, 'storecredit.balance', array($customerId, $websiteId));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->enterpriseCustomerbalanceBalance($sessionId, '4', '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->enterpriseCustomerbalanceBalance((object)array('sessionId' => $sessionId->result, 'customerId' => '4', 'websiteId' => '2'));
+var_dump($result->result);
+ Allows you to retrieve the customer store credit history information.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +customerId | +Customer ID | +
| string | +websiteId | +Website ID (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of enterpriseCustomerbalanceHistoryItemEntity | +
The enterpriseCustomerbalanceHistoryItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +history_id | + History item ID |
+
| string |
+ balance_id |
+ Customer balance ID |
+
| string |
+ updated_at |
+Date when the balance was updated | +
| string |
+ action |
+ Code of the reason for balance change |
+
| string |
+ balance_amount |
+ Balance amount after changing |
+
| string |
+ balance_delta |
+ Balance change amount |
+
| string |
+ additional_info |
+ Comment text |
+
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ customer_id |
+ Balance owner ID |
+
| string |
+ website_id |
+Website ID | +
| string |
+ base_currency_code |
+ Currency code for the customer balance |
+
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 102 | +No history found with requested parameters. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$customerId = 4;
+
+$balanceHistory = $proxy->call($sessionId, 'storecredit.history', array($customerId));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->enterpriseCustomerbalanceHistory($sessionId, '4');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->enterpriseCustomerbalanceHistory((object)array('sessionId' => $sessionId->result, 'customerId' => '4', 'websiteId' => '2'));
+var_dump($result->result);
+ array + 0 => + array + 'history_id' => string '2' (length=1) + 'balance_id' => string '1' (length=1) + 'updated_at' => string '2012-04-06 13:50:33' (length=19) + 'action' => string '1' (length=1) + 'balance_amount' => string '300.0000' (length=8) + 'balance_delta' => string '-200.0000' (length=9) + 'additional_info' => string 'By admin: john@example.com. (update balance)' (length=44) + 'is_customer_notified' => string '0' (length=1) + 'customer_id' => string '4' (length=1) + 'website_id' => string '2' (length=1) + 'base_currency_code' => null + 1 => + array + 'history_id' => string '1' (length=1) + 'balance_id' => string '1' (length=1) + 'updated_at' => string '2012-04-06 13:44:58' (length=19) + 'action' => string '2' (length=1) + 'balance_amount' => string '500.0000' (length=8) + 'balance_delta' => string '500.0000' (length=8) + 'additional_info' => string 'By admin: john@example.com. (new balance)' (length=41) + 'is_customer_notified' => string '0' (length=1) + 'customer_id' => string '4' (length=1) + 'website_id' => string '2' (length=1) + 'base_currency_code' => null+
Allows you to operate with customer virtual balance.
+ + +Aliases: storecredit
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 101 | +No balance found with requested parameters. | +
| 102 | +No history found with requested parameters. | +
Allows you to operate with customer virtual balance.
+ +Aliases: storecredit
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 101 | +No balance found with requested parameters. | +
| 102 | +No history found with requested parameters. | +
Aliases: storecredit_quote
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 103 | +No quote found with requested id. | +
| 104 | +Store credit can not be used for quote created by guest. | +
| 105 | +No store found with requested id or code. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$customerId = 10002;
+$websiteId = 1;
+// Get customer balance amount
+$balanceAmount = $proxy->call($sessionId, 'storecredit.balance', array($customerId, $websiteId));
+echo $balanceAmount . "<br />";
+// Get store credit history for specified customer
+$balanceHistory = $proxy->call($sessionId, 'storecredit.history', array($customerId));
+print_r($balanceHistory);
+
+$quoteId = 2;
+$store = 'default';
+// Set customer balance use in shopping cart (quote)
+$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.setAmount', array($quoteId, $store));
+echo $balanceAmountUsedInQuote . "<br />";
+// Unset customer balance use in shopping cart (quote)
+$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.removeAmount', array($quoteId));
+echo $balanceAmountUsedInQuote;
+ Allows you to operate with customer virtual balance.
+ +Aliases: storecredit_quote
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 103 | +No quote found with requested id. | +
| 104 | +Store credit can not be used for quote created by guest. | +
| 105 | +No store found with requested id or code. | +
Allows you to remove store credit amount from the shopping cart (quote) and increase the customer store credit.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| string | +store | +Store view code or ID (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean | +Result of removing the amount | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 103 | +No quote found with requested id. | +
| 104 | +Store credit can not be used for quote created by guest. | +
| 105 | +No store found with requested id or code. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$quoteId = 15;
+
+$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.removeAmount', array($quoteId));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCustomerbalanceRemoveAmount($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCustomerbalanceRemoveAmount((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'store' => null));
+var_dump($result->result);
+ Allows you to set amount from the customer store credit to the shopping cart.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +quoteId | +Shopping cart ID (quote ID) | +
| string | +store | +Store view code or ID (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| float | +Customer balance amount used in the shopping cart (quote) | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Provided data is invalid. | +
| 103 | +No quote found with requested id. | +
| 104 | +Store credit can not be used for quote created by guest. | +
| 105 | +No store found with requested id or code. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$quoteId = 2;
+$store = 'default';
+
+$balanceAmountUsedInQuote = $proxy->call($sessionId, 'storecredit_quote.setAmount', array($quoteId, $store));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->shoppingCartCustomerbalanceSetAmount($sessionId, '15');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->shoppingCartCustomerbalanceSetAmount((object)array('sessionId' => $sessionId->result, 'quoteId' => '15', 'store' => null));
+var_dump($result->result);
+ The Magento SOAP v1 API provides you with the ability to manage your eCommerce stores by providing calls for working with resources such as customers, categories, products, and sales orders. It also allows you to manage shopping carts and inventory.
+ +A SOAP v2 API version has been available since Magento 1.3, and a WS-I compliant version has been available since Magento 1.6.
+ +The Magento API supports SOAP and XML-RPC, where SOAP is the default protocol.
+ +To connect to Magento SOAP web services, load the WSDL into your SOAP client from either of these URLs:
+ +http://magentohost/api/?wsdl+
http://magentohost/api/soap/?wsdl+
where magentohost is the domain for your Magento host.
+ +As of v1.3, you may also use the following URL to access the Magento API v2, which has been added to improve compatibility with Java and .NET:
+ +http://magentohost/api/v2_soap?wsdl=1+
The following PHP example shows how to make SOAP calls to the Magento API v1:
+ +$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'somestuff.method');
+$result = $client->call($session, 'somestuff.method', 'arg1');
+$result = $client->call($session, 'somestuff.method', array('arg1', 'arg2', 'arg3'));
+$result = $client->multiCall($session, array(
+ array('somestuff.method'),
+ array('somestuff.method', 'arg1'),
+ array('somestuff.method', array('arg1', 'arg2'))
+));
+
+
+// If you don't need the session anymore
+$client->endSession($session);
+ To use XML-RPC, load the following URL into your XML-RPC client:
+ +http://magentohost/api/xmlrpc/+
where magentohost is the domain for your Magento host.
+ +The following PHP example shows how to make XML-RPC calls:
+ +$client = new Zend_XmlRpc_Client('http://magentohost/api/xmlrpc/');
+
+// If somestuff requires API authentication,
+// we should get session token
+$session = $client->call('login', array('apiUser', 'apiKey'));
+
+$client->call('call', array($session, 'somestuff.method', array('arg1', 'arg2', 'arg3')));
+$client->call('call', array($session, 'somestuff.method', array('arg1')));
+$client->call('call', array($session, 'somestuff.method'));
+$client->call('multiCall', array($session,
+ array(
+ array('somestuff.method', 'arg1'),
+ array('somestuff.method', array('arg1', 'arg2')),
+ array('somestuff.method')
+ )
+));
+
+// If you don't need the session anymore
+$client->call('endSession', array($session));
+ The XML-RPC only supports the version 1 of the Magento API.
+ +The following table contains the API methods that can be called from your SOAP or XML-RPC client on the Magento v1 API.
+ + + +| Method | +Description | +Return Value | +
|---|---|---|
| startSession() | +Start the API session and return session ID. | +string | +
| endSession(sessionId) | +End the API session. | +boolean | +
| login(apiUser, apiKey) | +Start the API session, return the session ID, and authorize the API user. | +string | +
| call(sessionId, resourcePath,array arguments) | +Call the API resource that is allowed in the current session. See Note below. | +mixed | +
| multiCall(sessionId, array calls,array options) | +Call the API resource’s methods that are allowed for current session. See Notes below. | +array | +
| resources(sessionId) | +Return a list of available API resources and methods allowed for the current session. | +array | +
| globalFaults(sessionId) | +Return a list of fault messages and their codes that do not depend on any resource. | +array | +
| resourceFaults(sessionId, resourceName) | +Return a list of the specified resource fault messages, if this resource is allowed in the current session. | +array | +
Note: For call and multiCall, if no session is specified, you can call only resources that are not protected by ACL.
+ +Note: For multiCall, if the "break" option is specified, multiCall breaks on first error.
+ +The Magento SOAP API v2 does not support the call() and multiCall() methods, and instead provides a separate method for each API resource.
+ +The following table contains fault codes that apply to all SOAP/XML-RPC API calls.
+ +| Fault Code | +Fault Message | +
|---|---|
| 0 | +Unknown Error | +
| 1 | +Internal Error. Please see log for details. | +
| 2 | +Access denied. | +
| 3 | +Invalid API path. | +
| 4 | +Resource path is not callable. | +
Since Magento 1.3, version v2 of the SOAP API has also been available. The main difference between v1 and v2 is that instead of using methods call and multiCall, it has separate methods for each action.
+ +For example, consider the following PHP code using SOAP v1.
+$params = array(array(
+ 'status'=>array('eq'=>'pending'),
+ 'customer_is_guest'=>array('eq'=>'1'))
+));
+$result = $client->call($sessionId, 'sales_order.list', $params);
+ With SOAP v2, the following code would be equivalent.
+$params = array('filter' => array(
+ array('key' => 'status', 'value' => 'pending'),
+ array('key' => 'customer_is_guest', 'value' => '1')
+));
+$result = $client->salesOrderList($sessionId, $params);
+ Note that the WSDL for SOAP v1 and SOAP v2 are different. Note that in SOAP v1, customizing the API did not involve changing the WSDL. In SOAP v2, changes to the WSDL are required.
+ +You can configure the SOAP v2 API to be WS-I compliant in the system configuration menu. To do this, set Services > Magento Core API > WS-I Compliance to Yes.
+ +Note that the WSDL for the SOAP v2 API is different when in WS-I compliant mode.
+ +Using the WS-I compliant SOAP v2 API WSDL, it is easy to automatically generate client classes for Java, .NET, and other languages using standard libraries.
+ + + diff --git a/guides/v19.x/api/soap/miscellaneous/magento.info.html b/guides/v19.x/api/soap/miscellaneous/magento.info.html new file mode 100644 index 0000000000..655ef33b39 --- /dev/null +++ b/guides/v19.x/api/soap/miscellaneous/magento.info.html @@ -0,0 +1,118 @@ +--- +layout: v1x_soap +title: Magento Info +--- + +Allows you to get information about the current Magento installation.
+ +Aliases: magento
+ + +Allows you to retrieve information about Magento version and edition.
+ +Aliases: magento.info
+ +Arguments:
+ +| Type |
+ Name |
+ Description |
+
|---|---|---|
| string |
+ sessionId |
+Session ID | +
Returns:
+ +| Type |
+ Name |
+ Description |
+
|---|---|---|
| string | +magento_version | +Magento version | +
| string | +magento_edition | +Magento edition (Community, Professional, Enterprise) | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$magentoInfo = $proxy->call(
+ $sessionId,
+ 'magento.info'
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->magentoInfo($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->magentoInfo((object)array('sessionId' => $sessionId->result));
+
+var_dump($result->result);
+ array + 'magento_edition' => string 'Community' (length=9) + 'magento_version' => string '1.4.2.0-rc1' (length=11)+
The following APIs allow you to access additional Magento information.
+ +Allows you to retrieve information on the store view.
+ +Resource Name: Store
+ +Allows you to get information about the current Magento installation.
+ +Resource Name: core_magento
+ +Aliases: magento
+ + +Allows you to retrieve information about the required store view.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +storeId | +Store view ID or code (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of storeEntity | +
The storeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + store_id |
+Store view ID | +
| string | + code |
+Store view code | +
| int | + website_id |
+Website ID | +
| int | + group_id |
+Group ID | +
| string | + name |
+Store name | +
| int | + sort_order |
+Store view sort order | +
| int | + is_active |
+Defines whether the store is active | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 101 | +Requested store view not found. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'store.info', '2');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->storeInfo($sessionId, '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->storeInfo((object)array('sessionId' => $sessionId->result, 'storeId' => '2'));
+
+var_dump($result->result);
+ array + 'store_id' => string '2' (length=1) + 'code' => string 'english' (length=7) + 'website_id' => string '2' (length=1) + 'group_id' => string '2' (length=1) + 'name' => string 'English' (length=7) + 'sort_order' => string '0' (length=1) + 'is_active' => string '1' (length=1)+
Allows you to retrieve the list of store views.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of storeEntity | +
The storeEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + store_id |
+Store view ID | +
| string | + code |
+Store view code | +
| int | + website_id |
+Website ID | +
| int | + group_id |
+Group ID | +
| string | + name |
+Store view name | +
| int | + sort_order |
+Store view sort order | +
| int | + is_active |
+Defines whether the store is active | +
Faults:
+No Faults
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'store.list');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->storeList($sessionId);
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->storeList((object)array('sessionId' => $sessionId->result));
+
+var_dump($result->result);
+ array + 0 => + array + 'store_id' => string '1' (length=1) + 'code' => string 'default' (length=7) + 'website_id' => string '1' (length=1) + 'group_id' => string '1' (length=1) + 'name' => string 'Default Store View' (length=18) + 'sort_order' => string '0' (length=1) + 'is_active' => string '1' (length=1) + 1 => + array + 'store_id' => string '2' (length=1) + 'code' => string 'english' (length=7) + 'website_id' => string '2' (length=1) + 'group_id' => string '2' (length=1) + 'name' => string 'English' (length=7) + 'sort_order' => string '0' (length=1) + 'is_active' => string '1' (length=1)+
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
+ +Allows you to manage orders.
+ +Resource Name: sales_order
+ +Aliases:
+Methods:
+Allows you to manage invoices.
+ +Resource Name: sales_order_invoice
+ +Aliases:
+Methods:
+Allows you to manage shipments and tracking numbers.
+ +Resource Name: sales_order_shipment
+ +Aliases:
+Methods:
+Allows you to manage order credit memos.
+ +Resource Name: sales_order_creditmemo
+ +Aliases:
+The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
+ +Allows you to manage orders.
+ +Resource Name: sales_order
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested order not exists. | +
| 101 | +Invalid filters given. Details in error message. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Order status not changed. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Getting list of orders created by John Doe
+var_dump($proxy->call($sessionId, 'sales_order.list', array(array('customer_firstname'=>array('eq'=>'John'), 'customer_lastname'=>array('eq'=>'Doe')))));
+
+
+// Get order info 100000003
+var_dump($proxy->call($sessionId, 'sales_order.info', '100000003'));
+
+
+// Hold order 100000003
+$proxy->call($sessionId, 'sales_order.hold', '100000003');
+
+// Unhold order 100000003
+$proxy->call($sessionId, 'sales_order.unhold', '100000003');
+
+// Hold order and add comment 100000003
+$proxy->call($sessionId, 'sales_order.addComment', array('100000003', 'holded', 'You order is holded', true));
+
+// Unhold order and add comment 100000003
+$proxy->call($sessionId, 'sales_order.addComment', array('100000003', 'pending', 'You order is pending', true));
+
+// Get order info 100000003
+var_dump($proxy->call($sessionId, 'sales_order.info', '100000003'));
+ Aliases:
+Allows you to add a new comment to the order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
| string | + status |
+Order status (pending, processing, etc.) | +
| string | + comment |
+Order comment (optional) | +
| string | + notify |
+Notification flag (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the comment is added to the order | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.addComment', array('orderIncrementId' => '200000004', 'status' => 'processing'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderAddComment($sessionId, '200000004', 'processing');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderAddComment((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000004', 'status' => 'processing', 'comment' => 'comment to the order', 'notify' => null));
+var_dump($result->result);
+ Aliases:
+Allows you to cancel the required order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the order is canceled | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.cancel', '200000004');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCancel($sessionId, '200000004');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCancel((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000004'));
+var_dump($result->result);
+ Aliases:
+Allows you to place the required order on hold.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the order is placed on hold | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.hold', '200000006');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderHold($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderHold((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the required order information.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderEntity | +
The salesOrderEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Defines whether the order is active | +
| string |
+ customer_id |
+Customer ID | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ subtotal |
+Subtotal sum | +
| string |
+ grand_total |
+Grand total sum | +
| string |
+ total_paid |
+Total paid | +
| string |
+ total_refunded |
+Total refunded | +
| string |
+ total_qty_ordered |
+Total quantity ordered | +
| string |
+ total_canceled |
+Total canceled | +
| string |
+ total_invoiced |
+Total invoiced | +
| string |
+ total_online_refunded |
+Total online refunded | +
| string |
+ total_offline_refunded |
+Total offline refunded | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ base_total_paid |
+Base total paid | +
| string |
+ base_total_refunded |
+Base total refunded | +
| string |
+ base_total_qty_ordered |
+Base total quantity ordered | +
| string |
+ base_total_canceled |
+Base total canceled | +
| string |
+ base_total_invoiced |
+Base total invoiced | +
| string |
+ base_total_online_refunded |
+Base total online refunded | +
| string |
+ base_total_offline_refunded |
+Base total offline refunded | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ billing_firstname |
+First name in the billing address | +
| string |
+ billing_lastname |
+Last name in the billing address | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ shipping_firstname |
+First name in the shipping address | +
| string |
+ shipping_lastname |
+Last name in the shipping address | +
| string |
+ billing_name |
+Billing name | +
| string |
+ shipping_name |
+Shipping name | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ weight |
+Weight | +
| string |
+ store_name |
+Store name | +
| string |
+ remote_ip |
+Remote IP | +
| string |
+ status |
+Order status | +
| string |
+ state |
+Order state | +
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ shipping_method |
+Shipping method | +
| string |
+ shipping_description |
+Shipping description | +
| string |
+ customer_email |
+Email address of the customer | +
| string |
+ customer_firstname |
+Customer first name | +
| string |
+ customer_lastname |
+Customer last name | +
| string |
+ quote_id |
+Shopping cart ID | +
| string |
+ is_virtual |
+Defines whether the product is a virtual one | +
| string |
+ customer_group_id |
+Customer group ID | +
| string |
+ customer_note_notify |
+Customer notification | +
| string |
+ customer_is_guest |
+Defines whether the customer is a guest | +
| string |
+ email_sent |
+Defines whether the email notification is sent | +
| string |
+ order_id |
+Order ID | +
| string |
+ gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
| array | + shipping_address |
+Array of salesOrderAddressEntity | +
| array | + billing_address |
+Array of salesOrderAddressEntity | +
| array | + items |
+Array of salesOrderItemEntity | +
| array | + payment |
+Array of salesOrderPaymentEntity | +
| array | + status_history |
+Array of salesOrderStatusHistoryEntity | +
The salesOrderAddressEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Defines whether the address is active | +
| string |
+ address_type |
+Address type | +
| string |
+ firstname |
+First name | +
| string |
+ lastname |
+Last name | +
| string |
+ company |
+Company name | +
| string |
+ street |
+Street name | +
| string |
+ city |
+City | +
| string |
+ region |
+Region | +
| string |
+ postcode |
+Post code | +
| string |
+ country_id |
+Country ID | +
| string |
+ telephone |
+Telephone number | +
| string |
+ fax |
+Fax number | +
| string |
+ region_id |
+Region ID | +
| string |
+ address_id |
+Address ID | +
The salesOrderItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + item_id |
+Item ID | +
| string |
+ order_id |
+Order ID | +
| string |
+ quote_item_id |
+Shopping cart item ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ product_id |
+Product ID | +
| string |
+ product_type |
+Product type | +
| string |
+ product_options |
+Product options | +
| string |
+ weight |
+Weight | +
| string |
+ is_virtual |
+Defines whether the product is a virtual one | +
| string |
+ sku |
+ Product SKU |
+
| string |
+ name |
+ Product name |
+
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ free_shipping |
+Defines whether free shipping is applied | +
| string |
+ is_qty_decimal |
+Defines whether the items quantity is decimal | +
| string |
+ no_discount |
+Defines whether no discount is applied | +
| string |
+ qty_canceled |
+Items quantity canceled | +
| string |
+ qty_invoiced |
+Items quantity invoiced | +
| string |
+ qty_ordered |
+Items quantity ordered | +
| string |
+ qty_refunded |
+Items quantity refunded | +
| string |
+ qty_shipped |
+Items quantity shipped | +
| string |
+ cost |
+Cost | +
| string |
+ price |
+Price | +
| string |
+ base_price |
+Base price | +
| string |
+ original_price |
+Original price | +
| string |
+ base_original_price |
+Base original price | +
| string |
+ tax_percent |
+Tax percent | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ tax_invoiced |
+Tax invoiced | +
| string |
+ base_tax_invoiced |
+Base tax invoiced | +
| string |
+ discount_percent |
+Discount percent | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ discount_invoiced |
+Discount invoiced | +
| string |
+ base_discount_invoiced |
+Base discount invoiced | +
| string |
+ amount_refunded |
+Amount refunded | +
| string |
+ base_amount_refunded |
+Base amount refunded | +
| string |
+ row_total |
+Row total | +
| string |
+ base_row_total |
+Base row total | +
| string |
+ row_invoiced |
+Row invoiced | +
| string |
+ base_row_invoiced |
+Base row invoiced | +
| string |
+ row_weight |
+Row weight | +
| string |
+ gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
| string |
+ gift_message_available |
+Defines whether the gift message is available | +
| string |
+ base_tax_before_discount |
+Base tax before discount | +
| string |
+ tax_before_discount |
+Tax before discount | +
| string |
+ weee_tax_applied |
+Applied fixed product tax | +
| string |
+ weee_tax_applied_amount |
+Applied fixed product tax amount | +
| string |
+ weee_tax_applied_row_amount |
+Applied fixed product tax row amount | +
| string |
+ base_weee_tax_applied_amount |
+Applied fixed product tax amount (in base currency) | +
| string |
+ base_weee_tax_applied_row_amount |
+Applied fixed product tax row amount (in base currency) | +
| string |
+ weee_tax_disposition |
+Fixed product tax disposition | +
| string |
+ weee_tax_row_disposition |
+Fixed product tax row disposition | +
| string |
+ base_weee_tax_disposition |
+Fixed product tax disposition (in base currency) | +
| string |
+ base_weee_tax_row_disposition |
+Fixed product tax row disposition (in base currency) | +
The salesOrderPaymentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Active flag | +
| string |
+ amount_ordered |
+Amount ordered | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ base_amount_ordered |
+Base amount ordered | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ method |
+Payment method | +
| string |
+ po_number |
+Purchase order number | +
| string |
+ cc_type |
+Credit card type | +
| string |
+ cc_number_enc |
+Credit card number | +
| string |
+ cc_last4 |
+Credit card last 4 digits | +
| string |
+ cc_owner |
+Credit card owner | +
| string |
+ cc_exp_month |
+Credit card expiration month | +
| string |
+ cc_exp_year |
+Credit card expiration year | +
| string |
+ cc_ss_start_month |
+Credit card start month (Switch/Solo) | +
| string |
+ cc_ss_start_year |
+Credit card start year (Switch/Solo) | +
| string |
+ payment_id |
+Payment ID | +
The salesOrderStatusHistoryEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Active flag | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ status |
+Order status | +
| string |
+ comment |
+Order comment | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.info', 'orderIncrementId');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderInfo($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInfo((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
+var_dump($result->result);
+ array + 'state' => string 'new' (length=3) + 'status' => string 'pending' (length=7) + 'coupon_code' => null + 'protect_code' => string 'defe18' (length=6) + 'shipping_description' => string 'Flat Rate - Fixed' (length=17) + 'is_virtual' => string '0' (length=1) + 'store_id' => string '2' (length=1) + 'customer_id' => string '2' (length=1) + 'base_discount_amount' => string '0.0000' (length=6) + 'base_discount_canceled' => null + 'base_discount_invoiced' => null + 'base_discount_refunded' => null + 'base_grand_total' => string '619.9700' (length=8) + 'base_shipping_amount' => string '10.0000' (length=7) + 'base_shipping_canceled' => null + 'base_shipping_invoiced' => null + 'base_shipping_refunded' => null + 'base_shipping_tax_amount' => string '0.0000' (length=6) + 'base_shipping_tax_refunded' => null + 'base_subtotal' => string '609.9700' (length=8) + 'base_subtotal_canceled' => null + 'base_subtotal_invoiced' => null + 'base_subtotal_refunded' => null + 'base_tax_amount' => string '0.0000' (length=6) + 'base_tax_canceled' => null + 'base_tax_invoiced' => null + 'base_tax_refunded' => null + 'base_to_global_rate' => string '1.0000' (length=6) + 'base_to_order_rate' => string '1.0000' (length=6) + 'base_total_canceled' => null + 'base_total_invoiced' => null + 'base_total_invoiced_cost' => null + 'base_total_offline_refunded' => null + 'base_total_online_refunded' => null + 'base_total_paid' => null + 'base_total_qty_ordered' => null + 'base_total_refunded' => null + 'discount_amount' => string '0.0000' (length=6) + 'discount_canceled' => null + 'discount_invoiced' => null + 'discount_refunded' => null + 'grand_total' => string '619.9700' (length=8) + 'shipping_amount' => string '10.0000' (length=7) + 'shipping_canceled' => null + 'shipping_invoiced' => null + 'shipping_refunded' => null + 'shipping_tax_amount' => string '0.0000' (length=6) + 'shipping_tax_refunded' => null + 'store_to_base_rate' => string '1.0000' (length=6) + 'store_to_order_rate' => string '1.0000' (length=6) + 'subtotal' => string '609.9700' (length=8) + 'subtotal_canceled' => null + 'subtotal_invoiced' => null + 'subtotal_refunded' => null + 'tax_amount' => string '0.0000' (length=6) + 'tax_canceled' => null + 'tax_invoiced' => null + 'tax_refunded' => null + 'total_canceled' => null + 'total_invoiced' => null + 'total_offline_refunded' => null + 'total_online_refunded' => null + 'total_paid' => null + 'total_qty_ordered' => string '2.0000' (length=6) + 'total_refunded' => null + 'can_ship_partially' => null + 'can_ship_partially_item' => null + 'customer_is_guest' => string '0' (length=1) + 'customer_note_notify' => string '1' (length=1) + 'billing_address_id' => string '1' (length=1) + 'customer_group_id' => string '1' (length=1) + 'edit_increment' => null + 'email_sent' => string '1' (length=1) + 'forced_shipment_with_invoice' => null + 'payment_auth_expiration' => null + 'quote_address_id' => null + 'quote_id' => string '1' (length=1) + 'shipping_address_id' => string '2' (length=1) + 'adjustment_negative' => null + 'adjustment_positive' => null + 'base_adjustment_negative' => null + 'base_adjustment_positive' => null + 'base_shipping_discount_amount' => string '0.0000' (length=6) + 'base_subtotal_incl_tax' => string '609.9700' (length=8) + 'base_total_due' => null + 'payment_authorization_amount' => null + 'shipping_discount_amount' => string '0.0000' (length=6) + 'subtotal_incl_tax' => string '609.9700' (length=8) + 'total_due' => null + 'weight' => string '1.2000' (length=6) + 'customer_dob' => null + 'increment_id' => string '200000001' (length=9) + 'applied_rule_ids' => null + 'base_currency_code' => string 'USD' (length=3) + 'customer_email' => string 'john@example.com' (length=16) + 'customer_firstname' => string 'johny' (length=5) + 'customer_lastname' => string 'doe' (length=3) + 'customer_middlename' => null + 'customer_prefix' => null + 'customer_suffix' => null + 'customer_taxvat' => null + 'discount_description' => null + 'ext_customer_id' => null + 'ext_order_id' => null + 'global_currency_code' => string 'USD' (length=3) + 'hold_before_state' => null + 'hold_before_status' => null + 'order_currency_code' => string 'USD' (length=3) + 'original_increment_id' => null + 'relation_child_id' => null + 'relation_child_real_id' => null + 'relation_parent_id' => null + 'relation_parent_real_id' => null + 'remote_ip' => string '127.0.0.1' (length=9) + 'shipping_method' => string 'flatrate_flatrate' (length=17) + 'store_currency_code' => string 'USD' (length=3) + 'store_name' => string 'website +English store +English' (length=29) + 'x_forwarded_for' => null + 'customer_note' => null + 'created_at' => string '2012-03-30 11:40:30' (length=19) + 'updated_at' => string '2012-03-30 11:40:32' (length=19) + 'total_item_count' => string '2' (length=1) + 'customer_gender' => null + 'hidden_tax_amount' => string '0.0000' (length=6) + 'base_hidden_tax_amount' => string '0.0000' (length=6) + 'shipping_hidden_tax_amount' => string '0.0000' (length=6) + 'base_shipping_hidden_tax_amnt' => string '0.0000' (length=6) + 'hidden_tax_invoiced' => null + more elements...+
Aliases:
+Allows you to retrieve the list of orders. Additional filters can be applied.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| array | +filters | +Array of filters for the list of sales orders (optional) | +
Returns:
+ +| Type | +name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderEntity | +
The salesOrderEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Defines whether the order is active | +
| string |
+ customer_id |
+Customer ID | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ subtotal |
+Subtotal sum | +
| string |
+ grand_total |
+Grand total sum | +
| string |
+ total_paid |
+Total paid | +
| string |
+ total_refunded |
+Total refunded | +
| string |
+ total_qty_ordered |
+Total quantity ordered | +
| string |
+ total_canceled |
+Total canceled | +
| string |
+ total_invoiced |
+Total invoiced | +
| string |
+ total_online_refunded |
+Total online refunded | +
| string |
+ total_offline_refunded |
+Total offline refunded | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ base_total_paid |
+Base total paid | +
| string |
+ base_total_refunded |
+Base total refunded | +
| string |
+ base_total_qty_ordered |
+Base total quantity ordered | +
| string |
+ base_total_canceled |
+Base total canceled | +
| string |
+ base_total_invoiced |
+Base total invoiced | +
| string |
+ base_total_online_refunded |
+Base total online refunded | +
| string |
+ base_total_offline_refunded |
+Base total offline refunded | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ billing_firstname |
+First name in the billing address | +
| string |
+ billing_lastname |
+Last name in the billing address | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ shipping_firstname |
+First name in the shipping address | +
| string |
+ shipping_lastname |
+Last name in the shipping address | +
| string |
+ billing_name |
+Billing name | +
| string |
+ shipping_name |
+Shipping name | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ weight |
+Weight | +
| string |
+ store_name |
+Store name | +
| string |
+ remote_ip |
+Remote IP | +
| string |
+ status |
+Order status | +
| string |
+ state |
+Order state | +
| string |
+ applied_rule_ids |
+Applied rule IDs | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ shipping_method |
+Shipping method | +
| string |
+ shipping_description |
+Shipping description | +
| string |
+ customer_email |
+Email address of the customer | +
| string |
+ customer_firstname |
+Customer first name | +
| string |
+ customer_lastname |
+Customer last name | +
| string |
+ quote_id |
+Shopping cart ID | +
| string |
+ is_virtual |
+Defines whether the product is a virtual one | +
| string |
+ customer_group_id |
+Customer group ID | +
| string |
+ customer_note_notify |
+Customer notification | +
| string |
+ customer_is_guest |
+Defines whether the customer is a guest | +
| string |
+ email_sent |
+Defines whether the email notification is sent | +
| string |
+ order_id |
+Order ID | +
| string |
+ gift_message_id |
+Gift message ID | +
| string |
+ gift_message |
+Gift message | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'order.list');
+var_dump ($result);
+ $params = array(array(
+ 'filter' => array(
+ array(
+ 'key' => 'status',
+ 'value' => 'pending'
+ ),
+ array(
+ 'key' => 'created_at',
+ 'value' => '2001-11-25 12:12:07',
+ )
+ ),
+ 'complex_filter' => array(
+ array(
+ 'key' => 'order_id',
+ 'value' => array(
+ 'key' => 'in',
+ 'value' => '12,23'
+ ),
+ ),
+ array(
+ 'key' => 'protect_code',
+ 'value' => array(
+ 'key' => 'eq',
+ 'value' => 'ebb2a0'
+ ),
+ ),
+ )
+ ));
+
+$result = $client->__call('salesOrderList', $params);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$filter = array('filter' => array(array('key' => 'status', 'value' => 'closed')));
+$result = $client->salesOrderList($session, $filter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderList((object)array('sessionId' => $sessionId->result, 'filters' => null));
+var_dump($result->result);
+ <?xml version="1.0" encoding="UTF-8"?> +<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="urn:Magento" + xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" + SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> + <SOAP-ENV:Body> + <ns1:salesOrderList> + <sessionId xsi:type="xsd:string">abbc417256a3ffb93d130a77a2fd3665</sessionId> + <filters xsi:type="ns1:filters"> + <filter SOAP-ENC:arrayType="ns1:associativeEntity[2]" xsi:type="ns1:associativeArray"> + <item xsi:type="ns1:associativeEntity"> + <key xsi:type="xsd:string">status</key> + <value xsi:type="xsd:string">pending</value> + </item> + <item xsi:type="ns1:associativeEntity"> + <key xsi:type="xsd:string">created_at</key> + <value xsi:type="xsd:string">2011-11-29 15:41:11</value> + </item> + </filter> + <complex_filter SOAP-ENC:arrayType="ns1:complexFilter[2]" xsi:type="ns1:complexFilterArray"> + <item xsi:type="ns1:complexFilter"> + <key xsi:type="xsd:string">order_id</key> + <value xsi:type="ns1:associativeEntity"> + <key xsi:type="xsd:string">in</key> + <value xsi:type="xsd:string">Array</value> + </value> + </item> + <item xsi:type="ns1:complexFilter"> + <key xsi:type="xsd:string">protect_code</key> + <value xsi:type="ns1:associativeEntity"> + <key xsi:type="xsd:string">in</key> + <value xsi:type="xsd:string">a4ffa8</value> + </value> + </item> + </complex_filter> + </filters> + </ns1:salesOrderList> + </SOAP-ENV:Body> +</SOAP-ENV:Envelope>+
Aliases:
+Allows you to unhold the required order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the order is unheld | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order.unhold', '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$result = $proxy->salesOrderUnhold($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderUnhold((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000006'));
+var_dump($result->result);
+ Allows you to operate with credit memos for orders.
+ + +Aliases: order_creditmemo
+ +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested credit memo does not exist. | +
| 101 | +Invalid filter given. Details in error message. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested order does not exist. | +
| 104 | +Credit memo status not changed. | +
| 105 | +Money can not be refunded to the store credit account as order was created by guest. | +
| 106 | +Credit memo for requested order can not be created. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+// Create creditmemo
+$orderIncrementId = '100000683'; //increment id of the invoiced order
+$data = array(
+ 'qtys' => array(
+ '712' => 1
+ ),
+ 'shipping_amount' => 3,
+ 'adjustment_positive' => 0.7,
+ 'adjustment_negative' => 0.06
+);
+$creditmemoIncrementId = $proxy->call($sessionId, 'order_creditmemo.create', array($orderIncrementId, $data));
+echo $creditmemoIncrementId . "<br />";
+
+// Add comment to created creditmemo
+$commentText = "Credit memo comment successfully added";
+$isCommentAdded = $proxy->call($sessionId, 'order_creditmemo.addComment', array($creditmemoIncrementId, $commentText, true));
+
+// Retrieve information about created creditmemo
+$creditmemoInfo = $proxy->call($sessionId, 'order_creditmemo.info', array($creditmemoIncrementId));
+print_r($creditmemoInfo);
+
+// Retrieve list of creditmemos by filter
+$filter = array(
+ 'increment_id' => array(
+ 'or' => array(
+ array(
+ 'from' => '100000617',
+ 'to' => '100000619',
+ ),
+ array(
+ 'from' => $creditmemoIncrementId,
+ 'to' => NULL,
+ )
+ )
+ )
+);
+$creditmemoList = $proxy->call($sessionId, 'order_creditmemo.list', array($filter));
+print_r($creditmemoList);
+ Aliases: order_creditmemo
+ +Allows you to add a new comment to an existing credit memo. Email notification can be sent to the user email.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | +creditmemoIncrementId | +Credit memo increment ID | +
| string | +comment | +Comment text (optional) | +
| int | +notifyCustomer | +Notify customer by email flag (optional) | +
| int | +includeComment | +Include comment text into the email notification (optional) | +
Return:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the comment is added to the credit memo | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested credit memo does not exist. | +
| 102 | +Invalid data given. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$creditmemoIncrementId = '200000001'; //increment id of existing credit memo
+$commentText = "Credit memo comment successfully added";
+
+$isCommentAdded = $proxy->call($sessionId, 'order_creditmemo.addComment', array($creditmemoIncrementId, $commentText, true));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCreditmemoAddComment($sessionId, '200000001');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCreditmemoAddComment((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000001', 'comment' => 'credit memo comment', 'notifyCustomer' => 1, 'includeComment' => 1));
+var_dump($result->result);
+ Allows you to cancel an existing credit memo.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +creditmemoIncrementId | +Credit memo increment ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +result | +Result of canceling the credit memo | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested credit memo does not exist. | +
| 104 | +Credit memo status not changed. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$creditmemoIncrementId = '100000637'; //increment id of existing credit memo
+
+$isCreditMemoCanceled = $proxy->call($sessionId, 'order_creditmemo.cancel', array($creditmemoIncrementId));
+ Allows you to create a new credit memo for the invoiced order. Comments can be added and an email notification can be sent to the user email.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +orderIncrementId | +Order increment ID | +
| array | +creditmemoData | +Array of salesOrderCreditmemoData (optional) | +
| string | +comment | +Comment text (optional) | +
| int | +notifyCustomer | +Notify customer by email flag (optional) | +
| int | +includeComment | +Include comment text into an email notification (optional) | +
| string | +refundToStoreCreditAmount | +Payment amount to be refunded to the customer store credit (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +result | +Created credit memo increment ID | +
The salesOrderCreditmemoData content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | + qtys |
+Array of orderItemIdQty | +
| double | + shipping_amount |
+ Refund shipping amount (optional) |
+
| double | + adjustment_positive |
+ Adjustment refund amount (optional) |
+
| double | + adjustment_negative |
+ Adjustment fee amount (optional) |
+
The orderItemIdQty content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + order_item_id |
+Order item ID to be refunded | +
| double | + qty |
+Items quantity to be refunded | +
Faults:
+ + +| Fault Code | +Fault Message | +
|---|---|
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested order does not exist. | +
| 105 | +Money can not be refunded to the store credit account as order was created by guest. | +
| 106 | +Credit memo for requested order can not be created. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'order_creditmemo.create', '200000010');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCreditmemoCreate($sessionId, '200000010');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCreditmemoCreate((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000010',
+'creditmemoData' => array(
+'qtys' => array(
+'order_item_id' => 3,
+'qty' => '1'),
+'shipping_amount' => null,
+'adjustment_positive' => '0',
+'adjustment_negative' => null),
+'comment' => 'comment for credit memo',
+'notifyCustomer' => null,
+'includeComment' => 1,
+'refundToStoreCreditAmount' => '1'
+));
+var_dump($result->result);
+ Allows you to retrieve full information about the specified credit memo.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +creditmemoIncrementId | +Credit memo increment ID | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderCreditmemoEntity | +
The salesOrderCreditmemoEntity content is as follows:
+ + + +| Type | +Name | +Description | +
|---|---|---|
| string | +updated_at | +Date of updating | +
| string |
+ created_at |
+Date of creation | +
| string |
+ increment_id |
+Increment ID | +
| string |
+ transaction_id |
+Transaction ID | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ cybersource_token |
+Cybersource token | +
| string |
+ invoice_id |
+ID of the invoice for which the credit memo was created | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ state |
+State | +
| string |
+ creditmemo_status |
+Credit memo status | +
| string |
+ email_sent |
+Defines whether the email is sent | +
| string |
+ order_id |
+ID of the order for which the credit memo was created | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ shipping_tax_amount |
+Shipping tax amount | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_adjustment_positive |
+ Adjustment refund amount (using base currency) |
+
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ adjustment |
+Adjustment | +
| string |
+ subtotal |
+Subtotal | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_adjustment |
+Base adjustment | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ adjustment_negative |
+ Adjustment fee amount |
+
| string |
+ subtotal_incl_tax |
+Subtotal including tax | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ base_subtotal_incl_tax |
+Base subtotal including tax | +
| string |
+ base_adjustment_negative |
+ Adjustment fee amount (using base currency) |
+
| string |
+ grand_total |
+Grand total | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_shipping_tax_amount |
+Base shipping tax amount | +
| string |
+ adjustment_positive |
+ Adjustment refund amount |
+
| string |
+ store_id |
+Store ID | +
| string |
+ hidden_tax_amount |
+Hidden tax amount | +
| string |
+ base_hidden_tax_amount |
+Base hidden tax amount | +
| string |
+ shipping_hidden_tax_amount |
+Shipping hidden tax amount | +
| string |
+ base_shipping_hidden_tax_amnt |
+Base shipping hidden tax amount | +
| string |
+ shipping_incl_tax |
+Shipping including tax | +
| string |
+ base_shipping_incl_tax |
+Base shipping including tax | +
| string |
+ base_customer_balance_amount |
+Base customer balance amount | +
| string |
+ customer_balance_amount |
+Customer balance amount | +
| string |
+ bs_customer_bal_total_refunded |
+ Refunded base customer balance amount |
+
| string |
+ customer_bal_total_refunded |
+Customer balance total refunded | +
| string |
+ base_gift_cards_amount |
+Base gift cards amount | +
| string |
+ gift_cards_amount |
+Gift cards amount | +
| string |
+ gw_base_price |
+ Gift wrapping price refunded amount (using base currency) |
+
| string |
+ gw_price |
+ Gift wrapping price refunded amount |
+
| string |
+ gw_items_base_price |
+Gift wrapping items base price | +
| string |
+ gw_items_price |
+Gift wrapping items price | +
| string |
+ gw_card_base_price |
+Gift wrapping card base price | +
| string |
+ gw_card_price |
+Gift wrapping card price | +
| string |
+ gw_base_tax_amount |
+ Gift wrapping tax amount refunded (using base currency) |
+
| string |
+ gw_tax_amount |
+ Gift wrapping tax amount refunded |
+
| string |
+ gw_items_base_tax_amount |
+Gift wrapping items base tax amount | +
| string |
+ gw_items_tax_amount |
+Gift wrapping items tax amount | +
| string |
+ gw_card_base_tax_amount |
+Gift wrapping card base tax amount | +
| string |
+ gw_card_tax_amount |
+Gift wrapping card tax amount | +
| string |
+ base_reward_currency_amount |
+Base reward currency amount | +
| string |
+ reward_currency_amount |
+Reward currency amount | +
| string |
+ reward_points_balance |
+Reward points balance | +
| string |
+ reward_points_balance_refund |
+Reward points balance refund | +
| string |
+ creditmemo_id |
+Credit memo ID | +
| array | + items |
+Array of salesOrderCreditmemoItemEntity | +
| array | + comments |
+Array of salesOrderCreditmemoCommentEntity | +
The salesOrderCreditmemoItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +item_id | +Credit memo item ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ weee_tax_applied_row_amount |
+Applied fixed product tax row amount | +
| string |
+ base_price |
+Base price | +
| string |
+ base_weee_tax_row_disposition |
+Fixed product tax row disposition (in base currency) | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ base_weee_tax_applied_amount |
+ Applied fixed product tax amount (in base currency) |
+
| string |
+ weee_tax_row_disposition |
+ Fixed product tax row disposition |
+
| string |
+ base_row_total |
+Base row total | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ row_total |
+Row total | +
| string |
+ weee_tax_applied_amount |
+ Applied fixed product tax amount |
+
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_weee_tax_disposition |
+ Fixed product tax disposition (in base currency) |
+
| string |
+ price_incl_tax |
+Price including tax | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ weee_tax_disposition |
+ Fixed product tax disposition |
+
| string |
+ base_price_incl_tax |
+Base price including tax | +
| string |
+ qty |
+Quantity | +
| string |
+ base_cost |
+Base cost | +
| string |
+ base_weee_tax_applied_row_amount |
+ Applied fixed product tax row amount (in base currency) |
+
| string |
+ price |
+Price | +
| string |
+ base_row_total_incl_tax |
+Base row total including tax | +
| string |
+ row_total_incl_tax |
+Row total including tax | +
| string |
+ product_id |
+Product ID | +
| string |
+ order_item_id |
+Order item ID | +
| string |
+ additional_data |
+Additional data | +
| string |
+ description |
+Description | +
| string |
+ weee_tax_applied |
+ Applied fixed product tax |
+
| string |
+ sku |
+Item SKU | +
| string |
+ name |
+Name | +
| string |
+ hidden_tax_amount |
+Hidden tax amount | +
| string |
+ base_hidden_tax_amount |
+Base hidden tax amount | +
The salesOrderCreditmemoCommentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ comment |
+Comment data | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ comment_id |
+Comment ID | +
| string |
+ is_visible_on_front |
+Defines whether the comment is visible on the frontend | +
Faults:
+ +| Fault Code | +Fault Description | +
|---|---|
| 100 | +Requested credit memo does not exist. | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'order_creditmemo.info', '200000001');
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCreditmemoInfo($sessionId, '200000001');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCreditmemoInfo((object)array('sessionId' => $sessionId->result, 'creditmemoIncrementId' => '200000001'));
+var_dump($result->result);
+ array(
+ 'store_id' => '1',
+ 'adjustment_positive' => NULL,
+ 'base_shipping_tax_amount' => '0.0000',
+ 'store_to_order_rate' => '1.0000',
+ 'base_discount_amount' => '0.0000',
+ 'base_to_order_rate' => '1.0000',
+ 'grand_total' => '90.0000',
+ 'base_adjustment_negative' => NULL,
+ 'base_subtotal_incl_tax' => '75.0000',
+ 'shipping_amount' => '15.0000',
+ 'subtotal_incl_tax' => '75.0000',
+ 'adjustment_negative' => NULL,
+ 'base_shipping_amount' => '15.0000',
+ 'store_to_base_rate' => '1.0000',
+ 'base_to_global_rate' => '1.0000',
+ 'base_adjustment' => '0.0000',
+ 'base_subtotal' => '75.0000',
+ 'discount_amount' => '0.0000',
+ 'subtotal' => '75.0000',
+ 'adjustment' => '0.0000',
+ 'base_grand_total' => '90.0000',
+ 'base_adjustment_positive' => NULL,
+ 'base_tax_amount' => '0.0000',
+ 'shipping_tax_amount' => '0.0000',
+ 'tax_amount' => '0.0000',
+ 'order_id' => '744',
+ 'email_sent' => NULL,
+ 'creditmemo_status' => NULL,
+ 'state' => '2',
+ 'shipping_address_id' => '1488',
+ 'billing_address_id' => '1487',
+ 'invoice_id' => NULL,
+ 'cybersource_token' => NULL,
+ 'store_currency_code' => 'USD',
+ 'order_currency_code' => 'USD',
+ 'base_currency_code' => 'USD',
+ 'global_currency_code' => 'USD',
+ 'transaction_id' => NULL,
+ 'increment_id' => '100000684',
+ 'created_at' => '2011-05-27 10:53:03',
+ 'updated_at' => '2011-05-27 10:53:03',
+ 'hidden_tax_amount' => '0.0000',
+ 'base_hidden_tax_amount' => '0.0000',
+ 'shipping_hidden_tax_amount' => NULL,
+ 'base_shipping_hidden_tax_amnt' => NULL,
+ 'shipping_incl_tax' => '15.0000',
+ 'base_shipping_incl_tax' => '15.0000',
+ 'base_customer_balance_amount' => NULL,
+ 'customer_balance_amount' => NULL,
+ 'bs_customer_bal_total_refunded' => '0.0000',
+ 'customer_bal_total_refunded' => '0.0000',
+ 'base_gift_cards_amount' => NULL,
+ 'gift_cards_amount' => NULL,
+ 'gw_base_price' => NULL,
+ 'gw_price' => NULL,
+ 'gw_items_base_price' => NULL,
+ 'gw_items_price' => NULL,
+ 'gw_card_base_price' => NULL,
+ 'gw_card_price' => NULL,
+ 'gw_base_tax_amount' => NULL,
+ 'gw_tax_amount' => NULL,
+ 'gw_items_base_tax_amount' => NULL,
+ 'gw_items_tax_amount' => NULL,
+ 'gw_card_base_tax_amount' => NULL,
+ 'gw_card_tax_amount' => NULL,
+ 'base_reward_currency_amount' => NULL,
+ 'reward_currency_amount' => NULL,
+ 'reward_points_balance' => NULL,
+ 'reward_points_balance_refund' => NULL,
+ 'base_customer_balance_total_refunded' => '0.0000',
+ 'customer_balance_total_refunded' => '0.0000',
+ 'gw_printed_card_base_price' => NULL,
+ 'gw_printed_card_price' => NULL,
+ 'gw_printed_card_base_tax_amount' => NULL,
+ 'gw_printed_card_tax_amount' => NULL,
+ 'reward_points_balance_to_refund' => NULL,
+ 'creditmemo_id' => '684',
+ 'order_increment_id' => '100000744',
+ 'items' => array(
+ 0 => array(
+ 'parent_id' => '684',
+ 'weee_tax_applied_row_amount' => '0.0000',
+ 'base_price' => '55.0000',
+ 'base_weee_tax_row_disposition' => '0.0000',
+ 'tax_amount' => '0.0000',
+ 'base_weee_tax_applied_amount' => '0.0000',
+ 'weee_tax_row_disposition' => '0.0000',
+ 'base_row_total' => '55.0000',
+ 'discount_amount' => NULL,
+ 'row_total' => '55.0000',
+ 'weee_tax_applied_amount' => '0.0000',
+ 'base_discount_amount' => NULL,
+ 'base_weee_tax_disposition' => '0.0000',
+ 'price_incl_tax' => '55.0000',
+ 'base_tax_amount' => '0.0000',
+ 'weee_tax_disposition' => '0.0000',
+ 'base_price_incl_tax' => '55.0000',
+ 'qty' => '1.0000',
+ 'base_cost' => NULL,
+ 'base_weee_tax_applied_row_amnt' => NULL,
+ 'price' => '55.0000',
+ 'base_row_total_incl_tax' => '55.0000',
+ 'row_total_incl_tax' => '55.0000',
+ 'product_id' => '20',
+ 'order_item_id' => '775',
+ 'additional_data' => NULL,
+ 'description' => NULL,
+ 'weee_tax_applied' => 'a:0:{}',
+ 'sku' => 'test_product_sku',
+ 'name' => 'Test Product',
+ 'hidden_tax_amount' => '0.0000',
+ 'base_hidden_tax_amount' => '0.0000',
+ 'item_id' => '708'
+ ),
+ 1 => array(
+ 'parent_id' => '684',
+ 'weee_tax_applied_row_amount' => '0.0000',
+ 'base_price' => '10.0000',
+ 'base_weee_tax_row_disposition' => '0.0000',
+ 'tax_amount' => '0.0000',
+ 'base_weee_tax_applied_amount' => '0.0000',
+ 'weee_tax_row_disposition' => '0.0000',
+ 'base_row_total' => '20.0000',
+ 'discount_amount' => NULL,
+ 'row_total' => '20.0000',
+ 'weee_tax_applied_amount' => '0.0000',
+ 'base_discount_amount' => NULL,
+ 'base_weee_tax_disposition' => '0.0000',
+ 'price_incl_tax' => '10.0000',
+ 'base_tax_amount' => '0.0000',
+ 'weee_tax_disposition' => '0.0000',
+ 'base_price_incl_tax' => '10.0000',
+ 'qty' => '2.0000',
+ 'base_cost' => NULL,
+ 'base_weee_tax_applied_row_amnt' => NULL,
+ 'price' => '10.0000',
+ 'base_row_total_incl_tax' => '20.0000',
+ 'row_total_incl_tax' => '20.0000',
+ 'product_id' => '21',
+ 'order_item_id' => '776',
+ 'additional_data' => NULL,
+ 'description' => NULL,
+ 'weee_tax_applied' => 'a:0:{}',
+ 'sku' => 'test_product_sku_2',
+ 'name' => 'Test 2',
+ 'hidden_tax_amount' => '0.0000',
+ 'base_hidden_tax_amount' => '0.0000',
+ 'item_id' => '709'
+ )
+ ),
+ 'comments' => array(
+ 0 => array(
+ 'parent_id' => '684',
+ 'is_customer_notified' => '0',
+ 'is_visible_on_front' => '0',
+ 'comment' => 'Test CreditMemo successfully created',
+ 'created_at' => '2011-05-27 10:53:03',
+ 'comment_id' => '118'
+ ),
+ 1 => array(
+ 'parent_id' => '684',
+ 'is_customer_notified' => '0',
+ 'is_visible_on_front' => '0',
+ 'comment' => 'Test CreditMemo comment successfully added',
+ 'created_at' => '2011-05-27 10:53:03',
+ 'comment_id' => '119'
+ )
+ )
+);
+ Allows you to retrieve the list of credit memos by filters.
+ +Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| associative array | +filters | +Filters (optional) | +
Return:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderCreditmemoEntity | +
The salesOrderCreditmemoEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +updated_at | +Date of updating | +
| string |
+ created_at |
+Date of creation | +
| string |
+ increment_id |
+Increment ID | +
| string |
+ transaction_id |
+Transaction ID | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ cybersource_token |
+Cybersource token | +
| string |
+ invoice_id |
+ID of the invoice for which the credit memo was created | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ state |
+State | +
| string |
+ creditmemo_status |
+Credit memo status | +
| string |
+ email_sent |
+Defines whether the email is sent | +
| string |
+ order_id |
+ID of the order for which the credit memo was created | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ shipping_tax_amount |
+Shipping tax amount | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_adjustment_positive |
+ Adjustment refund amount (using base currency) |
+
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ adjustment |
+Adjustment | +
| string |
+ subtotal |
+Subtotal | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_adjustment |
+Base adjustment | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ adjustment_negative |
+ Adjustment fee amount |
+
| string |
+ subtotal_incl_tax |
+Subtotal including tax | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ base_subtotal_incl_tax |
+Base subtotal including tax | +
| string |
+ base_adjustment_negative |
+ Adjustment fee amount (using base currency) |
+
| string |
+ grand_total |
+Grand total | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_shipping_tax_amount |
+Base shipping tax amount | +
| string |
+ adjustment_positive |
+ Adjustment refund amount |
+
| string |
+ store_id |
+Store ID | +
| string |
+ hidden_tax_amount |
+Hidden tax amount | +
| string |
+ base_hidden_tax_amount |
+Base hidden tax amount | +
| string |
+ shipping_hidden_tax_amount |
+Shipping hidden tax amount | +
| string |
+ base_shipping_hidden_tax_amnt |
+Base shipping hidden tax amount | +
| string |
+ shipping_incl_tax |
+Shipping including tax | +
| string |
+ base_shipping_incl_tax |
+Base shipping including tax | +
| string |
+ base_customer_balance_amount |
+Base customer balance amount | +
| string |
+ customer_balance_amount |
+Customer balance amount | +
| string |
+ bs_customer_bal_total_refunded |
+ Refunded base customer balance amount |
+
| string |
+ customer_bal_total_refunded |
+Customer balance total refunded | +
| string |
+ base_gift_cards_amount |
+Base gift cards amount | +
| string |
+ gift_cards_amount |
+Gift cards amount | +
| string |
+ gw_base_price |
+ Gift wrapping price refunded amount (using base currency) |
+
| string |
+ gw_price |
+ Gift wrapping price refunded amount |
+
| string |
+ gw_items_base_price |
+Gift wrapping items base price | +
| string |
+ gw_items_price |
+Gift wrapping items price | +
| string |
+ gw_card_base_price |
+Gift wrapping card base price | +
| string |
+ gw_card_price |
+Gift wrapping card price | +
| string |
+ gw_base_tax_amount |
+ Gift wrapping tax amount refunded (using base currency) |
+
| string |
+ gw_tax_amount |
+ Gift wrapping tax amount refunded |
+
| string |
+ gw_items_base_tax_amount |
+Gift wrapping items base tax amount | +
| string |
+ gw_items_tax_amount |
+Gift wrapping items tax amount | +
| string |
+ gw_card_base_tax_amount |
+Gift wrapping card base tax amount | +
| string |
+ gw_card_tax_amount |
+Gift wrapping card tax amount | +
| string |
+ base_reward_currency_amount |
+Base reward currency amount | +
| string |
+ reward_currency_amount |
+Reward currency amount | +
| string |
+ reward_points_balance |
+Reward points balance | +
| string |
+ reward_points_balance_refund |
+Reward points balance refund | +
| string |
+ creditmemo_id |
+Credit memo ID | +
| array | + items |
+Array of salesOrderCreditmemoItemEntity | +
| array | + comments |
+Array of salesOrderCreditmemoCommentEntity | +
The salesOrderCreditmemoItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +item_id | +Credit memo item ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ weee_tax_applied_row_amount |
+ Applied fixed product tax row amount |
+
| string |
+ base_price |
+Base price | +
| string |
+ base_weee_tax_row_disposition |
+ Fixed product tax row disposition (in base currency) |
+
| string |
+ tax_amount |
+Tax amount | +
| string |
+ base_weee_tax_applied_amount |
+ Applied fixed product tax amount (in base currency) |
+
| string |
+ weee_tax_row_disposition |
+ Fixed product tax row disposition |
+
| string |
+ base_row_total |
+Base row total | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ row_total |
+Row total | +
| string |
+ weee_tax_applied_amount |
+ Applied fixed product tax amount |
+
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ base_weee_tax_disposition |
+ Fixed product tax disposition (in base currency) |
+
| string |
+ price_incl_tax |
+Price including tax | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ weee_tax_disposition |
+ Fixed product tax disposition |
+
| string |
+ base_price_incl_tax |
+Base price including tax | +
| string |
+ qty |
+Quantity | +
| string |
+ base_cost |
+Base cost | +
| string |
+ base_weee_tax_applied_row_amount |
+ Applied fixed product tax row amount (in base currency) |
+
| string |
+ price |
+Price | +
| string |
+ base_row_total_incl_tax |
+Base row total including tax | +
| string |
+ row_total_incl_tax |
+Row total including tax | +
| string |
+ product_id |
+Product ID | +
| string |
+ order_item_id |
+Order item ID | +
| string |
+ additional_data |
+Additional data | +
| string |
+ description |
+Description | +
| string |
+ weee_tax_applied |
+ Applied fixed product tax |
+
| string |
+ sku |
+Item SKU | +
| string |
+ name |
+Name | +
| string |
+ hidden_tax_amount |
+Hidden tax amount | +
| string |
+ base_hidden_tax_amount |
+Base hidden tax amount | +
The salesOrderCreditmemoCommentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ comment |
+Comment data | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ comment_id |
+Comment ID | +
| string |
+ is_visible_on_front |
+Defines whether the comment is visible on the frontend | +
Faults:
+ +| Fault Code | +Fault Description | +
|---|---|
| 101 | +Invalid filter given. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+$filter = array(
+ 'order_id' => array(
+ 'or' => array(
+ array(
+ 'from' => '673',
+ 'to' => '674',
+ ),
+ array(
+ 'from' => '677',
+ 'to' => NULL,
+ )
+ )
+ ),
+ 'increment_id' => array(
+ 'or' => array(
+ array(
+ 'from' => '100000617',
+ 'to' => '100000619',
+ ),
+ array(
+ 'from' => '100000619',
+ 'to' => NULL,
+ )
+ )
+ )
+);
+$creditmemoList = $proxy->call($sessionId, 'order_creditmemo.list', array($filter));
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderCreditmemoList($sessionId, '200000001');
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'state',
+ 'value' => array('key' => 'in', 'value' => '2,3')
+ )
+ )
+);
+$result = $client->salesOrderCreditmemoList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderCreditmemoList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array( + 0 => array( + 'store_id' => '1', + 'adjustment_positive' => NULL, + 'base_shipping_tax_amount' => '0.0000', + 'store_to_order_rate' => '1.0000', + 'base_discount_amount' => '0.0000', + 'base_to_order_rate' => '1.0000', + 'grand_total' => '60.0000', + 'base_adjustment_negative' => NULL, + 'base_subtotal_incl_tax' => '55.0000', + 'shipping_amount' => '5.0000', + 'subtotal_incl_tax' => '55.0000', + 'adjustment_negative' => NULL, + 'base_shipping_amount' => '5.0000', + 'store_to_base_rate' => '1.0000', + 'base_to_global_rate' => '1.0000', + 'base_adjustment' => '0.0000', + 'base_subtotal' => '55.0000', + 'discount_amount' => '0.0000', + 'subtotal' => '55.0000', + 'adjustment' => '0.0000', + 'base_grand_total' => '60.0000', + 'base_adjustment_positive' => NULL, + 'base_tax_amount' => '0.0000', + 'shipping_tax_amount' => '0.0000', + 'tax_amount' => '0.0000', + 'order_id' => '674', + 'email_sent' => NULL, + 'creditmemo_status' => NULL, + 'state' => '2', + 'shipping_address_id' => '1348', + 'billing_address_id' => '1347', + 'invoice_id' => NULL, + 'cybersource_token' => NULL, + 'store_currency_code' => 'USD', + 'order_currency_code' => 'USD', + 'base_currency_code' => 'USD', + 'global_currency_code' => 'USD', + 'transaction_id' => NULL, + 'increment_id' => '100000617', + 'created_at' => '2011-05-26 10:49:45', + 'updated_at' => '2011-05-26 10:49:45', + 'hidden_tax_amount' => '0.0000', + 'base_hidden_tax_amount' => '0.0000', + 'shipping_hidden_tax_amount' => NULL, + 'base_shipping_hidden_tax_amnt' => NULL, + 'shipping_incl_tax' => '5.0000', + 'base_shipping_incl_tax' => '5.0000', + 'base_customer_balance_amount' => NULL, + 'customer_balance_amount' => NULL, + 'bs_customer_bal_total_refunded' => '0.0000', + 'customer_bal_total_refunded' => '0.0000', + 'base_gift_cards_amount' => NULL, + 'gift_cards_amount' => NULL, + 'gw_base_price' => NULL, + 'gw_price' => NULL, + 'gw_items_base_price' => NULL, + 'gw_items_price' => NULL, + 'gw_card_base_price' => NULL, + 'gw_card_price' => NULL, + 'gw_base_tax_amount' => NULL, + 'gw_tax_amount' => NULL, + 'gw_items_base_tax_amount' => NULL, + 'gw_items_tax_amount' => NULL, + 'gw_card_base_tax_amount' => NULL, + 'gw_card_tax_amount' => NULL, + 'base_reward_currency_amount' => NULL, + 'reward_currency_amount' => NULL, + 'reward_points_balance' => NULL, + 'reward_points_balance_refund' => NULL, + 'creditmemo_id' => '617', + ), + 1 => array( + 'store_id' => '1', + 'adjustment_positive' => NULL, + ....................................... + 'creditmemo_id' => '620', + ) +);+
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
+ +Allows you to manage invoices.
+ +Resource Name: sales_order_invoice
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested shipment does not exists. | +
| 101 | +Invalid filters given. Details in error message. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested order does not exists | +
| 104 | +Invoice status not changed. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$notInvoicedOrderId = '100000003';
+
+// Create new invoice
+$newInvoiceId = $proxy->call($sessionId, 'sales_order_invoice.create', array($notInvoicedOrderId, array(), 'Invoice Created', true, true));
+
+// View new invoice
+$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
+
+var_dump($invoice);
+
+// Add Comment
+$proxy->call($sessionId, 'sales_order_invoice.addComment', array($newInvoiceId, 'Invoice comment, some text', true, false));
+
+// View invoice with new comment
+$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
+
+var_dump($invoice);
+
+$proxy->call($sessionId, 'sales_order_invoice.capture', $newInvoiceId);
+
+// View captured invoice
+$invoice = $proxy->call($sessionId, 'sales_order_invoice.info', $newInvoiceId);
+var_dump($invoice);
+ Aliases:
+Allows you to add a new comment to the order invoice.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ invoiceIncrementId |
+Invoice increment ID | +
| string |
+ comment |
+Invoice comment (optional) | +
| int |
+ email |
+Send invoice on email flag (optional) | +
| int |
+ includeComment |
+Include comment in email flag (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the comment is added to the invoice | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apikey');
+
+$result = $client->call($session, 'sales_order_invoice.addComment', array('invoiceIncrementId' => '200000006', 'comment' => 'invoice comment'));
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderInvoiceAddComment($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceAddComment((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '200000006', 'comment' => 'invoice comment', 'email' => null, 'includeComment' => null));
+var_dump($result->result);
+ Aliases:
+Allows you to cancel the required invoice. Note that not all order invoices can be canceled. Only some payment methods support canceling the order invoice (e.g., Google Checkout, PayPal Pro, PayPal Express Checkout).
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + invoiceIncrementId |
+Invoice increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean | +True if the order invoice is canceled. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$invoiceIncrementId = '100000013';
+
+$result = $proxy->call(
+ $session,
+ 'sales_order_invoice.cancel',
+ $invoiceIncrementId
+);
+ Aliases:
+Allows you to capture the required invoice. Note that not all order invoices can be captured. Only some payment methods support capturing the order invoice (e.g., PayPal Pro).
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + invoiceIncrementId |
+Invoice increment ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the order invoice is captured. | +
Notes:
+ +You should check the invoice to see if it can be captured before attempting to capture the invoice. Otherwise, the API call will generate an error.
+ +Invoices have states as defined in the model Mage_Sales_Model_Order_Invoice:
+Also note that there is a method call in the model that checks this for you - canCapture(). And it also verifies that the payment can be captured, so the invoice state might not be the only condition that is required to allow it to be captured.
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$orderIncrementId = '100000016';
+
+//Create invoice for order
+$invoiceIncrementId = $proxy->call(
+ $session,
+ 'sales_order_invoice.create',
+ array(
+ 'orderIncrementId' => $orderIncrementId,
+ array('order_item_id' => '15', 'qty' => '1')
+ )
+);
+
+//Capture invoice amount
+$result = $proxy->call(
+ $session,
+ 'sales_order_invoice.capture',
+ $invoiceIncrementId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionID = $proxy->login('apiUser', 'apiKey');
+
+$orderIncrementId = '100000016';
+
+//Create invoice for order
+$qty = array(
+Â Â Â array('order_item_id' => '15', 'qty' => '1')
+);
+$invoiceIncrementId = $proxy->salesOrderInvoiceCreate(
+ $sessionID,
+ $orderIncrementId,
+ Â $qty);
+
+//Capture invoice amount
+$result = $proxy->salesOrderInvoiceCapture(
+ $sessionID,
+ $invoiceIncrementId
+);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceCapture((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '100000016'));
+
+var_dump($result->result);
+ Aliases:
+Allows you to create a new invoice for an order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ invoiceIncrementId |
+Order increment ID | +
| array | + itemsQty |
+Array of orderItemIdQty (quantity of items to invoice) | +
| string |
+ comment |
+Invoice comment (optional) | +
| string |
+ email |
+Send invoice on email (optional) | +
| string |
+ includeComment |
+Include comments in email (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| string | +ID of the created invoice | +
The orderItemIdQty content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + order_item_id |
+Order item ID | +
| double | + qty |
+Quantity | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call(
+ $session,
+ 'sales_order_invoice.create',
+ array('orderIncrementId' => '200000008', array('15' => '1', '16' => '1'))
+ // orderItemIdQty Array is Keyed with Order Item ID, with Value of qty to invoice
+);
+var_dump ($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+//Create invoice for order
+
+// orderItemIdQty Array is Keyed with Order Item ID, with Value of qty to invoice
+$qty = array('15' => '1', '16' => '1');
+
+$invoiceIncrementId = $proxy->salesOrderInvoiceCreate(
+ $sessionID,
+ '200000008',
+ Â $qty
+);
+var_dump($invoiceIncrementId);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceCreate((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000008', 'itemsQty' => array('15' => '1', '16' => '1'), 'comment' => null,
+'email' => null,
+'includeComment' => null
+));
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve information about the required invoice.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | +invoiceIncrementId | +Invoice increment ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | + Array of salesOrderInvoiceEntity |
+
The salesOrderInvoiceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Defines whether the invoice is active | +
| string |
+ global_currency_code |
+Global currency code | +
| string |
+ base_currency_code |
+Base currency code | +
| string |
+ store_currency_code |
+Store currency code | +
| string |
+ order_currency_code |
+Order currency code | +
| string |
+ store_to_base_rate |
+Store to base rate | +
| string |
+ store_to_order_rate |
+Store to order rate | +
| string |
+ base_to_global_rate |
+Base to global rate | +
| string |
+ base_to_order_rate |
+Base to order rate | +
| string |
+ subtotal |
+Subtotal | +
| string |
+ base_subtotal |
+Base subtotal | +
| string |
+ base_grand_total |
+Base grand total | +
| string |
+ discount_amount |
+Discount amount | +
| string |
+ base_discount_amount |
+Base discount amount | +
| string |
+ shipping_amount |
+Shipping amount | +
| string |
+ base_shipping_amount |
+Base shipping amount | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ billing_address_id |
+Billing address ID | +
| string |
+ billing_firstname |
+First name in the billing address | +
| string |
+ billing_lastname |
+Last name in the billing address | +
| string |
+ order_id |
+Order ID | +
| string |
+ order_increment_id |
+Order increment ID | +
| string |
+ order_created_at |
+Date of order creation | +
| string |
+ state |
+Order state | +
| string |
+ grand_total |
+Grand total | +
| string |
+ invoice_id |
+Invoice ID | +
| array | + items |
+Array of salesOrderInvoiceItemEntity | +
| array | + comments |
+Array of salesOrderInvoiceCommentEntity | +
The salesOrderInvoiceItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Active flag | +
| string |
+ weee_tax_applied |
+Applied fixed product tax | +
| string |
+ qty |
+Quantity | +
| string |
+ cost |
+Cost | +
| string |
+ price |
+Price | +
| string |
+ tax_amount |
+Tax amount | +
| string |
+ row_total |
+Row total | +
| string |
+ base_price |
+Base price | +
| string |
+ base_tax_amount |
+Base tax amount | +
| string |
+ base_row_total |
+Base row total | +
| string |
+ base_weee_tax_applied_amount |
+Applied fixed product tax amount (in base currency) | +
| string |
+ base_weee_tax_applied_row_amount |
+Applied fixed product tax row amount (in base currency) | +
| string |
+ weee_tax_applied_amount |
+Applied fixed product tax amount | +
| string |
+ weee_tax_applied_row_amount |
+Applied fixed product tax row amount | +
| string |
+ weee_tax_disposition |
+Fixed product tax disposition | +
| string |
+ weee_tax_row_disposition |
+Fixed product tax row disposition | +
| string |
+ base_weee_tax_disposition |
+Fixed product tax disposition (in base currency) | +
| string |
+ base_weee_tax_row_disposition |
+Fixed product tax row disposition (in base currency) | +
| string |
+ sku |
+SKU | +
| string |
+ name |
+Name | +
| string |
+ order_item_id |
+Order item ID | +
| string |
+ product_id |
+Product ID | +
| string |
+ item_id |
+Item ID | +
The salesOrderInvoiceCommentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of creation | +
| string |
+ updated_at |
+Date of updating | +
| string |
+ is_active |
+Active flag | +
| string |
+ comment |
+Invoice comment | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ comment_id |
+Comment ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_invoice.info', '200000006');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderInvoiceInfo($sessionId, '200000006');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceInfo((object)array('sessionId' => $sessionId->result, 'invoiceIncrementId' => '200000006'));
+var_dump($result->result);
+ array
+ 'store_id' => string '2' (length=1)
+ 'base_grand_total' => string '384.9800' (length=8)
+ 'shipping_tax_amount' => string '0.0000' (length=6)
+ 'tax_amount' => string '0.0000' (length=6)
+ 'base_tax_amount' => string '0.0000' (length=6)
+ 'store_to_order_rate' => string '1.0000' (length=6)
+ 'base_shipping_tax_amount' => string '0.0000' (length=6)
+ 'base_discount_amount' => string '0.0000' (length=6)
+ 'base_to_order_rate' => string '1.0000' (length=6)
+ 'grand_total' => string '384.9800' (length=8)
+ 'shipping_amount' => string '5.0000' (length=6)
+ 'subtotal_incl_tax' => string '379.9800' (length=8)
+ 'base_subtotal_incl_tax' => string '379.9800' (length=8)
+ 'store_to_base_rate' => string '1.0000' (length=6)
+ 'base_shipping_amount' => string '5.0000' (length=6)
+ 'total_qty' => string '1.0000' (length=6)
+ 'base_to_global_rate' => string '1.0000' (length=6)
+ 'subtotal' => string '379.9800' (length=8)
+ 'base_subtotal' => string '379.9800' (length=8)
+ 'discount_amount' => string '0.0000' (length=6)
+ 'billing_address_id' => string '3' (length=1)
+ 'is_used_for_refund' => null
+ 'order_id' => string '2' (length=1)
+ 'email_sent' => null
+ 'can_void_flag' => string '0' (length=1)
+ 'state' => string '2' (length=1)
+ 'shipping_address_id' => string '4' (length=1)
+ 'store_currency_code' => string 'USD' (length=3)
+ 'transaction_id' => null
+ 'order_currency_code' => string 'USD' (length=3)
+ 'base_currency_code' => string 'USD' (length=3)
+ 'global_currency_code' => string 'USD' (length=3)
+ 'increment_id' => string '200000006' (length=9)
+ 'created_at' => string '2012-03-30 12:02:19' (length=19)
+ 'updated_at' => string '2012-03-30 12:02:19' (length=19)
+ 'hidden_tax_amount' => string '0.0000' (length=6)
+ 'base_hidden_tax_amount' => string '0.0000' (length=6)
+ 'shipping_hidden_tax_amount' => string '0.0000' (length=6)
+ 'base_shipping_hidden_tax_amnt' => null
+ 'shipping_incl_tax' => string '5.0000' (length=6)
+ 'base_shipping_incl_tax' => string '5.0000' (length=6)
+ 'base_total_refunded' => null
+ 'cybersource_token' => null
+ 'invoice_id' => string '1' (length=1)
+ 'order_increment_id' => string '200000002' (length=9)
+ 'items' =>
+ array
+ 0 =>
+ array
+ 'parent_id' => string '1' (length=1)
+ 'base_price' => string '379.9800' (length=8)
+ 'tax_amount' => string '0.0000' (length=6)
+ 'base_row_total' => string '379.9800' (length=8)
+ 'discount_amount' => null
+ 'row_total' => string '379.9800' (length=8)
+ 'base_discount_amount' => null
+ 'price_incl_tax' => string '379.9800' (length=8)
+ 'base_tax_amount' => string '0.0000' (length=6)
+ 'base_price_incl_tax' => string '379.9800' (length=8)
+ 'qty' => string '1.0000' (length=6)
+ 'base_cost' => null
+ 'price' => string '379.9800' (length=8)
+ 'base_row_total_incl_tax' => string '379.9800' (length=8)
+ 'row_total_incl_tax' => string '379.9800' (length=8)
+ 'product_id' => string '1' (length=1)
+ 'order_item_id' => string '3' (length=1)
+ 'additional_data' => null
+ 'description' => null
+ 'sku' => string 'n2610-slider' (length=12)
+ 'name' => string 'Nokia 2610 Phone' (length=16)
+ 'hidden_tax_amount' => string '0.0000' (length=6)
+ 'base_hidden_tax_amount' => string '0.0000' (length=6)
+ 'base_weee_tax_applied_amount' => string '0.0000' (length=6)
+ 'base_weee_tax_applied_row_amnt' => string '0.0000' (length=6)
+ 'base_weee_tax_applied_row_amount' => string '0.0000' (length=6)
+ 'weee_tax_applied_amount' => string '0.0000' (length=6)
+ 'weee_tax_applied_row_amount' => string '0.0000' (length=6)
+ 'weee_tax_applied' => string 'a:0:{}' (length=6)
+ 'weee_tax_disposition' => string '0.0000' (length=6)
+ 'weee_tax_row_disposition' => string '0.0000' (length=6)
+ 'base_weee_tax_disposition' => string '0.0000' (length=6)
+ 'base_weee_tax_row_disposition' => string '0.0000' (length=6)
+ 'item_id' => string '1' (length=1)
+ 'comments' =>
+ array
+ empty
+ Aliases:
+Allows you to retrieve the list of order invoices. Additional filters can also be applied.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| array | + filters |
+Array of filters for the list of invoices (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderInvoiceEntity | +
The salesOrderInvoiceEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ created_at |
+Date of invoice creation | +
| string |
+ order_currency_code |
+Order currency code (e.g., EUR) | +
| string |
+ order_id |
+Order ID | +
| string |
+ state |
+Order state | +
| string |
+ grand_total |
+Grand total amount invoiced | +
| string |
+ invoice_id |
+Invoice ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_invoice.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderInvoiceList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'state',
+ 'value' => array('key' => 'in', 'value' => '2,3')
+ )
+ )
+);
+$result = $client->salesOrderInvoiceList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderInvoiceList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'order_id' => string '2' (length=1) + 'increment_id' => string '200000001' (length=9) + 'created_at' => string '2012-03-30 12:02:19' (length=19) + 'state' => string '2' (length=1) + 'grand_total' => string '384.9800' (length=8) + 'order_currency_code' => string 'USD' (length=3) + 'invoice_id' => null + 1 => + array + 'order_id' => string '3' (length=1) + 'increment_id' => string '200000002' (length=9) + 'created_at' => string '2012-03-30 12:06:20' (length=19) + 'state' => string '2' (length=1) + 'grand_total' => string '339.9900' (length=8) + 'order_currency_code' => string 'USD' (length=3) + 'invoice_id' => null+
The Mage_Sales module allows you to manage sales orders, invoices, shipments, and credit memos.
+ +Allows you to manage shipments and tracking numbers.
+ +Resource Name: sales_order_shipment
+ +Aliases:
+Methods:
+| Fault Code | +Fault Message | +
|---|---|
| 100 | +Requested shipment not exists. | +
| 101 | +Invalid filters given. Details in error message. | +
| 102 | +Invalid data given. Details in error message. | +
| 103 | +Requested order not exists. | +
| 104 | +Requested tracking not exists. | +
| 105 | +Tracking not deleted. Details in error message. | +
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$notShipedOrderId = '100000003';
+
+// Create new shipment
+$newShipmentId = $proxy->call($sessionId, 'sales_order_shipment.create', array($notShipedOrderId, array(), 'Shipment Created', true, true));
+
+// View new shipment
+$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);
+
+var_dump($shipment);
+
+
+// Get allowed carriers for shipping
+$allowedCarriers = $proxy->call($sessionId, 'sales_order_shipment.getCarriers', $notShipedOrderId);
+
+end($allowedCarriers);
+
+$choosenCarrier = key($allowedCarriers);
+
+var_dump($allowedCarriers);
+var_dump($choosenCarrier);
+
+// Add tracking
+$newTrackId = $proxy->call($sessionId, 'sales_order_shipment.addTrack', array($newShipmentId, $choosenCarrier, 'My Track', rand(5000, 9000)));
+
+$shipment = $proxy->call($sessionId, 'sales_order_shipment.info', $newShipmentId);
+
+var_dump($shipment);
+ Aliases:
+Allows you to add a new comment to the order shipment.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ shipmentIncrementId |
+Shipment increment ID | +
| string |
+ comment |
+Shipment comment (optional) | +
| string |
+ email |
+Send email flag (optional) | +
| string |
+ includeInEmail |
+Include comment in email flag (optional) | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the comment is added to the order shipment | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.addComment', array('shipmentIncrementId' => '200000002', 'comment' => 'comment for the shipment', 'email' => null));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentAddComment($sessionId, '200000002');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentAddComment((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'comment' => 'comment for the shipment', 'email' => null, 'includeInEmail' => null));
+var_dump($result->result);
+ Aliases:
+Allows you to add a new tracking number to the order shipment.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string |
+ shipmentIncrementId |
+Shipment increment ID | +
| string |
+ carrier |
+Carrier code (ups, usps, dhl, fedex, or dhlint) | +
| string |
+ title |
+Tracking title | +
| string |
+ trackNumber |
+Tracking number | +
Returns:
+ +| Type | +Description | +
|---|---|
| int | +Tracking number ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.addTrack', array('shipmentIncrementId' => '200000002', 'carrier' => 'ups', 'title' => 'tracking title', 'trackNumber' => '123123'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentAddTrack($sessionId, '200000002', 'ups', 'tracking title', '123123');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentAddTrack((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'carrier' => 'ups', 'title' => 'tracking title', 'trackNumber' => '123123'));
+var_dump($result->result);
+ Aliases:
+Allows you to create a new shipment for an order.
+ + +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
| array | + itemsQty |
+Array of orderItemIdQty (optional) | +
| string | + comment |
+Shipment comment (optional) | +
| int | + email |
+Send email flag (optional) | +
| int | + includeComment |
+Include comment in email flag (optional) | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + shipmentIncrementId |
+Shipment increment ID | +
The orderItemIdQty content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| int | + order_item_id |
+Order item ID | +
| double | + qty |
+Quantity of items to be shipped | +
Notes: The array of orderItemQty is used for partial shipment. To create shipment for all order items, you do not need to specify these attributes.
+ +$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+$session = $proxy->login('apiUser', 'apiKey');
+
+$orderIncrementId = '200000006';
+$orderItemId = 3;
+$qty = 5;
+$itemsQty = array(
+ $orderItemId => $qty,
+ );
+
+$result = $proxy->call(
+ $session,
+ 'order_shipment.create',
+ array(
+ $orderIncrementId,
+ $itemsQty
+ )
+);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+$sessionId = $proxy->login('apiUser', 'apiKey');
+
+$itemsQty = array(
+ array(
+ 'order_item_id' => 3,
+ 'qty' => 3
+ ),
+ array(
+ 'order_item_id' => 4,
+ 'qty' => 5
+ ));
+
+$result = $proxy->salesOrderShipmentCreate($sessionId, '200000006', $itemsQty, 'shipment comment');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$itemsQty = array(
+ array(
+ 'order_item_id' => 3,
+ 'qty' => 3
+ ),
+ array(
+ 'order_item_id' => 4,
+ 'qty' => 5
+ ));
+
+$result = $proxy->salesOrderShipmentCreate((object)array(
+ 'sessionId' => $sessionId->result,
+ 'orderIncrementId' => '200000006',
+ 'itemsQty' => $itemsQty,
+ 'comment' => 'shipment comment',
+ 'email' => null, 'includeComment' => null));
+
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of allowed carriers for an order.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + orderIncrementId |
+Order increment ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| associativeArray | +result | +Array of carriers | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.getCarriers', '200000010');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentGetCarriers($sessionId, '200000010');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentGetCarriers((object)array('sessionId' => $sessionId->result, 'orderIncrementId' => '200000010'));
+var_dump($result->result);
+ array + 'custom' => string 'Custom Value' (length=12) + 'dhl' => string 'DHL (Deprecated)' (length=16) + 'fedex' => string 'Federal Express' (length=15) + 'ups' => string 'United Parcel Service' (length=21) + 'usps' => string 'United States Postal Service' (length=28) + 'dhlint' => string 'DHL' (length=3)+
Aliases:
+Allows you to retrieve the shipment information.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | +sessionId | +Session ID | +
| string | + shipmentIncrementId |
+Order shipment increment ID | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderShipmentEntity | +
The salesOrderShipmentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Shipment increment ID | +
| string |
+ store_id |
+Store ID | +
| string |
+ created_at |
+Date of shipment creation | +
| string |
+ updated_at |
+Date of shipment updating | +
| string |
+ shipping_address_id |
+Shipping address ID | +
| string |
+ order_id |
+Order ID | +
| string |
+ total_qty |
+Total quantity of items to ship | +
| string |
+ shipment_id |
+Shipment ID | +
| array | + items |
+Array of salesOrderShipmentItemEntity | +
| array | + tracks |
+Array of salesOrderShipmentTrackEntity | +
| array | + comments |
+Array of salesOrderShipmentCommentEntity | +
The salesOrderShipmentItemEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ parent_id |
+Parent ID | +
| string |
+ sku |
+Shipment item SKU | +
| string |
+ name |
+Shipment item name | +
| string |
+ order_item_id |
+Order item ID | +
| string |
+ product_id |
+Product ID | +
| string |
+ weight |
+Weight | +
| string |
+ price |
+Price | +
| string |
+ qty |
+Quantity of items | +
| string |
+ item_id |
+Item ID | +
The salesOrderShipmentTrackEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of tracking number creation | +
| string |
+ updated_at |
+Date of tracking number updating | +
| string |
+ carrier_code |
+Carrier code | +
| string |
+ title |
+Track title | +
| string |
+ number |
+Tracking number | +
| string |
+ order_id |
+Order ID | +
| string |
+ track_id |
+Track ID | +
The salesOrderShipmentCommentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string |
+ parent_id |
+Parent ID | +
| string |
+ created_at |
+Date of comment creation | +
| string |
+ comment |
+Shipment comment text | +
| string |
+ is_customer_notified |
+Defines whether the customer is notified | +
| string |
+ comment_id |
+Comment ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+$session = $client->login('apiUser', 'apiKey');
+$result = $client->call($session, 'sales_order_shipment.info', '200000003');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentInfo($sessionId, '200000003');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentInfo((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000003'));
+var_dump($result->result);
+ Aliases:
+Allows you to retrieve the list of order shipments. Additional filters can be applied.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| array | + filters |
+Array of filters for the list of shipments | +
Returns:
+ +| Type | +Name | +Description | +
|---|---|---|
| array | +result | +Array of salesOrderShipmentEntity | +
The salesOrderShipmentEntity content is as follows:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + increment_id |
+Increment ID | +
| string |
+ created_at |
+Date of shipment creation | +
| string |
+ total_qty |
+Total quantity of items to ship | +
| string |
+ shipment_id |
+Shipment ID | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.list');
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentList($sessionId);
+var_dump($result);
+ $client = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+// If some stuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+$complexFilter = array(
+ 'complex_filter' => array(
+ array(
+ 'key' => 'created_at',
+ 'value' => array('key' => 'in', 'value' => '2012-03-30 12:54:46')
+ )
+ )
+);
+$result = $client->salesOrderShipmentList($session, $complexFilter);
+
+var_dump ($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentList((object)array('sessionId' => $sessionId->result));
+var_dump($result->result);
+ array + 0 => + array + 'increment_id' => string '200000001' (length=9) + 'created_at' => string '2012-03-30 12:35:29' (length=19) + 'total_qty' => string '2.0000' (length=6) + 'shipment_id' => null + 1 => + array + 'increment_id' => string '200000002' (length=9) + 'created_at' => string '2012-03-30 12:54:46' (length=19) + 'total_qty' => string '1.0000' (length=6) + 'shipment_id' => null+
Aliases:
+Allows you to remove a tracking number from the order shipment.
+ +Aliases:
+Arguments:
+ +| Type | +Name | +Description | +
|---|---|---|
| string | + sessionId |
+Session ID | +
| string | + shipmentIncrementId |
+Shipment increment ID | +
| string | + trackId |
+Track ID | +
Returns:
+ +| Type | +Description | +
|---|---|
| boolean\int | +True (1) if the tracking number is removed from the shipment | +
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
+
+// If somestuff requires API authentication,
+// then get a session token
+$session = $client->login('apiUser', 'apiKey');
+
+$result = $client->call($session, 'sales_order_shipment.removeTrack', array('shipmentIncrementId' => '200000002', 'trackId' => '2'));
+var_dump($result);
+
+// If you don't need the session anymore
+//$client->endSession($session);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
+$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary
+
+$result = $proxy->salesOrderShipmentRemoveTrack($sessionId, '200000002', '2');
+var_dump($result);
+ $proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl');
+
+$sessionId = $proxy->login((object)array('username' => 'apiUser', 'apiKey' => 'apiKey'));
+
+$result = $proxy->salesOrderShipmentRemoveTrack((object)array('sessionId' => $sessionId->result, 'shipmentIncrementId' => '200000002', 'trackId' => '2'));
+var_dump($result->result);
+ Magento provides you with the ability to use two modes for SOAP API V2. These are with WS-I compliance mode enabled and WS-I compliance mode disabled. The first one was introduced to make the system flexible, namely, to increase compatibility with .NET and Java programming languages.
+ +To enable/disable the WS-I compliance mode, perform the following steps:
+
The WS-I compliant mode uses the same WSDL endpoint as SOAP API V2 does. The key difference is that XML namespaces are used in WS-I compliance mode.
+
WSDL file with disabled WS-I compliance mode:
+
WSDL file with enabled WS-I compliance mode:
+
+{% include v1x/eol_message.html %}
+
+Welcome to the documentation home page for the Magento Enterprise Edition (EE) 1.13 and Community Edition (CE) 1.8 releases! Let's start out by telling you a little bit about them.
+Magento recognizes that merchants and systems integrators require higher performance in key areas—such as product search, product browsing, and checkout. Merchants and integrators are now commonly coming to Magento with:
+To address these ever-growing needs, Magento systematically examined performance and scalability characteristics. Our engineers continually measured performance on a range of environments and use cases to identify and remove bottlenecks, and then conducted extensive testing to confirm improvements.
+We characterized performance based on variations in deployment and business configurations to ensure improvement for a range of merchant sizes and configurations.
+In this release, we focused primarily on improvements to indexing, tax calculations, caching, and checkout performance.
+We're excited about the changes you'll find, including:
+
+{% include v1x/eol_message.html %}
+The focus of the Magento Enterprise Edition 1.13 release is performance and scalability. The benchmarking results + presented here demonstrate that we have addressed the following concerns:
+ +We identified the following areas for enhancement in Magento Enterprise Edition 1.13:
+ +Magento Enterprise Edition 1.13 delivers the following improvements over Magento Enterprise Edition 1.12:
+ +Before we introduce you to the benchmarks, an overview of our multi-node benchmarking facility is in order. We + started with a basic multi-node cluster with load balancer and caching and separate DB node, and installed + Apache. This is a familiar hardware configuration for the Magento developer community. Once provisioned, we + installed both Magento Enterprise Edition 1.13 and Magento Enterprise Edition 1.12 on the cluster to compare + their performance.
+ +This is a representation of the multi-node Magento Enterprise Edition 1.12/1.13 installation used for performance + testing. It consists of four physical nodes, three of which are virtualized.
+ +
+ We used HP ProLiant SL230s Gen8 servers with 8x16GB DDR3 and 2x Intel Xeon E5â€2660 CPUs for our benchmarking.
+ +We used a physical disk of a usable 1.2 TB managed by a RAID10 controller. The load balancer we used is + nginx.
+ +The cluster resides in our Las Vegas data center, connected to the Internet via a gigabit connection. We tested + the cluster using the popular Gatling suite from our engineering offices in Austin, TX.
+ +
+ This section presents the merchant scenarios we simulated for our testing. These scenarios are based on + real-world experience and industry standards with respect to shopper flows and catalog sizes.
+ +We used real-world, established eCommerce metrics to simulate shopper flows.
+ +
+ The catalogs we simulated also reflect real-world, established eCommerce experience.
+ +
+ The simulated merchant profile we benchmarked against represents the profile of our enterprise customers. We + established these metrics based on the day-to-day experience of large merchants operating a successful eCommerce + business. Again, we used what we consider to be a typical hardware and software configuration.
+ +These benchmarks were generated during extensive testing of our multi-node configuration running Magento + Enterprise Edition 1.13 described above. Our configuration was modeled after what a commercial hosting partner + would put into production, and the results reflect accurate gains over Magento Enterprise Edition 1.12.
+ +The duration of the test sessions is 72 seconds, which significantly stresses the multi-node configuration.
+ +In Magento Enterprise Edition 1.12, any change to a product would result in a full re-index. Magento Enterprise + Edition 1.13 introduces a new feature--incremental re-indexing. With incremental re-indexing, only those items + that were changed or added will be re-indexed, reducing the processing time to a fraction of what was required + before.
+ +Take the example of a merchant with a catalog containing 500,000 products. In Magento Enterprise Edition 1.12, + any change to a product would result in a full re-index operation. In Magento Enterprise Edition 1.13, + incremental re-indexing means the merchant will only re-index items that were changed. The test focused on + measuring the improvements provided by the incremental re-indexing feature in Magento Enterprise Edition 1.13. + The table below compares improvements to common admin actions, such as changing a product description, prices or + inventory.
+ +
+ As part of the benchmarking effort, we also measured the improvements in the full re-indexing feature on Magento + Enterprise Edition 1.13, where indexing a 500,000-item catalog was 53% faster than Magento Enterprise Edition + 1.12. Faster re-indexing means less load on the system and that changes to the catalog propagate faster to the + storefront.
+ +
+ The Magento Enterprise Edition 1.13 indexer component contains a number of individual indexers such as Product + Flat Data and Product Price. When a Magento admin changes the price of a product, it is only necessary to + execute the Product Price indexer for pricing changes to propagate to the frontend. The completion times of + these individual indexers were measured in the benchmark environment for Magento Enterprise Edition 1.13 and + Magento Enterprise Edition 1.12.
+ +This section presents the results for full re-index completion times for the individual indexers in Magento + Enterprise Edition 1.13 compared to Magento Enterprise Edition 1.12.
+ +
+ When Magento Enterprise Edition 1.12 and Magento Enterprise Edition 1.13 were compared, with both running on our + multi-node benchmarking configuration, Magento Enterprise Edition 1.13 loaded pages 65% faster than Magento + Enterprise Edition 1.12.
+ +Guest checkout and registered user checkout are two flows that are crucial to storefront operation. This section + presents the results of page load time measurements for these two flows.
+ +In the guest checkout flow pages, Magento Enterprise Edition 1.13 provides a substantial decrease in load times + over its predecessor, most of the time more than twice as fast.
+ +
+ The bar chart below presents the improvements in page load times for registered checkout flow.
+ +
+ In addition to page load times, the benchmark also focused on measuring throughput improvements, particularly + page views per day and orders per day.
+ +During our testing, which simulated a storefront running at peak hours, EE 1.13 executed 33% more orders and 31% + more page views than Magento Enterprise Edition 1.12 on the multi-node benchmarking configuration. Notably, + Magento Enterprise Edition 1.13 served 47K pages during the test run (10 minutes).
+ +
+ What we noted during the benchmarking tests:
+ +Magento Enterprise Edition 1.13 was engineered for performance--and clearly delivers on the goal as measured by + important metrics.
+ +In addition, we have focused on providing these benefits without the need to upgrade existing hardware, improving + your return on assets and investment.
+ +| Concurrent session (users) | +1000 | +
| Peak load duration | +10 minutes | +
| Session duration | +72 seconds | +
| CPU utilization | +95% | +
| + | ||||||||||||
| Magento EE v1.13 | ++ | + | + | + | + | + | + | + | + | + | + | + |
| Requests | ++ | Total | +OK | +KO | ++ | Min | +Max | +Mean | +Std Dev | +95th Pct | +99th Pct | +Req/s | +
| Global Information0 | ++ | 62161 | +62087 | +74 | ++ | 80 | +12910 | +1735 | +1869 | +5780 | +8060 | +75 | +
| product page0 | ++ | 28573 | +28573 | +0 | ++ | 80 | +9390 | +709 | +996 | +2670 | +4920 | +34 | +
| Click add to cart1 | ++ | 10458 | +10458 | +0 | ++ | 440 | +7170 | +1868 | +1139 | +4010 | +4980 | +13 | +
| Click add to cart Redirect 12 | ++ | 10458 | +10458 | +0 | ++ | 960 | +12910 | +3816 | +2239 | +8050 | +9960 | +13 | +
| click checkout3 | ++ | 3486 | +3486 | +0 | ++ | 1100 | +10800 | +3459 | +1965 | +7130 | +8970 | +4 | +
| Registered Checkout:Login and Pick Address4 | ++ | 3366 | +3366 | +0 | ++ | 200 | +7380 | +1155 | +1482 | +4870 | +5900 | +4 | +
| Registered Checkout:Login and Pick Address Redirect 15 | ++ | 3366 | +3366 | +0 | ++ | 700 | +11440 | +2605 | +1662 | +5640 | +7710 | +4 | +
| Guest Checkout start6 | ++ | 120 | +120 | +0 | ++ | 360 | +2490 | +908 | +487 | +1860 | +2420 | +0 | +
| Registered:Pick Billing Address 17 | ++ | 120 | +120 | +0 | ++ | 390 | +4240 | +1457 | +974 | +3510 | +4210 | +0 | +
| Registered:Pick Billing Address 2-18 | ++ | 120 | +120 | +0 | ++ | 410 | +3690 | +1218 | +685 | +2460 | +3070 | +0 | +
| Registered:Pick Billing Address 2-29 | ++ | 120 | +120 | +0 | ++ | 400 | +3600 | +1201 | +714 | +2700 | +3510 | +0 | +
| Registered:Go to pick Shipping Method10 | ++ | 120 | +120 | +0 | ++ | 340 | +2900 | +1072 | +633 | +2330 | +2700 | +0 | +
| Guest:Pick Billing Address 111 | ++ | 120 | +120 | +0 | ++ | 610 | +4620 | +1688 | +941 | +3580 | +4440 | +0 | +
| Guest:Pick Billing Address 212 | ++ | 120 | +120 | +0 | ++ | 380 | +3530 | +1049 | +589 | +2050 | +2750 | +0 | +
| Guest:Go to pick Shipping Method13 | ++ | 120 | +120 | +0 | ++ | 300 | +2080 | +796 | +401 | +1530 | +1960 | +0 | +
| Set Shipping Method (Flatrate) 114 | ++ | 240 | +240 | +0 | ++ | 510 | +4830 | +1780 | +1066 | +3930 | +4720 | +0 | +
| Set Shipping Method (Flatrate): Goto Payment15 | ++ | 240 | +240 | +0 | ++ | 300 | +3150 | +905 | +516 | +1940 | +2300 | +0 | +
| Set Payment Method (Check/MO) 116 | ++ | 240 | +240 | +0 | ++ | 670 | +5290 | +1787 | +987 | +3660 | +4920 | +0 | +
| Set Payment Method (Check/MO) 217 | ++ | 240 | +240 | +0 | ++ | 300 | +2760 | +904 | +518 | +2010 | +2440 | +0 | +
| Set Payment Method (Check/MO) 318 | ++ | 220 | +220 | +0 | ++ | 370 | +8180 | +2696 | +1725 | +5810 | +7590 | +0 | +
| /checkout/../success/19 | ++ | 240 | +240 | +0 | ++ | 250 | +2830 | +931 | +583 | +1970 | +2530 | +0 | +
| /checkout/../success/ Redirect 120 | ++ | 74 | +0 | +74 | ++ | 1030 | +8350 | +2473 | +1620 | +5590 | +7310 | +0 | +
| + | + | + | + | + | + | + | + | + | + | + | + | + |
| + | + | + | + | + | + | + | + | + | + | + | + | + |
| + | + | + | + | + | + | + | + | + | + | + | + | + |
| + | + | + | + | + | + | + | + | + | + | + | + | + |
| Magento EE v1.12 | ++ | + | + | + | + | + | + | + | + | + | + | + |
| Requests | ++ | Total | +OK | +KO | ++ | Min | +Max | +Mean | +Std Dev | +95th Pct | +99th Pct | +Req/s | +
| Global Information0 | ++ | 48044 | +47887 | +157 | ++ | 40 | +40580 | +4985 | +3290 | +10650 | +13870 | +58 | +
| product page0 | ++ | 21327 | +21286 | +41 | ++ | 40 | +20040 | +4557 | +2820 | +9740 | +12350 | +26 | +
| Click add to cart1 | ++ | 8340 | +8324 | +16 | ++ | 40 | +12130 | +4216 | +2217 | +7520 | +9000 | +10 | +
| Click add to cart Redirect 12 | ++ | 8324 | +8320 | +4 | ++ | 40 | +16500 | +7022 | +3449 | +11780 | +13500 | +10 | +
| click checkout3 | ++ | 2780 | +2779 | +1 | ++ | 920 | +12350 | +6311 | +2829 | +9760 | +10950 | +3 | +
| Guest Checkout start4 | ++ | 90 | +90 | +0 | ++ | 390 | +3690 | +2103 | +795 | +3210 | +3410 | +0 | +
| Registered Checkout:Login and Pick Address5 | ++ | 2690 | +2690 | +0 | ++ | 180 | +19120 | +3298 | +4984 | +15470 | +16940 | +3 | +
| Guest:Pick Billing Address 16 | ++ | 90 | +90 | +0 | ++ | 600 | +7750 | +4348 | +1605 | +6430 | +7400 | +0 | +
| Registered Checkout:Login and Pick Address Redirect 17 | ++ | 2690 | +2688 | +2 | ++ | 40 | +24360 | +5433 | +3350 | +11780 | +14060 | +3 | +
| Guest:Pick Billing Address 28 | ++ | 90 | +90 | +0 | ++ | 520 | +8240 | +3412 | +1423 | +5480 | +6810 | +0 | +
| Guest:Go to pick Shipping Method9 | ++ | 90 | +90 | +0 | ++ | 310 | +4780 | +2334 | +888 | +3300 | +4450 | +0 | +
| Registered:Pick Billing Address 110 | ++ | 90 | +90 | +0 | ++ | 370 | +10090 | +3657 | +2453 | +8660 | +9600 | +0 | +
| Registered:Pick Billing Address 2-111 | ++ | 90 | +90 | +0 | ++ | 540 | +17670 | +4148 | +2741 | +10220 | +12510 | +0 | +
| Registered:Pick Billing Address 2-212 | ++ | 90 | +90 | +0 | ++ | 530 | +12640 | +3983 | +2411 | +8290 | +11590 | +0 | +
| Registered:Go to pick Shipping Method13 | ++ | 90 | +90 | +0 | ++ | 360 | +6290 | +2546 | +1401 | +5050 | +5980 | +0 | +
| Set Shipping Method (Flatrate) 114 | ++ | 180 | +180 | +0 | ++ | 450 | +7640 | +3926 | +1884 | +6550 | +7450 | +0 | +
| Set Shipping Method (Flatrate): Goto Payment15 | ++ | 180 | +180 | +0 | ++ | 380 | +6290 | +2451 | +1256 | +4270 | +4830 | +0 | +
| Set Payment Method (Check/MO) 116 | ++ | 180 | +180 | +0 | ++ | 570 | +8290 | +3923 | +1996 | +6460 | +7300 | +0 | +
| Set Payment Method (Check/MO) 217 | ++ | 180 | +180 | +0 | ++ | 330 | +5230 | +2318 | +1238 | +4210 | +4810 | +0 | +
| Set Payment Method (Check/MO) 318 | ++ | 180 | +180 | +0 | ++ | 940 | +40580 | +12673 | +7957 | +25910 | +29540 | +0 | +
| /checkout/../success/19 | ++ | 180 | +180 | +0 | ++ | 230 | +3330 | +1437 | +854 | +2870 | +3150 | +0 | +
| /checkout/../success/ Redirect 120 | ++ | 93 | +0 | +93 | ++ | 780 | +10470 | +5031 | +2251 | +7920 | +8880 | +0 | +
| + |

+ {% include v1x/eol_message.html %}
+
+
+
+
+
+ These Release Notes contain the following information:
+Magento has the following patches available for multiple Magento CE versions.
+ +EE_1.14.0.1 in the name. These patches were all tested against CE 1.8.x as well.Patch name: SUPEE-3941
+/app/code/community directory structure, the Magento administrator
+ sees an error message in the Magento Connect Manager.Patch name: SUPEE-3762.
+ Refreshing the SOAP v2
+ index page (http://your-magento-host-name/index.php/api/v2_soap/index/) results in all
+ administrators and customers viewing the Magento installation page.
Magento has fixed an issue that prevented some Discover credit cards from validating properly. The issue was that + certain Discover credit card number ranges were not recognized as being valid. As a result of the fix, all Discover + cards should validate properly.
+The issue affects Magento CE versions 1.4.2.0–1.8.1.0.
+To get a fix for the issue, see Discover credit card validation issue: Magento EE 1.9.1.1–1.13.1.0 and CE + 1.4.2.0–1.8.1.0.
+You can use PHP 5.4 with Magento CE versions 1.6.0.0–1.8.1.0.
+To get the patch, see Getting the PHP 5.4 + patch for Magento Enterprise Edition (EE) and Community Edition (CE).
+For more information about PHP 5.4, see the PHP migration page and the PHP changelog.
+ +This section discusses how to get patches referenced in these Release Notes.
+To get patches for Magento CE:
+See the following sections for information about changes in this release:
+Magento CE 1.8.1.0 helps advance overall product quality and ease operations by providing significant tax + calculation improvements, a wide range of bug fixes, and several security enhancements.
+ +CE 1.8.1.0 resolves Value Added Tax (VAT) and Fixed Product Tax (FPT) issues so that Magento administrators can + create invoices and credit memos to give merchants merchants access to accurate and consistent tax calculations + and displays. We've also addressed:
+CE 1.8.1.0 includes bug fixes across important feature areas, including the shopping cart, checkout, content + management system, and product import and export function. Many of these updates came from a hackathon held with + Magento community developers, which demonstrates the vitality of our development community and their powerful + ability to help us advance the platform.
+ +CE 1.8.1.0 includes several security enhancements that were identified through our rigorous security assessment + process. Magento complements its own comprehensive internal testing with quarterly penetration testing by expert + consultants and actively works with the development community to identify security issues in order to harden the + platform against potential threats.
+ + + +Magento addressed the following security issues:
+frontend cookie to protect user sessions.
+
+ + There is a known Issue After Upgrading to CE 1.8.1 that affects + you only if you do not follow the recommended procedure to upgrade to a new environment as + discussed in Getting Ready For + Your Upgrade.
+Symptom: After completing the upgrade, when you log in to the Admin Panel and click + System > Configuration, a fatal error similar to the following displays in your + browser:
+Class 'Mage_Googlecheckout_Helper_Data' not found in /var/www/html/magento/app/Mage.php on line 547+ +
Solution:
+root privileges, delete all files except config.xml from the
+ following directory:magento-install-dir/app/code/core/Mage/GoogleCheckout/etc+
See the following sections for a discussion of changes in this release:
+*) wildcard character for the value of State when you set up a new
+ tax rate. This enables you to apply the same tax rate to all states or provinces in a particular country.http://xmlapi.dhl-usa.com/ApiLanding.asp+
Tax calculation issues can be divided into the following sections:
+The following general fixes were made to Magento tax configuration and calculations:
+NOT LOGGED IN customer group.)The following tax rounding issues were resolved:
+The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web + store:
+Fixes in this release can be divided into the following categories:
+ + +'Zend_Date_Exception' with message 'Invalid year, it must be between -10000 and 10000'Mage_Catalog_Block_Product_Abstract class that caused errors to display on product view pages in
+ your web store.Mage_Page_Block_Template_Links::addLinkBlock to enable you to sort an array of results by
+ position.See the following sections for information about changes in this release:
+The USPS changed the names of their Priority and Express shipping options in their API in July 2013. To enable you + to continue utilizing USPS Priority and Express mail methods, CE 1.8 includes a patch that addresses the + issue.
+Following are details about the upgrade impact:
+Tax calculation issues can be divided into the following sections:
+The following general fixes were made to Magento tax configuration and calculations:
+Sub item price = Sub item base price * Applicable tiered price adjustment or discount, then rounded
+ Bundle price = Sum (round(sub item price * qty))round(unit price * non-integer quantity)For details, see the Magento + User Guide.
+ + +The following issues relate to one-cent rounding errors in the web store or shopping cart:
+The following issues relate to errors in calculating taxes that include FPT in the web store or shopping cart:
+The following issues relate to price calculations when coupon codes or other discounts are applied in the web store + or shopping cart:
+The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web + store:
+The following are fixed in the Magento SOAP v2.0 APIs (with exceptions noted):
+8888 in the following example):
+ $result = $client->call($sessionId, 'catalog_product.info', '8888', null, null, 'sku');
+
+ salesOrderAddComment.
+
+ shoppingCartProductMoveToCustomerQuote method works properly.
+
+ from-to complex filters to perform "window" filtration on a single
+ field. For example, you can use from and to on the created_at return a list
+ of sales orders using the salesOrderList.
+
+ productGetSpecialPrice method returns special price information for a product, whether or not
+ WS-I Compliance is
+ enabled.
+
+ shoppingCartPaymentList method returns the list of the available payment
+ methods for the shopping cart appropriately. The following error is no longer returned:
+ SOAP-ERROR: Encoding: object has no 'code' property in name
+
+ productAttributeAddOption and catalogProductAttributeUpdate methods are now supported when WS-I
+ Compliance is enabled.
+
+ salesOrderCreditmemoCreate is now correct; that is, it matches the code.
+
+ C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin> wsdl /out:Magento.cs /v
+ http://magentohost/api/v2_soap/?wsdl
+
+ catalogProductAttributeInfo.
+
+ product_custom_option.add operation with multicall no
+ longer results in redundant options.
+
+ Fixes in this release can be divided into the following categories:
+There has been an error processing your request. Please contact us or try again later).
+
+ 10,50 (using a comma character and not a period) for Adjustment
+ Fee now results in the correct amount of credit being applied to the transaction.
+
+ /sitemap/catalog/string.
+
+ SAMPLE printed on them only when you request a sample label.
+
+ The following fixes relate to administering and using shopping cart price rules and catalog price rules:
+QTY) of all products imports correctly.
+
+ use_cfg_max_sale_qty) is correct.
+
+ user@example.com and User@example.com).
+
+ .csv) file have been resolved.
+
+ state correctly. (Before the fix, city was sent as the value for state.)
+
+ Gateway error: Void error: V18A4B18E0F9 has been captured errors when canceling
+ partially invoiced orders when the Payflow Pro processor was used to process the payment.
+
+ This
+ customer email already exists.
+
+ .htaccess.sample provided with Magento now includes php_value memory_limit 512M to be
+ consistent with the Magento system
+ requirements.mage_ because you specified a tables prefix during installation).Magento acknowledges and thanks everyone in the Magento Community who contributed to this release, including Colin + Mollenhour for Redis modules.
+ +
+ {% include v1x/eol_message.html %}
+
+
+
+ These Release Notes contain the following information:
+ +Magento has the following patches available for multiple Magento EE versions.
+ +EE_1.14.0.1 in the name. These patches were all tested against EE 1.13.x as well.Patch name: PATCH_SUPEE-3941_EE_1.14.0.1_v1-2014-08-12-12-10-06.sh
+/app/code/community directory structure, the Magento administrator
+ sees an error message in the Magento Connect Manager.Patch name: PATCH_SUPEE-3762_EE_1.14.0.1_v1.sh.
+ Refreshing the SOAP v2
+ index page (http://your-magento-host-name/index.php/api/v2_soap/index/) results in all
+ administrators and customers viewing the Magento installation page.
Patch name: PATCH_SUPEE-3819_EE_1.14.0.1_v1.sh. + Multiple Magento + administrators can simultaneously add new products; or edit descriptions, edit prices, or edit stock quantities of + existing products without causing deadlocks, key violations, or critical data errors. Together with applying the + patch, you must set all indexers to Update when scheduled as follows:
+Magento has fixed an issue that prevented some Discover credit cards from validating properly. The issue was that + certain Discover credit card number ranges were not recognized as being valid. As a result of the fix, all Discover + cards should validate properly.
+The issue affects EE versions 1.9.1.1 through 1.13.1.0.
+To get a fix for the issue, see Discover credit card validation issue: Magento EE 1.9.1.1–1.13.1.0 and CE + 1.4.2.0–1.8.1.0.
+You can use PHP 5.4 with Magento EE versions 11.0.0.0–1.13.1.0.
+To get the patch, see Getting the PHP 5.4 + patch for Magento Enterprise Edition (EE) and Community Edition (CE).
+For more information about PHP 5.4, see the PHP migration page and the + PHP changelog.
+ +This section discusses how to get patches referenced in these Release Notes. Magento has other patches available + from the EE support portal and the partner portal; you + can use the following instructions to install any of those patches as well.
+To get patches for Magento EE:
++
See the following sections for information about changes in this release:
+Magento EE 1.13.1.0 helps advance overall product quality and ease operations by providing significant tax + calculation improvements, a wide range of bug fixes, and several security enhancements.
+ +EE 1.13.1.0 resolves Value Added Tax (VAT) and Fixed Product Tax (FPT) issues so that Magento administrators can + create invoices and credit memos to give merchants merchants access to accurate and consistent tax calculations + and displays. We've also addressed:
+EE 1.13.1.0 includes bug fixes across important feature areas, including the shopping cart, checkout, content + management system, and product import and export function. Many of these updates came from a hackathon held with + Magento community developers, which demonstrates the vitality of our development community and their powerful + ability to help us advance the platform.
+ +EE 1.13.1.0 includes several security enhancements that were identified through our rigorous security assessment + process. Magento complements its own comprehensive internal testing with quarterly penetration testing by expert + consultants and actively works with the development community to identify security issues in order to harden the + platform against potential threats.
+ +Magento addressed the following security issues:
+frontend cookie to protect user sessions.
+
+ There is a known issue after upgrading to EE 1.13.1 that affects you only if you do not follow + the recommended procedure to upgrade to a new environment as discussed in Getting Ready For Your + Upgrade.
+Symptom: After completing the upgrade, when you log in to the Admin Panel and click + System > Configuration, a fatal error similar to the following displays in your + browser:
+Class 'Mage_Googlecheckout_Helper_Data' not found in /var/www/html/magento/app/Mage.php on line 547+ +
Solution:
+root privileges, delete all files except config.xml from the
+ following directory:magento-install-dir/app/code/core/Mage/GoogleCheckout/etc+
See the following sections for a discussion of changes in this release:
+*) wildcard character for the value of State when you set up a new
+ tax rate. This enables you to apply the same tax rate to all states or provinces in a particular country.http://xmlapi.dhl-usa.com/ApiLanding.asp.
Tax calculation issues can be divided into the following sections:
+The following general fixes were made to Magento tax configuration and calculations:
+NOT LOGGED IN customer group.)The following tax rounding issues were resolved:
+The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web + store:
+Fixes in this release can be divided into the following categories:
+'Zend_Date_Exception' with message 'Invalid year, it must be between -10000 and 10000'Mage_Catalog_Block_Product_Abstract class that caused errors to display on product view pages in
+ your web store.Mage_Page_Block_Template_Links::addLinkBlock to enable you to sort an array of results by
+ position.In response to customer feedback about EE 1.13.0.0 and EE 1.13.0.1, Magento has modified the functionality to + smooth the migration path from earlier EE versions and support duplicate category URL keys.
+See the following sections for a discussion of changes in this release:
+Important:
+This section discusses how search engine optimization (SEO) works in EE 1.13.0.2. This section is not + intended to be a tutorial on SEO.
+See one of the following for more information:
+The following sections quickly summarize the changes you'll see in EE 1.13.0.2:
+ + +Product URL key uniqueness
+In EE 1.12, it was possible to have multiple products with the same URL key; however, every time the indexer
+ ran, it silently assigned a numerical suffix to duplicates (for example, shoes became
+ shoes-1 and so on).
Every time this happened, another URL rewrite was created, resulted in a set of chained redirects for + the same product. Having multiple URLs for a product dilutes the effectiveness of URL in search engine + weightings, especially if you enabled canonical URLs. (As discussed in this + article on Google's blog, a canonical URL is a public specification of your preferred URL. The + canonical URL is used by any search engine when crawling and indexing your site.)
+This behavior was not clear to merchants and had the effect of diluting search engine weightings.
+In EE 1.13.0.2, there is a single, unique way to access a product (or multiple ways if you use the category + path in URLs).
+No more chained redirects
+Per-entity indexing
+Similar to chained redirects, in EE 1.12, if a product had the same URL key as its parent category, the indexer + assigned an incrementing numeric suffix to either the category or the product. This was done without the + merchant's knowledge and was confusing as well. +
In EE 1.12, if you named a top-level category slippers and had product also named
+ slippers, the indexer allowed to access to the category using a URL like the following:
+ http://www.example.com/slippers-1
In EE 1.13.0.2, the same product can be accessed using a URL like:
+ http://www.example.com/slippers
+
There is a new Admin Panel setting to specify how indexing should be prioritized. This setting, + System > Configuration > CATALOG > Catalog > Search + Engine Optimizations > Priority for Duplicated URL Keys, is discussed in more + detail in Prioritizing URL Resolution.
+The following entities can be indexed and therefore have a requirement for URL key uniqueness:
+Uniqueness rules for each entity type follow:
+| Entity type | +Uniqueness rule | +
|---|---|
| Product, including custom URL redirects† | +All product URL keys must be globally unique. | +
| Category | +
+ Category URL keys must be unique only in the same level in the hierarchy; for example +website+ Note: Uniqueness rules apply to inactive categories as well. You cannot use the same URL + key for both an active and inactive category at the same level in the category hierarchy. + |
+
| CMS | +CMS URL keys, like category URL keys, must be unique only in the same level in the + hierarchy. | +
†—Custom URL redirect refers to a product's Create Custom Redirect + for old URL option.
+ +The following table shows category URL keys that are allowed. (The URL key is shoes for all entities
+ in the table.)
| URL examples | +Reason allowed | +
|---|---|
http://example.com/mens/shoes+ http://example.com/womens/shoes |
+ Different category hierarchies. | +
http://example1.com/shoes+ http://example2.com/shoes |
+ Different domains. | +
http://example.com/shoes (store view 1)+ http://example.com/shoes (store view 2) |
+ Different store views. | +
Notes:
+Suppose you have the following set of URL keys. All of them are allowed because they're for different entity types. +
+| Entity type | +Entity name | +URL key | +Sample URL | +
|---|---|---|---|
| Category | +shoes | +shoes | +http://www.example.com/shoes.html | +
| Product | +shoes | +shoes | +http://www.example.com/shoes.html | +
| Custom URL redirects | +shoes | +shoes | +http://www.example.com/shoes.html | +
Question: What happens when a web store visitor requests
+ http://www.example.com/shoes.html?
Answer: You control the response in the Admin Panel. Click System > + Configuration > CATALOG > Search Engine Optimizations. In the right pane, click an + option from the Priority for Duplicated URL Keys list. Some examples follow:
+| Priority setting | +Result | +
|---|---|
Default setting:
+
|
+ Custom URL redirect | +
+
|
+ Shoes category | +
†—Custom URL redirect refers to a product's Create Custom Redirect + for old URL option.
+The other options are:
+In the event no URL key matches your priority setting, Magento continues through the priorities in order until a + match is found.
+For more information about SEO, see:
++ After changing the + value for product or category suffix, previous suffixes do not work.
+For example, if a category URL suffix was set to .html and you change it to .php, + categories that had been using the .html suffix display an HTTP 404 (Not Found) error in your web store.
+(In the Admin Panel, click System > Configuration > CATALOG > + Catalog > Search Engine Optimizations. In the right pane, the options are named + Product URL Suffix and Category URL Suffix.)
+ +The United States Postal Service (USPS) changed the names of their Priority and Express shipping options in their + API on Sunday, July 28, 2013. Magento has a patch available; however, this patch is not included in new EE 1.13.0.2 + installations.
+For new EE 1.13.0.2 installations to continue utilizing USPS Priority and Express mail methods, you must + install the patch we've created to address the issue.
+Get the patch from the EE support portal by logging in to magentocommerce.com.
+ +testurlkey, the new product's URL key might is testurlkey-1.product1
+ and you create a new product with the name Product1 and the product has an ID of 500, the new
+ product's URL key is product1-500.http://www.example.com/mens/shoes
+ domain-name/product-url-key because product URL keys must be globally
+ unique.domain-name/product-url-key but the product can also be accessed using
+ its full URL (including the category hierarchy). Examples:producturlkey and it's assigned to the Apparel > Womens >
+ Purses category, the product can be accessed using both of the following URLs:http://www.example.com/producturlkeyhttp://www.example.com/apparel/womens/purses/producturlkeyhttp://www.example.com/producturlkey.
+ Notes:
This section discusses fixes made in EE 1.13.0.2.
+SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get
+ lock.mage_ because you specified a tables prefix during installation).SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry/catalog/category/view/s/newcategory/id/36//catalog/newcategory//parent-category/category-2//parent-category/category-2/product-1SQLSTATE[23000]: Integrity constraint violation.SQLSTATE[23000]: Integrity constraint violation.See the following sections for information about changes in this release:
+Magento has identified a potential vulnerability that might affect you if both of the following are true:
+If both of the preceding are true, Magento can be subjected to cross-site scripting + (XSS) attacks—a type of injection issue, which means that malicious code is injected into otherwise + trusted websites, generally in the form of a browser-side script.
+Issue: Magento is subject to XSS attacks because the SID cookie value is not sanitized by default.
+Suggested solution: Either disable Use SID on Frontend or output-encode any usage of the SID cookie value before using it or passing it as a + parameter to any page cache helper functions.
+Additional references:
+Magento EE 1.13—unlike earlier versions—does not allow duplicate URL keys for products or + categories. An issue has been identified that causes problems during upgrades if you already have duplicate URL + keys. The issue is being addressed; until a solution is announced, Magento recommends you test your upgrade but + do not try to deploy it to a production environment.
+ For more information about upgrading in a development environment, see Upgrading to and Verifying + Magento Community Edition (CE) 1.8 and Enterprise Edition (EE) 1.13. + +For more information, see Magento + Enterprise Edition 1.13 Benchmarking
+ +Tax calculation issues can be divided into the following sections:
+The following general fixes were made to Magento tax configuration and calculations:
+Sub item price = Sub item base price * Applicable tiered price adjustment or discount, then rounded
+ Bundle price = Sum (round(sub item price * qty))round(unit price * non-integer quantity)For details, see the Magento + User Guide.
+ + +The following issues relate to one-cent rounding errors in the web store or shopping cart:
+The following issues relate to errors in calculating taxes that include FPT in the web store or shopping cart:
+The following issues relate to price calculations when coupon codes or other discounts are applied in the web store + or shopping cart:
+The following issues relate to the incorrect display of tax information in the Admin Panel or in your Magento web + store:
+The following are fixed in the Magento SOAP v2.0 APIs (with exceptions noted):
+8888 in the following example):
+ $result = $client->call($sessionId, 'catalog_product.info', '8888', null, null, 'sku');
+
+ salesOrderAddComment.
+
+ shoppingCartProductMoveToCustomerQuote method works properly.
+
+ from-to complex filters to perform "window" filtration on a single
+ field. For example, you can use from and to on the created_at return a list
+ of sales orders using the salesOrderList.
+
+ productGetSpecialPrice method returns special price information for a product, whether or not
+ WS-I Compliance is
+ enabled.
+
+ shoppingCartPaymentList method returns the list of the available payment
+ methods for the shopping cart appropriately. The following error is no longer returned:
+ SOAP-ERROR: Encoding: object has no 'code' property in name
+
+ productAttributeAddOption and catalogProductAttributeUpdate methods are now supported when WS-I
+ Compliance is enabled.
+
+ salesOrderCreditmemoCreate is now correct; that is, it matches the code.
+
+ C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin> wsdl /out:Magento.cs /v
+ http://magentohost/api/v2_soap/?wsdl
+
+ catalogProductAttributeInfo.
+
+ product_custom_option.add operation with multicall no
+ longer results in redundant options.
+
+ Fixes in this release can be divided into the following categories:
+There has been an error processing your request. Please contact us or try again later).
+
+ 10,50 (using a comma character and not a period) for Adjustment
+ Fee now results in the correct amount of credit being applied to the transaction.
+
+ /sitemap/catalog/string.
+
+ SAMPLE printed on them only when you request a sample label.
+
+ The following fixes relate to administering and using shopping cart price rules and catalog price rules:
+QTY) of all products imports correctly.
+
+ use_cfg_max_sale_qty) is correct.
+
+ user@example.com and User@example.com).
+
+ .csv) file have been resolved.
+
+ state correctly. (Before the fix, city was sent as the value for state.)
+
+ Gateway error: Void error: V18A4B18E0F9 has been captured errors when canceling
+ partially invoiced orders when the Payflow Pro processor was used to process the payment.
+
+ This
+ customer email already exists.
+
+ GiftRegistry/Model/Item/Option.php has been resolved.
+
+ magento-install-dir/app/code/core/Enterprise/PageCache/Model/Config.php was
+ modified to enable you to set specific lifetimes for certain blocks.
+
+ This release includes the following changes to support the changes in indexing:
+catalog_product_entity_url_key and catalog_category_entity_url_key
+ database tables for the corresponding url_key attributes have been added.
+
+ + For more information about indexing changes, see the Magento User Guide.
+ + + + + + diff --git a/guides/v19.x/ce18-ee113/ht_magento-ce-sample.data.html b/guides/v19.x/ce18-ee113/ht_magento-ce-sample.data.html new file mode 100644 index 0000000000..3ffe1d7315 --- /dev/null +++ b/guides/v19.x/ce18-ee113/ht_magento-ce-sample.data.html @@ -0,0 +1,45 @@ +--- +layout: v1x +title: Installing Sample Data for Magento Community Edition (CE) +--- + +This page discusses how to get the sample data for:
+Magento CE sample data must be installed before you install Magento CE.
+ ++ The sample data is provided in different formats for your convenience. + Archives for each version have exactly the same content (they differ only by compression method). +
+Detailed instructions for installing sample data for Magento CE 1.6–1.9 can be found on the Magento Knowledge Base.
diff --git a/guides/v19.x/ce18-ee113/using_redis.html b/guides/v19.x/ce18-ee113/using_redis.html new file mode 100644 index 0000000000..66d5cbd812 --- /dev/null +++ b/guides/v19.x/ce18-ee113/using_redis.html @@ -0,0 +1,119 @@ +--- +--- + + + + + + + + + +
+{% include v1x/eol_message.html %}
+
+
+
+
+Redis is an open source, Berkeley Software Distribution (BSD) licensed, advanced key-value store that can optionally be used in Magento for backend and session storage. In fact, you can replace memcached with Redis.
+Following are some of the benefits Redis provides for Magento implementations:
+The following Magento editions support Redis session and backend caching:
+The preceding Magento editions support Redis server version 2.6.9 and later available from redis.io.
+In addition, you can optionally use the Redis extension for PHP version 2.2.3 or later if you're using Redis for backend caching; however, Magento works without this extension.
+ +To use Redis with Magento, you must configure Magento to use Redis and you must install and configure the Redis server. These tasks are discussed in the following sections:
+ + +To use Redis with Magento, you only need to install and configure the Redis server. The integration between Redis and Magento is already included with Magento CE 1.8 and EE 1.13 and later versions. All you need to do is configure it.
+Important: The Cm_RedisSession module in CE 1.8 is disabled by default. Magento disables the module to avoid unnecessary connection tries to Redis when you choose to use file, database, or a different session storage method.
+To enable Magento to use Redis, perform the following tasks:
+Get Redis server version 2.6.9 or later and configure it according to their documentation.
+You can optionally install the Redis extension for PHP version 2.2.3 or later as well, but Magento functions without it.
+ +Important: Colin Mollenhour, the original author of Redis, does not provide support for Magento implementations. You can get support for Magento implementations in the following ways:
+| Magento edition | +How to get help | +
|---|---|
| Magento CE and Magento EE | ++ | +
| Magento CE | +Submit bug reports | +
| Magento EE only | +Submit bug reports | +
For more information about using Redis with Magento, see:
+ + +Magento acknowledges the contributions of Colin Mollenhour in providing the code for the Magento implementation of Redis.
+ + + + +
- {% include m1x/eol_message.html %}
+
+ {% include v1x/eol_message.html %}
-{% include m1x/eol_message.html %}
+
+{% include v1x/eol_message.html %}
@@ -30,7 +30,7 @@
by Erik Hansen
-Edit this page on
+
@@ -140,7 +140,7 @@ The following figures shows all cache types disabled. The rwd/default theme falls back directly to the base/default theme, so themes in the default
package will never be included as a part of the fallback chain. The following figure shows how your custom theme directory structure looks after copying these files and
directories. You can configure Compass to watch your skin directories for changes to CSS and JavaScript and to compile them
@@ -427,7 +427,7 @@ The following figure shows the directory structure in a properly configured system, as well as the location of
theme.xml, the custom theme configuration file. This section discusses information you need to customize the responsive theme you started in Copying
@@ -547,7 +547,7 @@ When Compass compiles the Sass partials, the output is a set of CSS files that are loaded by the browser: styles-ie8.css
is for Internet Explorer 8 and earlier, and styles.css is for all other browsers. Following is the directory structure of the skin/frontend/custompackage/customtheme directory. The responsive theme uses two sprites: one for general icons and the other for social icons. Both sprite images output at 1x and 2x resolutions (for high-resolution screens). Because sprite files are very
difficult to edit without the source files, you should use these Photoshop files to change these sprites: RWD_icon_sprite.psd and RWD_social_icons.psd
+ href="{{ site.baseurl }}{{ site.v1xgdeurl }}images/RWD_icon_sprite.psd">RWD_icon_sprite.psd Compass provides support for generating sprites from individual image files, but it was not used to generate
sprites for the responsive theme. However, you might want to take advantage of that feature for your custom
theme. Using this method requires knowledge of Compass. by Erik Hansen Edit this page on
+
Starting in Magento EE 1.14.1 and CE 1.9.1, your Magento cron job sends all emails, including
transactional emails. You must configure cron for emails to work. For more information, see For more information, see Setting Up Cron Jobs. As you might expect, these two files compile to Refer to the Emogrifier README
to see what CSS selectors are supported. After the CSS is loaded, it's wrapped in a See the following sections for information about this release: For more information about these security enhancements, see our Security Center article. Patches for major security issues in earlier versions of the Magento software are available on the Magento download page (look for See How to Apply the SUPEE-8788 Patch See How to Apply the SUPEE-8788 Patch Patch name: SUPEE-3762. Refreshing the SOAP v2 index page ( See the following sections for information about changes in this release: The options are available in the Admin Panel at System > Configuration > ADVANCED > Admin > Security and are named Allow Magento Backend to run in frame and Allow Magento Frontend to run in frame. Enabling the option causes the We'd like to draw your attention to several new patches that were recently posted to the Partner Portal and Support Center. These patches deliver important improvements, such as enabling several concurrent administrators to work with the product catalog, and to make it easier to install community-created translation packages. Details about the patches follow. To install these patches, see How to Get Patches For Magento Commerce. Patch name: PATCH_SUPEE-3762_EE_1.14.0.1_v1.sh. Refreshing the SOAP v2 index page ( See the following sections for information about changes in this release: The options are available in the Admin Panel at System > Configuration > ADVANCED > Admin > Security and are named Allow Magento Backend to run in frame and Allow Magento Frontend to run in frame. Enabling the option causes the The iOS app for Magento MobileConnect was discontinued in 2015.Exceptions to Responsive Web Design
![]()
Note: Magento still supports other non-responsive themes as well. You don't need to use this guide to customize those themes. For more information, see the Designer's Guide to Magento.
@@ -259,10 +259,10 @@ Disabling the Magento Cache
The following figure shows an example.
- 
-
+
Step 1: Creating a Directory Structure for Your Respons
directories.
![]()
Note: Magento EE only. The enterprise/default theme is completely replaced by rwd/enterprise and therefore, enterprise/default is not included as a part of the fallback chain.
Step 1: Creating a Directory Structure for Your Respons
-
![]()
Important: It's very important you have a theme.xml in the app/design/frontend/custompackage/customtheme/etc directory with exactly the contents shown. Failure to configure theme.xml correctly prevents Magento from loading your theme.
Step 2: Copying Files For Your Theme
Structure.
+
Step 3: Configuring a Compass Watcher
Step 4: Configuring Magento to Load Your Theme
The following figure shows an example.
-
+
If an error displays when you attempt to save the configuration, see Troubleshooting
@@ -451,7 +451,7 @@ Step 5: Verifying Your Custom Theme
begin building your new theme.
![]()
Note: If your theme fails to load properly, see the next section.
Wrong formatting in the web store
Directory and File Reference
+
Responsive Theme Reference
Understanding the Sass Structure
![]()
Note: This structure does not include the sample data assets that you will remove later in this guide.
@@ -796,8 +796,8 @@
and RWD_social_icons.psd
Working With Sprites
High-Definition Images
href="https://speakerdeck.com/brendanfalkowski/responsive-ecommerce-part-two#114" target="_blank">slides
starting at 114 of Brendan Falkowski's Imagine 2013 talk for implementation suggestions. For a 2x solution,
PictureFill (or similar polyfill) could be used, although it would need to be integrated with ElevateZoom.
- ![]()
Note: Category banners and product detail pages use a 1.5x image solution.
- {% include m1x/eol_message.html %}
+
+ {% include v1x/eol_message.html %}
Responsive Email Developer's Guide for Magento EE 1.14.1 and Magento CE 1.9.1
Introduction
![]()
Note: This article focuses on responsive emails but the
same techniques can be used for newsletter templates as well. For more information about newsletter
templates, see Using Updated Newsletter Templates.Introduction
Using cron to Send Emails
Supported Email Clients and Devices
@@ -262,7 +262,7 @@ Customizing Header and Footer Templates Using Fi
[your Magento install dir]/app/locale/en_US/template/email/html/header.html[your Magento install dir]/app/locale/en_US/template/email/html/footer.html![]()
Note: To make changes to the templates at the website or
store view configuration scopes, see the next section.Customizing the Template in the Admin Pan
The following figure shows an example:
-
Using the Template in a Website or Store
all websites and store views. You can optionally associate it with a specific website or store view by
selecting it from the list.
The following example shows how to associate a template with the Madison Island English store view.
-
+
The following figure shows an example:
- 
Customizing CSS Styles for Emails
skin/frontend/rwd/default/css/email-inline.css
and skin/frontend/rwd/default/css/email-non-inline.css, respectively. If you're not familiar
- with how to work with Sass files, refer to the RWD theme documentation.Using Inline Styles to Customize Email CSS
@@ -385,7 +385,7 @@ Using Inline Styles to Customize Email CSS
skin/frontend/custompackage/customtheme/css/email-inline.css)
![]()
Note: The {{inlinecss file=""}}
directive can be used a single time and cannot be used in templates that get included by other templates
(for example, app/locale/en_US/template/email/html/header.html and
@@ -419,7 +419,7 @@ Using Non-Inline Styles to Customize Email CSS
<style
type="text/css"></style> tag and is assigned to the
non_inline_styles variable.![]()
Note: When you are writing "non-inline" CSS, you must
add the !important declaration after each property so the style has a high enough
specificity to get applied. This is the best way to get your custom styles to override styles
@@ -479,7 +479,7 @@ Updating a High-Resolution Logo Using the File System<
border="0"/>
-
![]()
Note: To use a file type other than GIF or if you
need to upload unique logos for different websites, stores, or store views, see the next section.
Updating a High-Resolution Logo Using the Admin Panel
all websites and store views. You can optionally associate it with a specific website or store view
by selecting it from the list.
The following example shows how to associate a logo with the Madison Island English store view.
-
+
@@ -538,7 +538,7 @@
Updating a High-Resolution Logo Using the Admin Panel
The following figure shows an example.
-
+
Getting Help
-{% include m1x/eol_message.html %}
+
+{% include v1x/eol_message.html %}
@@ -63,7 +63,7 @@ Magento Open Source Release Notes (1.9 and later)
Important Upgrade Information
-
Important: Use Magento Open Source 1.9.3.0 or later for all new Magento Open Source installations and upgrades to get the latest fixes, features, and security updates.
Important: Use Magento Open Source 1.9.3.0 or later for all new Magento Open Source installations and upgrades to get the latest fixes, features, and security updates.Magento Open Source 1.9.4.5 Release Notes
@@ -423,7 +423,7 @@ Magento Open Source 1.9.3.1 Release Notes
-
Note: You currently cannot upgrade to this version using Magento Connect Manager. We expect to resolve this issue soon.
Note: You currently cannot upgrade to this version using Magento Connect Manager. We expect to resolve this issue soon.Magento Open Source 1.9.3.0 Release Notes
Security Enhancements
General security enhancements
SUPEE-8788.)
-Recent Patches
Note: Some of the patches discussed in this section have EE_1.14.0.1 in the name. These patches were all tested against Open Source 1.9.x as well.
Note: Some of the patches discussed in this section have EE_1.14.0.1 in the name. These patches were all tested against Open Source 1.9.x as well.General Magento Connect Patches
@@ -680,7 +680,7 @@ General Magento Connect Patches
/app/code/community directory structure, the Magento administrator sees an error message in the Magento Connect Manager.
-To set file system permissions appropriately, see After You Install Magento: Recommended File System Ownership and Privileges.Magento Install Page Displays After SOAP v2 Index Page Refresh
http://your-magento-host-name/index.php/api/v2_soap/index/) results in all administrators and customers viewing the Magento installation page.How to Get Patches For Magento Open Source
Magento Open Source 1.9.0.0 Release Notes
Changes
frame or iframe:
@@ -754,7 +754,7 @@
Important: For security reasons, Magento strongly recommends against running the Magento software in a frame.
Important: For security reasons, Magento strongly recommends against running the Magento software in a frame.X-Frame-Options request header to be sent.Changes
Important: This is not a security threat. No data has been compromised or misused. It affects only the ability to validate certain credit card number ranges as valid Discover card numbers.
Important: This is not a security threat. No data has been compromised or misused. It affects only the ability to validate certain credit card number ranges as valid Discover card numbers.
diff --git a/guides/m1x/ce19-ee114/ee1.14_release-notes.html b/guides/v19.x/ce19-ee114/ee1.14_release-notes.html
similarity index 98%
rename from guides/m1x/ce19-ee114/ee1.14_release-notes.html
rename to guides/v19.x/ce19-ee114/ee1.14_release-notes.html
index 479cf8a40e..f503dba90d 100644
--- a/guides/m1x/ce19-ee114/ee1.14_release-notes.html
+++ b/guides/v19.x/ce19-ee114/ee1.14_release-notes.html
@@ -16,8 +16,8 @@
-
-{% include m1x/eol_message.html %}
+
+{% include v1x/eol_message.html %}
Magento Commerce Release Notes (1.14 and later)
@@ -58,7 +58,7 @@ Magento Commerce Release Notes (1.14 and later)
Important Upgrade Information
-
Important: Use Magento Commerce 1.14.3.0 or later for all new Magento Commerce installations and upgrades to get the latest fixes, features, and security updates.
Important: Use Magento Commerce 1.14.3.0 or later for all new Magento Commerce installations and upgrades to get the latest fixes, features, and security updates.Magento Commerce 1.14.4.5 Release Notes
@@ -435,7 +435,7 @@ Magento Commerce 1.14.3.1 Release Notes
-
Note: You currently cannot upgrade to this version using Magento Connect Manager. We expect to resolve this issue soon.
Note: You currently cannot upgrade to this version using Magento Connect Manager. We expect to resolve this issue soon.Magento Commerce 1.14.3.0 Release Notes
@@ -697,7 +697,7 @@ Magento Commerce 1.14.0.1 Release Notes
Recent Patches
-
Note: The patches discussed in this section are built in to Commerce 1.14.1; you need to get them only if you're running an earlier Commerce version.
Note: The patches discussed in this section are built in to Commerce 1.14.1; you need to get them only if you're running an earlier Commerce version.General Magento Connect Patches
/app/code/community directory structure, the Magento administrator sees an error message in the Magento Connect Manager.
-To set file system permissions appropriately, see After You Install Magento: Recommended File System Ownership and Privileges.Magento Install Page Displays After SOAP v2 Index Page Refresh
http://your-magento-host-name/index.php/api/v2_soap/index/) results in all administrators and customers viewing the Magento installation page.How to Get Patches For Magento Commerce
Magento Commerce 1.14.0.0 Release Notes
Highlights
For more information about using Solr with Magento Commerce, see the Magento User Guide.
-Note: If you're using the Solr search engine with Commerce versions 1.13.1 or earlier, you must perform an additional step during upgrade due to the fact that the Solr schema changes in Commerce 1.14. You must copy two files to your Solr server—schema.xml and solrconfig.xml. For details, see the section on upgrading Solr in the Magento upgrade guide.schema.xml and solrconfig.xml. For details, see the section on upgrading Solr in the Magento upgrade guide.
To enable cross-border trade in the Admin Panel, click System > Configuration > SALES > Tax > Calculation Settings, option Enable Cross Border Trade.Changes
frame or iframe:
@@ -804,7 +804,7 @@
Note: For security reasons, Magento strongly recommends against running the Magento software in a frame.
Note: For security reasons, Magento strongly recommends against running the Magento software in a frame.X-Frame-Options request header to be sent.Changes
Note: This is not a security threat. No data has been compromised or misused. It affects only the ability to validate certain credit card number ranges as valid Discover card numbers.
Note: This is not a security threat. No data has been compromised or misused. It affects only the ability to validate certain credit card number ranges as valid Discover card numbers.
+{% include v1x/eol_message.html %}
+
+
+
+
+Creating an iOS App for Magento MobileConnect
+How do I perform a Checkout in OpenMage LTS
\ No newline at end of file
diff --git a/guides/v19.x/images/2167-Benchmark-Config-Doc-R1.png b/guides/v19.x/images/2167-Benchmark-Config-Doc-R1.png
new file mode 100644
index 0000000000..30ea1243d5
Binary files /dev/null and b/guides/v19.x/images/2167-Benchmark-Config-Doc-R1.png differ
diff --git a/guides/v19.x/images/2178-1.13_Benchmark_Report_Shopper_Flows_r1v1.png b/guides/v19.x/images/2178-1.13_Benchmark_Report_Shopper_Flows_r1v1.png
new file mode 100644
index 0000000000..0c3453a489
Binary files /dev/null and b/guides/v19.x/images/2178-1.13_Benchmark_Report_Shopper_Flows_r1v1.png differ
diff --git a/guides/v19.x/images/2179-1.13_Benchmark_Report_Catalog_r3v1.png b/guides/v19.x/images/2179-1.13_Benchmark_Report_Catalog_r3v1.png
new file mode 100644
index 0000000000..af5c05101e
Binary files /dev/null and b/guides/v19.x/images/2179-1.13_Benchmark_Report_Catalog_r3v1.png differ
diff --git a/guides/v19.x/images/2180-1.13_Benchmark_Report_Partial_Reindexingr2v1.png b/guides/v19.x/images/2180-1.13_Benchmark_Report_Partial_Reindexingr2v1.png
new file mode 100644
index 0000000000..1212b08974
Binary files /dev/null and b/guides/v19.x/images/2180-1.13_Benchmark_Report_Partial_Reindexingr2v1.png differ
diff --git a/guides/v19.x/images/2182-1.13_Benchmark_Report_Full_Reindexing_r1v1.png b/guides/v19.x/images/2182-1.13_Benchmark_Report_Full_Reindexing_r1v1.png
new file mode 100644
index 0000000000..e30b600329
Binary files /dev/null and b/guides/v19.x/images/2182-1.13_Benchmark_Report_Full_Reindexing_r1v1.png differ
diff --git a/guides/v19.x/images/2183-1.13_Benchmark_Report_Individual_Reindexing_r1v1.png b/guides/v19.x/images/2183-1.13_Benchmark_Report_Individual_Reindexing_r1v1.png
new file mode 100644
index 0000000000..b6f2155442
Binary files /dev/null and b/guides/v19.x/images/2183-1.13_Benchmark_Report_Individual_Reindexing_r1v1.png differ
diff --git a/guides/v19.x/images/2184-1.13_Benchmark_Report_Checkout_Flow_r1v1.png b/guides/v19.x/images/2184-1.13_Benchmark_Report_Checkout_Flow_r1v1.png
new file mode 100644
index 0000000000..fe19269cc1
Binary files /dev/null and b/guides/v19.x/images/2184-1.13_Benchmark_Report_Checkout_Flow_r1v1.png differ
diff --git a/guides/v19.x/images/2185-1.13_Benchmark_Report_Registered_Checkout_r1v1.png b/guides/v19.x/images/2185-1.13_Benchmark_Report_Registered_Checkout_r1v1.png
new file mode 100644
index 0000000000..2c38315671
Binary files /dev/null and b/guides/v19.x/images/2185-1.13_Benchmark_Report_Registered_Checkout_r1v1.png differ
diff --git a/guides/v19.x/images/2186-1.13_Benchmark_Report_Page_Views_r2v1.png b/guides/v19.x/images/2186-1.13_Benchmark_Report_Page_Views_r2v1.png
new file mode 100644
index 0000000000..952e934f4b
Binary files /dev/null and b/guides/v19.x/images/2186-1.13_Benchmark_Report_Page_Views_r2v1.png differ
diff --git a/guides/v19.x/images/2187-1.13_Benchmark_Report_Software_Component_r1v1.png b/guides/v19.x/images/2187-1.13_Benchmark_Report_Software_Component_r1v1.png
new file mode 100644
index 0000000000..847d915fe8
Binary files /dev/null and b/guides/v19.x/images/2187-1.13_Benchmark_Report_Software_Component_r1v1.png differ
diff --git a/guides/v19.x/images/30737051.png b/guides/v19.x/images/30737051.png
new file mode 100644
index 0000000000..3f4dd406c2
Binary files /dev/null and b/guides/v19.x/images/30737051.png differ
diff --git a/guides/v19.x/images/30737052.png b/guides/v19.x/images/30737052.png
new file mode 100644
index 0000000000..10497458cf
Binary files /dev/null and b/guides/v19.x/images/30737052.png differ
diff --git a/guides/v19.x/images/35619336.png b/guides/v19.x/images/35619336.png
new file mode 100644
index 0000000000..17cf086ba9
Binary files /dev/null and b/guides/v19.x/images/35619336.png differ
diff --git a/guides/v19.x/images/EE-spt-portal.png b/guides/v19.x/images/EE-spt-portal.png
new file mode 100644
index 0000000000..ed0de3ace4
Binary files /dev/null and b/guides/v19.x/images/EE-spt-portal.png differ
diff --git a/guides/v19.x/images/Magento_MVC.pdf b/guides/v19.x/images/Magento_MVC.pdf
new file mode 100644
index 0000000000..f6e402deb6
Binary files /dev/null and b/guides/v19.x/images/Magento_MVC.pdf differ
diff --git a/guides/v19.x/images/NumberOfVisitors.png b/guides/v19.x/images/NumberOfVisitors.png
new file mode 100644
index 0000000000..9ab29cdf88
Binary files /dev/null and b/guides/v19.x/images/NumberOfVisitors.png differ
diff --git a/guides/v19.x/images/RWD_icon_sprite.psd b/guides/v19.x/images/RWD_icon_sprite.psd
new file mode 100644
index 0000000000..61e6bd577c
Binary files /dev/null and b/guides/v19.x/images/RWD_icon_sprite.psd differ
diff --git a/guides/v19.x/images/RWD_social_icons.psd b/guides/v19.x/images/RWD_social_icons.psd
new file mode 100644
index 0000000000..96f0bc9cb5
Binary files /dev/null and b/guides/v19.x/images/RWD_social_icons.psd differ
diff --git a/guides/v19.x/images/admin-panel-custom-theme.png b/guides/v19.x/images/admin-panel-custom-theme.png
new file mode 100644
index 0000000000..6c3ecbf21c
Binary files /dev/null and b/guides/v19.x/images/admin-panel-custom-theme.png differ
diff --git a/guides/v19.x/images/appsec-900_confirm.png b/guides/v19.x/images/appsec-900_confirm.png
new file mode 100644
index 0000000000..380f55085a
Binary files /dev/null and b/guides/v19.x/images/appsec-900_confirm.png differ
diff --git a/guides/v19.x/images/blend-toc.png b/guides/v19.x/images/blend-toc.png
new file mode 100644
index 0000000000..ecab898c10
Binary files /dev/null and b/guides/v19.x/images/blend-toc.png differ
diff --git a/guides/v19.x/images/custom-theme-dir-structure.png b/guides/v19.x/images/custom-theme-dir-structure.png
new file mode 100644
index 0000000000..70c0f96e5a
Binary files /dev/null and b/guides/v19.x/images/custom-theme-dir-structure.png differ
diff --git a/guides/v19.x/images/custom-theme-dir-structure_image.ai b/guides/v19.x/images/custom-theme-dir-structure_image.ai
new file mode 100644
index 0000000000..3c308aa0ec
--- /dev/null
+++ b/guides/v19.x/images/custom-theme-dir-structure_image.ai
@@ -0,0 +1,4975 @@
+%PDF-1.5
%âăÏÓ
+1 0 obj
<>/OCGs[5 0 R 37 0 R 70 0 R]>>/Pages 3 0 R/Type/Catalog>>
endobj
2 0 obj
<>stream
+
+