<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Zencart + Ajax made easy (part 3)</title>
	<atom:link href="http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/</link>
	<description>eCommerce Solutions for All!</description>
	<lastBuildDate>Sat, 04 Feb 2012 10:30:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
	<item>
		<title>By: admin</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1586</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Thu, 10 Jun 2010 16:29:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1586</guid>
		<description>This is how it will tell the difference:

&lt;code&gt;
function start(){	
		// set status
		if(((isset($_SERVER[&#039;HTTP_X_REQUESTED_WITH&#039;])) &amp;&amp; $_SERVER[&#039;HTTP_X_REQUESTED_WITH&#039;] == &#039;XMLHttpRequest&#039;) &#124;&#124; (isset($_REQUEST[&#039;isajaxrequest&#039;]) &amp;&amp; $_REQUEST[&#039;isajaxrequest&#039;] == 1)){
			$this-&gt;status = true;
			
			// start buffering
			ob_start();
		}
		$this-&gt;restoreMessage();
	}
&lt;/code&gt;
(Taken from our latest Ajax Class)</description>
		<content:encoded><![CDATA[<p>This is how it will tell the difference:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">function start(){ &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; // set status<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(((isset($_SERVER['HTTP_X_REQUESTED_WITH'])) &amp;&amp; $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') || (isset($_REQUEST['isajaxrequest']) &amp;&amp; $_REQUEST['isajaxrequest'] == 1)){<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;status = true;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // start buffering<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ob_start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; $this-&gt;restoreMessage();<br />
&nbsp; &nbsp; }</div></div>
<p>(Taken from our latest Ajax Class)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1522</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 07 Jun 2010 12:02:49 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1522</guid>
		<description>I&#039;ve been doing some more work to analyze how this works and I think the following is happening. Can you please confirm or deny?

- index.php defines two Ajax blocks (defined with $Ajax-&gt;startBlock) in index.php - &#039;head&#039;,&#039;body&#039;. These correspond to the .. and .. sections.
- These must be defined in the variable passed to $Ajax-&gt;set_structure in the relevant init_includes file
- You can break the &#039;body&#039; down further by defining an array of div tags that relate to these but you must ALSO call $Ajax-&gt;startBlock and $Ajax-&gt;endBlock around each of these tags so that the Ajax knows about them in the relevant template file.
- Finally, you can call $Ajax-&gt;setReturnBlocks to define what will be returned from an Ajax call to get the page.

My question is if all zen_redirect calls are Ajax, how can the cart differentiate between an ajax call (submitting the contact us form) and a non ajax call (first time entering the page)?</description>
		<content:encoded><![CDATA[<p>I&#8217;ve been doing some more work to analyze how this works and I think the following is happening. Can you please confirm or deny?</p>
<p>- index.php defines two Ajax blocks (defined with $Ajax-&gt;startBlock) in index.php &#8211; &#8216;head&#8217;,'body&#8217;. These correspond to the .. and .. sections.<br />
- These must be defined in the variable passed to $Ajax-&gt;set_structure in the relevant init_includes file<br />
- You can break the &#8216;body&#8217; down further by defining an array of div tags that relate to these but you must ALSO call $Ajax-&gt;startBlock and $Ajax-&gt;endBlock around each of these tags so that the Ajax knows about them in the relevant template file.<br />
- Finally, you can call $Ajax-&gt;setReturnBlocks to define what will be returned from an Ajax call to get the page.</p>
<p>My question is if all zen_redirect calls are Ajax, how can the cart differentiate between an ajax call (submitting the contact us form) and a non ajax call (first time entering the page)?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1520</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 07 Jun 2010 11:13:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1520</guid>
		<description>Thank you - will try that out shortly and report back for the benefit of everyone. So what you are saying is that by modifying zen cart core and given you have defined $Ajax in index.php, zen cart always tries to do a redirect via Ajax first and then falls back if it fails?

In the context of the contact us, won&#039;t this mean the form action for contact_us needs to be called via Ajax too?

Forgive me if my logic is off, just trying to understand how this works. Lots of php experience, but Ajax is new to me.</description>
		<content:encoded><![CDATA[<p>Thank you &#8211; will try that out shortly and report back for the benefit of everyone. So what you are saying is that by modifying zen cart core and given you have defined $Ajax in index.php, zen cart always tries to do a redirect via Ajax first and then falls back if it fails?</p>
<p>In the context of the contact us, won&#8217;t this mean the form action for contact_us needs to be called via Ajax too?</p>
<p>Forgive me if my logic is off, just trying to understand how this works. Lots of php experience, but Ajax is new to me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1518</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Mon, 07 Jun 2010 08:47:05 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1518</guid>
		<description>My question is that does every div tag used in the template have to be defined in the array in header.php? Is the general idea that every zen_redirect in the module is changed out with Ajax-&gt;redirects?
--&gt; good question. That is what we did initially, but later we decided that it would be wiser to edit the core code of zencart for this, since you can then avoid changing redirecting code in many places. Below is the code for the latest zencart version, the file to edit is includes/functions/functions_general.php
&lt;code&gt;
function _zen_redirect($url, $httpResponseCode = &#039;&#039;) {
    global $request_type;
       
    // Are we loading an SSL page?
    if ( (ENABLE_SSL == true) &amp;&amp; ($request_type == &#039;SSL&#039;) ) {
      // yes, but a NONSSL url was supplied
      if (substr($url, 0, strlen(HTTP_SERVER . DIR_WS_CATALOG)) == HTTP_SERVER . DIR_WS_CATALOG) {
        // So, change it to SSL, based on site&#039;s configuration for SSL
        $url = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . substr($url, strlen(HTTP_SERVER . DIR_WS_CATALOG));
      }
    }

  // clean up URL before executing it
    while (strstr($url, &#039;&amp;&amp;&#039;)) $url = str_replace(&#039;&amp;&amp;&#039;, &#039;&amp;&#039;, $url);
    while (strstr($url, &#039;&amp;&amp;&#039;)) $url = str_replace(&#039;&amp;&amp;&#039;, &#039;&amp;&#039;, $url);
    // header locates should not have the &amp; in the address it breaks things
    while (strstr($url, &#039;&amp;&#039;)) $url = str_replace(&#039;&amp;&#039;, &#039;&amp;&#039;, $url);

    if ($httpResponseCode == &#039;&#039;) {
      header(&#039;Location: &#039; . $url);
      session_write_close();
    } else {
      header(&#039;Location: &#039; . $url, TRUE, (int)$httpResponseCode);
      session_write_close();
    }

    zen_exit();
  }
 
  function zen_redirect($url, $httpResponseCode=&#039;&#039;){
    global $Ajax;
    if(is_object($Ajax))
   	$Ajax-&gt;redirect($url, $httpResponseCode);
   	else 
   	_zen_redirect($url, $httpResponseCode);
  }&lt;/code&gt;

Let me know if it helps.</description>
		<content:encoded><![CDATA[<p>My question is that does every div tag used in the template have to be defined in the array in header.php? Is the general idea that every zen_redirect in the module is changed out with Ajax->redirects?<br />
&#8211;> good question. That is what we did initially, but later we decided that it would be wiser to edit the core code of zencart for this, since you can then avoid changing redirecting code in many places. Below is the code for the latest zencart version, the file to edit is includes/functions/functions_general.php</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">function _zen_redirect($url, $httpResponseCode = '') {<br />
&nbsp; &nbsp; global $request_type;<br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; // Are we loading an SSL page?<br />
&nbsp; &nbsp; if ( (ENABLE_SSL == true) &amp;&amp; ($request_type == 'SSL') ) {<br />
&nbsp; &nbsp; &nbsp; // yes, but a NONSSL url was supplied<br />
&nbsp; &nbsp; &nbsp; if (substr($url, 0, strlen(HTTP_SERVER . DIR_WS_CATALOG)) == HTTP_SERVER . DIR_WS_CATALOG) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; // So, change it to SSL, based on site's configuration for SSL<br />
&nbsp; &nbsp; &nbsp; &nbsp; $url = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . substr($url, strlen(HTTP_SERVER . DIR_WS_CATALOG));<br />
&nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; // clean up URL before executing it<br />
&nbsp; &nbsp; while (strstr($url, '&amp;&amp;')) $url = str_replace('&amp;&amp;', '&amp;', $url);<br />
&nbsp; &nbsp; while (strstr($url, '&amp;amp;&amp;amp;')) $url = str_replace('&amp;amp;&amp;amp;', '&amp;amp;', $url);<br />
&nbsp; &nbsp; // header locates should not have the &amp;amp; in the address it breaks things<br />
&nbsp; &nbsp; while (strstr($url, '&amp;amp;')) $url = str_replace('&amp;amp;', '&amp;', $url);<br />
<br />
&nbsp; &nbsp; if ($httpResponseCode == '') {<br />
&nbsp; &nbsp; &nbsp; header('Location: ' . $url);<br />
&nbsp; &nbsp; &nbsp; session_write_close();<br />
&nbsp; &nbsp; } else {<br />
&nbsp; &nbsp; &nbsp; header('Location: ' . $url, TRUE, (int)$httpResponseCode);<br />
&nbsp; &nbsp; &nbsp; session_write_close();<br />
&nbsp; &nbsp; }<br />
<br />
&nbsp; &nbsp; zen_exit();<br />
&nbsp; }<br />
&nbsp;<br />
&nbsp; function zen_redirect($url, $httpResponseCode=''){<br />
&nbsp; &nbsp; global $Ajax;<br />
&nbsp; &nbsp; if(is_object($Ajax))<br />
&nbsp; &nbsp; $Ajax-&gt;redirect($url, $httpResponseCode);<br />
&nbsp; &nbsp; else <br />
&nbsp; &nbsp; _zen_redirect($url, $httpResponseCode);<br />
&nbsp; }</div></div>
<p>Let me know if it helps.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steve</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1516</link>
		<dc:creator>Steve</dc:creator>
		<pubDate>Mon, 07 Jun 2010 07:12:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1516</guid>
		<description>Enough of the whinging, people! They&#039;re doing us a service by even providing help.

I am trying to implement an ajax contact us based on the code. Downloaded the files and installed them but have a question about usage.

As far as I can see, the way it works is to define the ids of the blocks of the template that will be returned by ajax in the /includes/modules/pages/contact_us.php file and then replace the zen-redirect with the $Ajax-&gt;redirect.

Here&#039;s how I tried it:
- I put a div tag around the require($body_code) called mainContent (to be consistent with the naming schemes in the commercial modules referred to) in tpl_main_page and then defined the structure of the page (head,body,mainWrapper,leftColumn,mainContent, rightColumn,bottom) as per the tags in the template being used
- I then replaced the zen_redirect with the $Ajax-&gt;redirect as suggested in the article and then defined the returnblocks to just return mainContent. Not sure why it still redirected with a page refresh. I do have a capture module installed in my contact us page, could that have zen_redirects in it that I need to &quot;catch&quot; too? 

My question is that does every div tag used in the template have to be defined in the array in header.php? Is the general idea that every zen_redirect in the module is changed out with Ajax-&gt;redirects?</description>
		<content:encoded><![CDATA[<p>Enough of the whinging, people! They&#8217;re doing us a service by even providing help.</p>
<p>I am trying to implement an ajax contact us based on the code. Downloaded the files and installed them but have a question about usage.</p>
<p>As far as I can see, the way it works is to define the ids of the blocks of the template that will be returned by ajax in the /includes/modules/pages/contact_us.php file and then replace the zen-redirect with the $Ajax-&gt;redirect.</p>
<p>Here&#8217;s how I tried it:<br />
- I put a div tag around the require($body_code) called mainContent (to be consistent with the naming schemes in the commercial modules referred to) in tpl_main_page and then defined the structure of the page (head,body,mainWrapper,leftColumn,mainContent, rightColumn,bottom) as per the tags in the template being used<br />
- I then replaced the zen_redirect with the $Ajax-&gt;redirect as suggested in the article and then defined the returnblocks to just return mainContent. Not sure why it still redirected with a page refresh. I do have a capture module installed in my contact us page, could that have zen_redirects in it that I need to &#8220;catch&#8221; too? </p>
<p>My question is that does every div tag used in the template have to be defined in the array in header.php? Is the general idea that every zen_redirect in the module is changed out with Ajax-&gt;redirects?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AConfusesOne</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1344</link>
		<dc:creator>AConfusesOne</dc:creator>
		<pubDate>Tue, 18 May 2010 22:13:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1344</guid>
		<description>And now is almost 6 months later Sir not 2 years -:)
In any case thank you for your efforts although I never could make this run... I hope that in close future we will be able to see some more parts to this documentation like part 4 and 5 with more  code demos and explanations.

Thank you again</description>
		<content:encoded><![CDATA[<p>And now is almost 6 months later Sir not 2 years -:)<br />
In any case thank you for your efforts although I never could make this run&#8230; I hope that in close future we will be able to see some more parts to this documentation like part 4 and 5 with more  code demos and explanations.</p>
<p>Thank you again</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1336</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 18 May 2010 10:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1336</guid>
		<description>The client side itself is no secret, as mentioned you could just go to the demo of any of our product and peek into the javascript part. 

Please note that we are not required to answer all questions on our blog, especially for the ones that are posted on Sep 2009 and now is almost 2 years later. All code published or shared by us as free code should be used as your own risk. We are not responsible for any damage it may make on your site.</description>
		<content:encoded><![CDATA[<p>The client side itself is no secret, as mentioned you could just go to the demo of any of our product and peek into the javascript part. </p>
<p>Please note that we are not required to answer all questions on our blog, especially for the ones that are posted on Sep 2009 and now is almost 2 years later. All code published or shared by us as free code should be used as your own risk. We are not responsible for any damage it may make on your site.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AConfusesOne</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1335</link>
		<dc:creator>AConfusesOne</dc:creator>
		<pubDate>Tue, 18 May 2010 03:12:51 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1335</guid>
		<description>Oh yeah? then why you do not answer Kclam&#039;s question, poor him, he has been waiting since December 11, 2009. A client side example to get a block via the zencart ajax pack will a clear answer to our questions and we will be very satisfied and appreciative for that. But -:)</description>
		<content:encoded><![CDATA[<p>Oh yeah? then why you do not answer Kclam&#8217;s question, poor him, he has been waiting since December 11, 2009. A client side example to get a block via the zencart ajax pack will a clear answer to our questions and we will be very satisfied and appreciative for that. But -:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1334</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Tue, 18 May 2010 02:58:42 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1334</guid>
		<description>This module is being used in many modules such as Ajax Search, Advanced Tab, Ajax Onepage checkout, etc.... on http://eazyecommerce.com/
In short, it is being used on all our current works which relate to Ajax.

However, the code shown here on this tutorial is rather outdated and should be considered as a base for your to develop your idea on only. Will the current code ever be released? Not in the near future for some reasons:
1. This is a rather developers oriented module, and such may require so much time to provide support especially for people not well versed with php and ajax (as is the case with some of our other free modules, which we had to spend much time on support)
2. The development of this module took much effort and at the moment we don&#039;t want to release it yet.

However, as we are moving to ZenMagick sometime in the future, you will probably see most of the features of the module incorporated into this cart software.</description>
		<content:encoded><![CDATA[<p>This module is being used in many modules such as Ajax Search, Advanced Tab, Ajax Onepage checkout, etc&#8230;. on <a href="http://eazyecommerce.com/">http://eazyecommerce.com/</a><br />
In short, it is being used on all our current works which relate to Ajax.</p>
<p>However, the code shown here on this tutorial is rather outdated and should be considered as a base for your to develop your idea on only. Will the current code ever be released? Not in the near future for some reasons:<br />
1. This is a rather developers oriented module, and such may require so much time to provide support especially for people not well versed with php and ajax (as is the case with some of our other free modules, which we had to spend much time on support)<br />
2. The development of this module took much effort and at the moment we don&#8217;t want to release it yet.</p>
<p>However, as we are moving to ZenMagick sometime in the future, you will probably see most of the features of the module incorporated into this cart software.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: AConfusesOne</title>
		<link>http://blog.rubikintegration.com/2009/09/01/zencart-ajax-made-easy-part-3/comment-page-1/#comment-1333</link>
		<dc:creator>AConfusesOne</dc:creator>
		<pubDate>Tue, 18 May 2010 02:52:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.rubikintegration.com/?p=359#comment-1333</guid>
		<description>kclam
He can not show you any client side example at all... I&#039;m not so much optimist, and I doubt if this works at all, I read these 3 parts more than 20 times and downloaded the code, went through every thing and still do not know what to do. I even do not know how to call my AJAX JQuery load function, I made many experiments none succeeded. Not a single example is given, not a single demo for a subject like AJAX which is so interesting for all of us to implement in ours carts. This just waste if time, I have already wasted 3 days of my time. The writer of this article either provides working examples more clarifications or just remove it, because he wastes peoples time.</description>
		<content:encoded><![CDATA[<p>kclam<br />
He can not show you any client side example at all&#8230; I&#8217;m not so much optimist, and I doubt if this works at all, I read these 3 parts more than 20 times and downloaded the code, went through every thing and still do not know what to do. I even do not know how to call my AJAX JQuery load function, I made many experiments none succeeded. Not a single example is given, not a single demo for a subject like AJAX which is so interesting for all of us to implement in ours carts. This just waste if time, I have already wasted 3 days of my time. The writer of this article either provides working examples more clarifications or just remove it, because he wastes peoples time.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: blog.rubikintegration.com @ 2012-02-07 14:24:47 -->
