{"id":5149,"date":"2004-03-13T23:37:42","date_gmt":"2004-03-14T07:37:42","guid":{"rendered":"http:\/\/www.ikillspies.com\/blog\/2004\/03\/13\/5149\/"},"modified":"2004-03-13T23:37:42","modified_gmt":"2004-03-14T07:37:42","slug":"modify-your-zen-cart","status":"publish","type":"post","link":"http:\/\/www.ikillspies.com\/?p=5149","title":{"rendered":"Modify your Zen Cart"},"content":{"rendered":"<p>I installed <a href=\"http:\/\/www.zen-cart.com\">Zen Cart<\/a> on a client&#8217;s machine&#8230;<\/p>\n<ol>\n<lI>installation was a breeze<\/lI><br \/>\n<lI>the problem is it is very easily ideifiable as a Zen Cart&#8230; which is bad for a professional site.  Everything should look home-grown<\/li>\n<li>The client has an existing site which doesn&#8217;t really fit with the Zen Cart presentation style.  So I have to do a little conversion<\/li>\n<li>There is basically NO DOCUMENTATION so I&#8217;m having to look through the source code to figure out how to implement these changes<\/li>\n<\/ol>\n<p \/>\nHere&#8217;s my notes on making the switch!<\/p>\n<p \/>\n<h2>Overview for every page<\/h2>\n<p>As is evident from looking at the URLs of any part of the catalog, the &#8220;main&#8221; page is just <b>index.php<\/b>, regardless of what the content of the page is.  For any particular page it loads, it has a default file it uses for the entire site, which may be overridden by a locally defined file.  <\/p>\n<p \/>Most of these are PHP code only:<\/p>\n<p \/>\n<ol>\n<li><b>includes\/application_top.php<\/b> &#8211; this location is one of the only file paths hard-coded into the PHP code.  Its companion does NOT use the &#8220;includes&#8221; name directly but rather a constant define &#8220;DIR_WS_INCLUDES&#8221;<\/li>\n<li><b>includes\/modules\/pages\/[PAGE_NAME]\/header_php*<\/b> &#8211; defines some of the product-specific queries and settings for variables defined in <b>application_top.php<\/b>.  You can make other files which will get loaded too, if they start with the phrase <b>header_php<\/b><\/li>\n<li><b>main_template_vars.php<\/b>:<br \/>\n<blockquote><p>Define Template Variables picked up from <nobr><b>includes\/templates\/[NAME OF TEMPLATE]\/common\/main_template_vars.php<\/b><\/nobr> unless a file exists in the <nobr><b>includes\/modules\/pages\/[PAGE_NAME]\/<\/b><\/nobr> directory to overide. Allowing different pages to have different overall templates.<\/p><\/blockquote>\n<\/li>\n<li><b>tpl_main_page.php<\/b>:<br \/>\n<blockquote><p>Define the template that will govern the overall page layout, can be done on a page by page basis or using a default template. The default template installed will be a standard 3 column lauout. This template also loads the page body code from a page named in the variable $body_code.  <\/p>\n<p \/>(This refers to  <b>includes\/templates\/template_default\/common\/tpl_main_page.php<\/b> for the entire site or<br \/>\n<b>includes\/templates\/template_default\/[PAGE_NAME]\/tpl_main_page.php<\/b> for a specific page )<\/p><\/blockquote>\n<p \/>\n&#8230;anyway, that&#8217;s how it associates the &#8220;main_page&#8221; attribute with a PHP page in one of those two locations.  That content page will determine the contents between the two columns and above the &#8220;center&#8221; elements such as &#8220;new products&#8221;.\n<\/li>\n<li><b>includes\/application_bottom.php<\/b> &#8211; Actually uses a constant define &#8220;DIR_WS_INCLUDES&#8221; so watch out!<\/li>\n<\/ol>\n<p \/>\nThe page ALSO has a main location-<\/p>\n<ul>\n<li><b>includes\/languages\/english\/[TEMPLATE_NAME]\/[PAGE_NAME]<\/b> &#8211; or more generally <b>includes\/languages\/[LANGUAGE]\/[TEMPLATE_NAME]\/[PAGE_NAME]<\/b> &#8211; defines:\n<ol>\n<li> the navbar and heading titles <\/li>\n<li>THE CONTENT!!!  Whew!  At Last!  it&#8217;s stored in the variable <b>TEXT_INFORMATION<\/b><\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<p \/>\n<!-- end of index.php loading summary --><\/p>\n<h2>Including the Static Pages<\/h2>\n<ul>\n<li>In the demo store there are some mostly-static main content pages under &#8220;Information&#8221; and &#8220;More Information&#8221;.  Focussing on &#8220;More Information.&#8221;<\/li>\n<li>I have a <b>includes\/languages\/english\/[NEW_PAGE_NAME].php<\/b> . My first inclination was to assume that this is where the bulk of the information for the page should live.<\/li>\n<li>I see files for the &quot;classic&quot; template like <b>languages\/english\/classic\/[NEW_PAGE_NAME].php<\/b> .  I&#39;m thinking this is for styling the same page in different formats for different template.  Are these pages required?  If I make a template called BLAH in <b>includes\/templates\/BLAH<\/b> do I absolutely need to make files for all my content pages in <b>languages\/english\/BLAH\/[NEW_PAGE_NAME].php<\/b> ?<\/li>\n<li>how about <b>includes\/modules\/pages\/[NEW_PAGE_NAME]<\/b>?  It looks like there is only a small file, <b>header_php.php<\/b>, there.  Do I absolutely need something there?  what is that area for, besides putting this small file there?<\/li>\n<li>I also see a great deal of material in <b>includes\/templates\/template_default\/templates\/tpl_[NEW_PAGE_NAME]_default.php<\/b>.  This looks to be the default templates for every module, and therefore every content page, so that I need not define a <b>languages\/english\/BLAH\/[NEW_PAGE_NAME].php<\/b> for my BLAH template.<\/li>\n<\/ul>\n<p \/>\n<p>So, in summary:<\/p>\n<ol>\n<li>add <b>includes\/languages\/english\/[NEW_PAGE].php<\/b> for your main content<\/lI>\n<li>add <b>includes\/languages\/english\/[TEMPLATE]\/[NEW_PAGE].php<\/b> if you want your page content to be different in that particular template than the default you just defined<\/lI>\n<li>add <b>includes\/templates\/template_default\/templates\/tpl_[NEW_PAGE]_default.php<\/b> for your template (not the content)<\/lI>\n<li>add <b>includes\/modules\/pages\/[NEW_PAGE]\/header_php.php<\/b>, possibly for your variable settings<\/li>\n<\/ol>\n<p><!-- end More Information --><\/p>\n<h2>Top Header<\/h2>\n<ul>\n<li>The header is defined in <nobr><b>includes\/templates\/template_default\/common\/tpl_header.php<\/b><\/nobr><\/li>\n<li>Default has\n<ol>\n<li>Home<\/lI>\n<li>Log In\/Out<\/li>\n<li>My Account<\/li>\n<li>Cart (if cart nonempty)<\/li>\n<li>Checkout (if cart nonempty)<\/li>\n<p \/>\n<li>Logo banner<\/li>\n<li>Error Message (if any)<\/li>\n<li>Info Message (if any)<\/li>\n<\/ol>\n<p>These messages are defined in<br \/>\n<nobr><b>includes\/languages\/english\/classic\/header.php<\/b><\/nobr>\n<\/li>\n<li>so to get the &#8220;buy your candy today!&#8221; and countdown message we could:\n<ol>\n<li>add another field to the top- might be a little busy!<\/li>\n<\/ol>\n<p><\/lI><\/p>\n<li>Need to add top of logo as first element on left- others can slide to right?<\/li>\n<li>Or, possibly have cart navigation etc BELOW the original banner art<\/li>\n<\/ul>\n<h2>Bottom Footer<\/h2>\n<ul>\n<li><b>includes\/modules\/footer.php<\/b> defines a few variables&#8230;<\/li>\n<li>&#8230;which are then displayed by <nobr><b>includes\/templates\/template_default\/common\/tpl_footer.php<\/b><\/nobr><\/li>\n<li>Default footer has\n<ol>\n<li>Bottom Nav Bar with &#8220;Home&#8221;<\/lI>\n<li>IP address of client ?!<\/li>\n<li>whatever was defined in <b>footer.php<\/b>, in our case the copyright notice<\/li>\n<li>the END OF THE BIG TABLE !!<\/li>\n<li>Advertising banners<\/li>\n<li>the parse time<\/li>\n<\/ol>\n<\/li>\n<li>We should probably put the bottom navigation links in here<\/li>\n<\/ul>\n<h2>Information Panels<\/h2>\n<p>Including the new pages:<\/p>\n<ul>\n<li><b>include\/filenames.php<\/b> &#8211; defined  FILENAME_[NEW_PAGE_NAME] for each page<\/li>\n<li><b>include\/languages\/english.php<\/b> &#8211; defined BOX_INFORMATION_[NEW_PAGE_NAME]<\/li>\n<li><b>include\/modules\/sideboxes\/more_information.php<\/b> &#8211; added each page to the array using both the above variables<\/li>\n<\/ul>\n<p \/>\n<ul>\n<li><nobr><b>includes\/modules\/sideboxes\/information.php<\/b><\/nobr><\/li>\n<li><nobr><b>includes\/modules\/sideboxes\/more_information.php<\/b><\/nobr> is by default empty- make sure you add new items AFTER the closing brace of the conditional there!<\/li>\n<p><lI>both explicitly stack <b>BOX_INFORMATION*<\/b> variables together into an array and pass on to templates<\/li>\n<li><b>BOX_INFORMATION*<\/b> variables defined in both\n<ul>\n<li>includes\/languages\/english.php<\/li>\n<p><lI>admin\/includes\/languages\/english.php<\/li>\n<\/ul>\n<\/li>\n<li><nobr><b>includes\/templates\/template_default\/sideboxes\/tpl_information.php<\/b><\/nobr> &#8211; can also replace template_default with other template names<\/li>\n<li><nobr><b>includes\/templates\/template_default\/common\/tpl_box_default.php<\/b><\/nobr> &#8211; can also replace template_default with other template names<\/li>\n<p><lI>Must contain pages from old site:<\/p>\n<ol>\n<li>Custom info<\/li>\n<p><lI>Visit us<\/li>\n<p><lI>About the store<\/li>\n<\/ol>\n<\/li>\n<\/ul>\n<h2>Other Notes<\/h2>\n<ul>\n<li>to change the titles of the pages:\n<ul>\n<li>admin\/includes\/languages\/english.php<\/li>\n<li>includes\/languages\/english.php<\/li>\n<\/ul>\n<\/li>\n<li>categories box for Zen Cart is at<br \/>\n<nobr><b>includes\/modules\/sideboxes\/categories.php<\/b><\/nobr><\/p>\n<ul>\n<li>template at <nobr><b>includes\/templates\/template_default\/sideboxes\/tpl_categories.php<\/b><\/nobr><\/li>\n<\/ul>\n<\/li>\n<li><b>category_row.php<\/b> seems to be only for <b>index<\/b>, used by<br \/>\n<nobr><b>includes\/templates\/[TEMPLATE_NAME]\/templates\/tpl_index_categories.php<\/b><\/nobr>&#8230;<br \/>\nhowever note that this file is only currently included in the <i>template_default<\/i> template<\/li>\n<li>can you control which pages have which boxes?\n<ul>\n<li>individual boxes code is in <b>includes\/modules\/sideboxes\/*.php<\/b><\/li>\n<li>the side boxes use constants defined in <b>includes\/languages\/[LANGUAGE].php<\/b><\/li>\n<p><lI>the actual file which renders the boxes is ??<\/li>\n<li>if we can find out which file includes the boxes, we will know how it determines<br \/>\nwhich boxes run in a given page\/template!<\/li>\n<li>under which circumstances does<br \/>\n<b>includes\/modules\/sideboxes\/template_default\/[TEMPLATE_NAME]\/???<\/b> run?<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>The Plan<\/h2>\n<p>Up to now our investigation has been totally speculative and non-invasive.  Below we summarize all the changes and the notes:<\/p>\n<ol>\n<li>put all the application-specific PHP routines in a single file, and have it included at the end of <b>application_top.php<\/b>\n<ol>\n<li>initially this will just define small functions which output store-specific strings<\/li>\n<p><lI>Database accessing functions will initially output dummy text<\/li>\n<li>planned functions:\n<ol>\n<li><b>getConnection()<\/b> gets a vanilla database connection<\/li>\n<li><b>getSmallPromoText()<\/b> generates the short text-only version of the current promotion<\/li>\n<li><b>makeHeaderPromo()<\/b> incorporates that short text into header HTML<\/li>\n<li><b>getLargePromo()<\/b> generates HTML for the larger version of the promotion<\/li>\n<li><b>getRandomSplash()<\/b> returns HTML for a random product image, for use in a splash image<\/li>\n<\/ol>\n<\/li>\n<\/ol>\n<\/li>\n<li>copy template fileset; rename and modify color scheme and look and feel\n<ul>\n<li>for example, <nobr><b>templates\/blue_strip<\/b><\/nobr> is the main area for &#8220;blue_strip&#8221;<\/li>\n<li>see also <nobr><b>languages\/blue_strip<\/b><\/nobr> for ???<\/li>\n<li>see also <nobr><b>modules\/sideboxes\/template_default\/blue_strip<\/b><\/nobr> for ???<\/li>\n<\/ul>\n<\/li>\n<p><lI>change the header:<\/p>\n<ol>\n<li>integrate logo top into left side of header navigation<\/li>\n<p><lI>add call to action to navigation header (if there&#8217;s room!)<\/li>\n<li>modify banner design to match non-ZenCart version<\/li>\n<p><\/oL><\/li>\n<li>change the footer:<br \/>\n<oL><\/p>\n<li>eliminate old content<\/li>\n<li>make bottom navigation links to major site areas<\/li>\n<li>add contact info (phone numbers) and bottom stripe<\/li>\n<\/ol>\n<\/li>\n<li>make templates for all static content &#8211; for each new mostly-static page create:\n<ol>\n<li><b>includes\/modules\/pages\/[NAME OF PAGE]<\/b> to define the page-specific variables&#8230; which could be a 2-line <b>header_php.php<\/b><\/li>\n<li><b>includes\/languages\/[LANGUAGE]\/[TEMPLATE NAME]\/[NAME OF PAGE]<\/b> which has the actual text of the center pane<\/li>\n<\/ol>\n<\/li>\n<li>include links to static pages in &#8220;information&#8221; panel<\/li>\n<li>not sure if changing <b>tpl_main_page.php<\/b> is even necessary!<\/li>\n<li>Make a combined &#8220;categories\/search&#8221; sidebox<\/lI>\n<li>Make a new &#8220;promotions&#8221; sidebox :\n<ol>\n<li>uses routines defined in PHP included by <b>application_top.php<\/b>, above<\/li>\n<p><lI>links to the seasonal items, or the custom items<\/li>\n<li>possibly just hack this as a 0% sale<\/li>\n<li>If there is room, make a text-only version which says the next major holiday and<br \/>\ntext incorporating the number of days remaining&#8230; this is to be used in the navigation header<\/li>\n<\/ol>\n<p><\/lI><\/p>\n<li>add images for products and categories; populate\n<ul>\n<lI>images should be proportioned to scale down to 100&#215;80 <\/ul>\n<\/li>\n<li>deploy store<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>I installed Zen Cart on a client&#8217;s machine&#8230; installation was a breeze the problem is it is very easily ideifiable as a Zen Cart&#8230; which is bad for a professional site. Everything should look home-grown The client has an existing site which doesn&#8217;t really fit with the Zen Cart presentation style. So I have to [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-5149","post","type-post","status-publish","format-standard","hentry","category-looky"],"_links":{"self":[{"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/posts\/5149","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5149"}],"version-history":[{"count":0,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=\/wp\/v2\/posts\/5149\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5149"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5149"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.ikillspies.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5149"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}