$proxy = new SoapClient('http://127.0.0.1/Magento1620/index.php/api/v2_soap?wsdl', array('trace' => 1, 'connection_timeout' => 120));
$session = $proxy->login(array(
'username' => "xxyyzz",
'apiKey' => "xxyyzz"
));
$sessionId = $session->result;
$filters = array(
'complex_filter' => array(
array(
'key' => 'product_id',
'value' => array(
'key' => 'eq',
'value' => '18'
)
)
)
);
$products = $proxy->catalogProductList(array("sessionId" => $sessionId, "filters" => $filters));
Category Archives: eCommerce
magento web service filter product list error Call to a member function getBackend() on a non-object
Using visual studio 2010 service reference to consume magento soap v2 api web service.
php 5.3.8, magento 1.6 install on windows 7 iis 7.5
I can log in and list all the product, but as soon as i put a filter there is an exception
Call to a member function getBackend() on a non-object
php error log:
PHP Fatal error: Call to a member function getBackend() on a non-object in C:\inetpub\wwwroot\Magento1620\app\code\core\Mage\Eav\Model\Entity\Abstract.php on line 816
the solution is to modify this file, change line 57-62
\app\code\core\Mage\Catalog\Model\Product\Api\V2.php
from
foreach ($filters->complex_filter as $_filter) {
$_value = $_filter->value;
$preparedFilters[$_filter->key] = array(
$_value->key => $_value->value
);
}
to
foreach ($filters->complex_filter as $_field => $_filter) {
$preparedFilters[$_field] = array(
$_filter->key => $_filter->value
);
}
error consume magento soap v2 api by using visual studio web reference unexpected end of file has occurred
find file
\app\code\core\Mage\Api\Model\Server\Wsi\Adapter\Soap.php
search for “\n” and replace with empty string (just delete it)
Magento remove index.php from URL in IIS
go to Magento admin panel –> system –>configuration –>web –>Search Engines Optimization –> Use Web Server Rewrites –> Yes
create web.config file under magento root folder
add the following content to the file (tracing is optional)
<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”Magento SEO: remove index.php from URL”>
<match url=”^(?!index.php)([^?#]*)(\?([^#]*))?(#(.*))?” />
<action type=”Rewrite” url=”index.php/{R:0}” />
</rule>
</rules>
</rewrite>
<tracing>
<traceFailedRequests>
<add path=”*”>
<traceAreas>
<add provider=”WWW Server” areas=”Rewrite” verbosity=”Verbose” />
</traceAreas>
<failureDefinitions statusCodes=”404″ />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>
Magento web service response content type error
The content type text/xml; charset=utf-8,text/xml; charset=UTF-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 297 bytes of the response were: ”.
\app\code\core\Mage\Api\Model\Server\Wsi\Adapter\Soap.php
Change
line 52:
->setHeader(‘Content-Type’,'text/xml; charset=’.$apiConfigCharset)
line 78
->setHeader(‘Content-Type’,'text/xml; charset=’.$apiConfigCharset)
To
->setHeader(‘Content-Type’,'text/xml; charset=’.$apiConfigCharset, true)
set up Magento 1.6 in IIS with em0019 maxibags handbag theme
1. Download Magento 1.6.1.0, upload and unzip to web server.
2. Create a website in IIS and point to magento root folder.
3. Give permission to magento root folder to IIS application pool identify.
4. Change anonymous user identity to “application pool identify”.
5. Create one database in MySql.
6. Visit the new Magento website and install the application by following the installation wizard.
7. Upload and unzip em0019 magento 1.6 theme package to web server.
8. Copy “app” and “skin” folder to magento root folder. (This will merge with the existing files rather than override the existing.)
9. Create temp directory for Magento.
modify {magento}\lib\Zend\Cache\Backend\File.php
change ’cache_dir’ => ‘null’, to ‘cache_dir’ => ‘tmp/’
create tmp folder in Magento root folder
10. Login to Admin Panel, go “System” –> “Configuration” –> “Design” –> “Package”, set “current package name” to “em0019″.
11. Add catelog menu
go “CMS” –> “Static Blocks” –> “Add New Block”
Block Title: “EM Catalog Menu Widget“
Identifier: “em0019_catalog_menu_widget“
Status: “Enabled“
Content:
<ul id=”nav”>
<li> <a href=”{{config path=”web/unsecure/base_url”}}”> Homepages</a> </li>
{{widget type=”catalogmenuwidget/catalogmenu” level_class=”0″ ul_id=”nav” template=”em_catalogmenuwidget/menu.phtml” none_ul_root=”1″ none_li_first_class=”1″ none_li_last_class=”0″}}
</ul>
12. Change Store Logo, go ”System” –> “Configuration” –> “Design” –> “Header”, set “Logo Image Src” to “images/logo.jpg“.
13. Add top flash slideshow on home page
go “CMS” –> “Pages”
if there is any page with url key set to home, update it to something else (home1)
Add New Page with the following value
Page Title: “Home page“
URL Key: “home“
Status: “Enabled“
Layout: “3 Columns“
Layout Update XML:
<reference name=”header”>
<block type=”page/html” name=”flash_em0019″ template=”page/html/flash.phtml” />
</reference>
14. Add “New Arrivals” banner
go “CMS” –> “Static Blocks” –> “Add New Block”
Block Title: “EM New Arrivals“
Identifier: “new-arrivals“
Status: “Enabled“
Content:
<div>{{widget type=”flexiblewidget/list” column_count=”1″ limit_count=”1″ order_by=”created_time asc” template=”flexiblewidget/newarrivals.phtml”}}</div>
or use the following to make it exactly the same as the theme demo website, change “{magento root}/skin/frontend/em0019/default/images/arrivals-img.png” file to reflect your new arrivals image
<div>
<div>
<a href=”#”>
<img src=”{{skin url=’images/arrivals-title.png}}” alt=”" />
</a>
</div>
<div>
<p>
<strong>Prada Clutch Purple </strong>has just appeared in Pradasion….</p>
<p>
From totes to chic crossbody bags, find your perfect bag now check out our new <br />
<a href=”#”>hanndbag finder</a></p>
</div>
<div>
<a href=”#”>
<img src=”{{skin url=’images/arrivals-img.png}}” alt=”" /></a></div>
</div>
go “CMS” –> “Pages”
update page with URL Key set to home
Layout Update XML:
<reference name=”header”>
<block type=”page/html” name=”flash_em0019″ template=”page/html/flash.phtml” />
<block type=”cms/block” name=”new-arrivals” >
<action method=”setBlockId”><block_id>new-arrivals</block_id></action>
</block>
</reference>
15. Add “Popular Tags”
16. Add “Select Your Currency”
17. Add “New Product” on home page
18. Add “Recent Added Product” on home page
19. Add “Special Product” on home page
20. Add bottom flash slideshow on home page
go “CMS” –> “Static Blocks” –> “Add New Block”
Block Title: “EM Bottom Slideshow“
Identifier: “bottom_slideshow“
Status: “Enabled“
Content:
<ul>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-1.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-2.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-3.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-4.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-5.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-6.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-7.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-8.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-9.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-10.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-11.jpg”}}” alt=”" /></a></li>
<li><a href=”#”><img src=”{{media url=”slideshow-bottom/slide-12.jpg”}}” alt=”" /></a></li>
</ul>
copy “{magento root}\media\slideshow-bottom” folder from the full package.
21. Change footer
go “CMS” –> “Static Blocks” –> Update block with identifier set to “footer_links“
Content:
<ul>
<li><a href=”{{store direct_url=”about-magento-demo-store”}}”>About Us</a></li>
<li><a href=”{{store direct_url=”customer-service”}}”>Customer Service</a></li>
<li><a href=”{{store direct_url=”catalog/seo_sitemap/category/”}}”>Site Map</a></li>
<li><a href=”{{store direct_url=”catalogsearch/term/popular/”}}”>Search Term</a></li>
<li><a href=”{{store direct_url=”catalogsearch/advanced/”}}”>Advanced Search</a></li>
<li><a href=”{{store direct_url=”contacts”}}”>Contact Us</a></li>
</ul>
22. Change Copyright
go ”System” –> “Configuration” –> “Design” –> “Footer” –> “Copyright”
Flush Magento Cache
23. Remove “Help Us to Keep Magento Healthy – Report All Bugs (ver. 1.6.1.0)”
Open “{Magento root}\app\design\frontend\em0019\default\template\page\html\footer.phtml“
Comment out this line “<?php /* <p><?php echo $this->__(‘Help Us to Keep Magento Healthy’) ?> – <a href=”http://www.magentocommerce.com/bug-tracking” onclick=”this.target=’_blank’”><strong><?php echo $this->__(‘Report All Bugs’) ?></strong></a> <?php echo $this->__(‘(ver. %s)’, Mage::getVersion()) ?></p> */ ?>“
Flush Magento Cache
Set up Magento multiple website in IIS
1. Install Magento in IIS
2. Create another website in IIS, set physical path to the previously installed Magento root folder
3. Give iis application pool identity for the new site permission to the physical path folder
4. Change anonymous user identity to “application pool identify”.
5. Create Root Catelog for the new website
go “Catelog” –> “Manage Categories” –> “Add Root Category“
6. Create Website, Store and Store view for the new domain
go “System” –> “Manage Stores”, use the previously created root category for the new store
7. Configure website URL
go “System” –> “Configuration” –> change “Current Configuration Scope” to the new create website
select “Web” –> “Unsecure” –> untick “Use Default” besides “Base URL” –> update “Base Url” field
select “Web” –> “Secure” –> untick “Use Default” besides “Base URL” –> update “Base Url” field
8. Edit index.php file in Magento root folder (It is meant to be done via the .htaccess file, but IIS does not read/use .htaccess file.)
Comment out this line of code (last line) “/* Mage::run($mageRunCode, $mageRunType); */“
Add the following lines of code right below the commented out line
switch($_SERVER['HTTP_HOST']) {
case ‘www.domain1.com’ :
Mage::run(‘mainsite’, ‘website’);
break;
case ‘www.domain2.com’ :
Mage::run(‘anothersite’, ‘website’);
break;
default:
Mage::run();
}
9. Set up home page, catelog menu, footer for the new website
NopCommerce 2.0 change logo and “Store name here” copyright
On NopCommerce 2.0 front end public store, there is a default NopCommerce logo on upper left side and “Copyright © 2011 Store name here. All rights reserved.” on bottom right side footer.
1. Change default NopCommerce logo
The razor code is located in Nop.Web/Views/Shared/Header.cshtml and it looks like <a href=”@storeLocation”> </a>.
The css code is located in Nop.Web/Themes/DarkOrange/Content/styles.css and Nop.Web/Themes/nopClassic/Content/styles.css, the css code looks like
a.logo
{
background: url(‘images/logo.gif’);
display: block;
width: 225px;
height: 60px;
text-decoration: none;
}
The background image is located in Nop.Web/Themes/DarkOrange/Content/images/logo.gifand Nop.Web/Themes/nopClassic/Content/images/logo.gif
2. Change copyright
The razor code is located in Nop.Web/Views/Shared/Footer.cshtml and it looks like
<div>
@T(“Content.CopyrightNotice”, DateTime.Now.Year.ToString(), “Store name here”)
</div>.
Magento 1.6 cannot upload product image
I find the solution from the following blog post.
http://www.magentocommerce.com/boards/viewthread/244078/#t344354
I will list the steps here as well.
1. Download prototype 1.6.1 from the following link
http://prototypejs.org/assets/2009/8/31/prototype.js
2. Put the above downloaded file in the following location
{magento}\js\prototype\prototype1.6.js
3. Modify the following file
{magento}\app\design\adminhtml\default\default\layout\main.xml
add the following line
<action method=”addJs”><script>prototype/prototype16.js</script></action>
directly under the follwoing line (line no.: 58)
<action method=”addJs”><script>prototype/prototype.js</script></action>
4. flush magento cache
Magento 1.6 could not determine temp directory, please specify a cache_dir manually
For 1.6.0.0/1.6.0.1
modify {magento}\lib\Zend\Cache\Backend\File.php
change
‘cache_dir’ => ‘null’,
to
‘cache_dir’ => ‘tmp/’,