Magento - left.ptml not showing on all product list pages - list

left.phtml the file that displays the left navigation on a magento page is only showing on one list view page and not the others does anyone have a solution to get that file to show in all list views

If you are tasking left.phtml,
Then According magento structure left.phtml are only show for Non-Anchor category in it left side of category.
And layer navigation are only showing for Anchor category.for anchor left.phtml is not showing.
For non-Anchor categories
see catalog.xml code
<catalog_category_default translate="label">
<label>Catalog Category (Non-Anchor)</label>
<reference name="left">
<block type="catalog/navigation" name="catalog.leftnav" after="currency" template="catalog/navigation/left.phtml"/>
</reference>
Also for
Anchor categories
see at catalog.xml
<catalog_category_layered translate="label">
<label>Catalog Category (Anchor)</label>
<reference name="left">
<block type="catalog/layer_view" name="catalog.leftnav" after="currency" template="catalog/layer/view.phtml"/>
</reference>
Hope ,you will understand.

Check the layout in folder theme/package (it can be in default/default, when your theme is in another folder)
Check if layout is plugged (use in your layout.xml something like <remove name="header">). If header will be removed - you use correct layout
Check the handle and reference name, where you are adding block. For example: you are adding layered navigation block. On one page it placed in handle <catalog_category_layered>, but your page there no this handle. Try to add to <catalog_category_default> or even in <default>.
Open your template and check if the block was added there. Look for
<?php $this->getChildHtml('blockName'); ?>
Try to change your block name (maybe on this page already exist block with the same name)
(this option can be useless for you) Please check the block output in system / configuration / advanced
Maybe there is a conflict between two navigation modules (for example module A and module B). The module A can use it for rewrite. But the module B will use it only for investigation and use on this page it's own calls. In that case the module A will not work (to resolve this issue you need to change rewrite. class A should rewrite class B)
If you are trying to add navigation to CMS page - try to google this topic (how to add navigation to CMS page). There are many examples and I don't want to duplicate them.

Related

Magento code for $this->getChildHtml('topContainer');

I am coding a magento theme. I have enabled path hints but in
the header the call to $this->getChildHtml('topContainer');
does not reveal any path hints. How can I find out which
.phtml file is loaded when the above call is made, so
that I can create the appropriately named and located
.phtml custom file?
topContainer is a "page/html_wrapper" block.
It means there is no template file associated with it.
The role of this block is to render all it's children blocks inside an html element.
Take a look at the _toHtml() method in 'app/code/core/Mage/Page/Html/Wrapper.php'.
Sincerely,
Jonathan
--- More explanations:
You can take a look at a perfect exemple in:
layout/customer.xml (in base theme)
layout/sales.xml (in base theme)
You have a similar block:
<block type="page/html_wrapper" name="my.account.wrapper" translate="label">
It's the area where all other blocks of customer account will be rendered.
In order to put the blocks in this area, you have to create a "reference" node with attribute "name" set to the name of the "wrapper".
For exemple if you look (inside sales.xml) to the "sales_order_view" handle, you'll see <reference name="my.account.wrapper"> and inside this node, other blocks.
These other blocks are classics blocks (core/template) and they have templates files.
So you can compare a 'page/html_wrapper' block to a 'core/text_list' block.
The only difference is the first one will wrap the rendered child block into an html element.
Take a look to the 2 files mentionned above, they will help you a lot.

How to insert custom Javascripts in Sitecore backend

Pretty simple, I need to insert a script in Sitecores (v. 6.4) backend - how do I do it?
It doesn't matter if the script is placed inside <head> or <body>, nor does it matter if I can only specify the src of a <script> tag or if I can insert an actual Javascript snippet (the latter is preferable though).
The script needs to be inserted in the HTML when a Content Editor window is opened.
It is not an installation of my own, nor do I develop anything for Sitecore (I do have admin access, however), so something along the lines of installing a plugin would be the best solution I reckon.
I've previously inserted the script in Sitecore 5.4, but not in a pretty way (editing XML files) and if a better solution could be found here too, that'd be pretty great.
Update using Jens Mikkelsens answer in Sitecore Xpress 6:
I tried placing the following in web.config:
<clientscripts>
<everypage>
<script src="/test.js" language="javascript" />
</everypage>
<htmleditor>
<script src="/test.js" language="javascript" />
</htmleditor>
</clientscripts>
Being a little bit overzealous (and wanting to make sure the test.js file can be found) I put a js.test in the following locations:
inetpub\wwwroot\SitecoreWebsite\WebSite\sitecore\shell\Applications\Content Manager\
inetpub\wwwroot\SitecoreWebsite\WebSite\sitecore\shell\Applications\
inetpub\wwwroot\SitecoreWebsite\WebSite\sitecore\shell\
inetpub\wwwroot\SitecoreWebsite\WebSite\sitecore\
inetpub\wwwroot\SitecoreWebsite\WebSite\
Content of the test.js:
alert("Test [PATH TOKEN]");
Where the path token is just the parent folder name, so I know which test.js was loaded, e.g. inetpub\wwwroot\SitecoreWebsite\WebSite\sitecore\shell\Applications\Content Manager\test.js holds:
alert("Test Content Manager");
When I try to log in using the default Xpress admin user one of three things happens (in all three cases the frontend loads without errors, but no script present. I have NOT been able to determine when the errors happen, the only thing I can say for sure is that no errors occur when the test.js has not been included in web.config):
Case 1:
The content editor loads as expected, but no script is loaded. This happens most of the time when the clientscript have been included.
Case 2 - Server Error:
Server Error in '/' Application.
Exception Details: System.ArgumentException: Empty strings are not allowed.
Parameter name: value
Stack Trace:
[ArgumentException: Empty strings are not allowed.
Parameter name: value]
Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName) +241
Sitecore.Web.UI.HtmlControls.PageScriptManager.GetEveryPageScripts() +410
Sitecore.Web.UI.HtmlControls.PageScriptManager.GetScripts() +702
Sitecore.Web.UI.HtmlControls.Page.OnInit(EventArgs e) +62
System.Web.UI.Control.InitRecursive(Control namingContainer) +143
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1477
Case 3 - Sitecore error:
A required license is missing
Most likely causes:
The resource you are trying to access requires the following license: Runtime.
I'm not sure whether or not Xpress simply doesn't support clientscripts, but even if it doesn't it is weird that some times the content editor loads.
Update after testing in Sitecore 5.4 full version:
It does indeed work to put a script tag inside the <clientscripts> section in web.config as Jens Mikkelsen answered. It is, however, neccessary to put it inside the subsection <everypage> to get it to appear on every single page in the backend, whereas <htmleditor> only works for the Telerik RadEditor popup window in Sitecore 5.4.
Update after testing in Sitecore 6 full version:
The same method as described for Sitecore 5.4 works for Sitecore 6 with the addition of little thing: <script> embedded in <clienscripts> now require a key attribute:
<clientscripts>
<everypage>
<script src="/test.js" language="javascript" key="test script" />
</everypage>
</clientscripts>
I don't think you will be able to add the script with out modifying a file. However you can take a look at the <clientscripts> section in the web.config. There you can add scripts to be loaded. However I don't know if it will only load in the content editor.
I have experimented with this before, and I ended up using the above setting, but as I remember it also loaded on the Page Editor and the Desktop.
Perhaps you can use this example code to add controls to the <head> on the front-end but instead alter it to use the <renderContentEditor> pipeline to somehow inject a new <script> tag into the editor.
here is a good example of it Injecting javascript and css to Sitecore Content Editor Page

Magento - Inject custom module on product info page

I've searched on web for how to add "block" with my template on the product page. I build my custom module that displays some sort of information and I would like to show that, let's say under the long description of my product.
I've been trying to format the xml layout of my module but without luck.
After some search I've found this: Programatically create Magento blocks and inject them into layout which I can not make it work for me. But it is probably because I've missed something.
My module is structured like this:
CODE: app/code/local/deveti/Countrypurchase
DESIGN: app/design/frontend/default/default/template/Countrypurchase/index.phtml
LAYOUT: app/design/frontend/default/default/layout/countrypurchase.xml
I know the correct way is to edit main layout file, manually add a block, but I'd like to do that on the fly.
EDIT: this works!
So I would do in my module layout xml countrypurchase.xml something like this:
<?xml version="1.0"?>
<layout version="1.0">
<catalog_product_view>
<reference name="product.info">
<block type="core/template" name="product.countrypurchase" as="countrypurchase" template="countrypurchase/index.phtml" />
</reference>
</catalog_product_view>
</layout>
And I've added a call to catalog/product/view.phtml:
<?php echo $this->getChildHtml('countrypurchase'); ?>
And it works ;)
Thank you for your help!
The problem with the product view page is that it's output is mainly controlled by the PHP code in the template catalog/product/view.phtml. Magento doesn't offer much extensibility points out of the box. You could add it to the content block but that would put your custom content either completely at the top or completely at the bottom.
I think you are required to modify the template and add PHP code to render your custom block at the position you want, like:
<?php
echo $this->getChildHtml('product.countrypurchase');
?>
With this in place you can either add your block with the name product.countrypurchase via the XML layout or programmatically.

Magento - catalog.xml not using correct template

Noob developing a Magento theme and I can't seem to figure out why Magento is not using the path I specify in the setTemplate action on catalog.xml.
I've got my own theme in /app/design/frontend/default/mycustomtheme and I've been patching files over from the base and making changes.
I've copied over /app/design/frontend/base/default/layout/catalog.xml to my custom theme at /app/design/frontend/default/mycustomtheme/layout/catalog.xml. I've set the template to be a specific phtml file...
<catalog_product_view translate="label">
<label>Catalog Product View (Any)</label>
<!-- Mage_Catalog -->
<reference name="root">
<action method="setTemplate"><template>page/2column.phtml</template></action>
</reference>
Yet it's not working. Can someone spot what the problem might be? I've got all cache disabled and other changes I make I can see immediately, just not this one.
edit: I should note, if I change something else in the catalog_product_view xml node I see those changes are reflected. For instance if I remove <action method="addJs"><script>varien/product.js</script></action> then I see the reference is removed in the rendered html file.
edit2: Adding images to address questions ...
did you setup-up / configured the theme from your store backend?
Yes, and it's actually loading the correct header and footer, and it's properly styled.
Are you sure you have such template under /app/design/frontend/default/mycustomtheme/template/page/ directory?
Yes, I can confirm the file is there
OMG. The (one and only) product I was testing on had a specific layout set under the "Design" section. So I guess that was overriding anything I had set in catalog.xml
I'd like to have the 3 hours of my life back.

How should I go about writing a Joomla! template?

I am using Joomla! CMS to develop a website. In the not-so-distant past I customized a template to schlep up a website. It was fun and interesting to tear apart the code to de-joomla!-fy the template. So interesting that in fact, I am flirting with the idea of making my own template from scratch.
So, if I am to pursue this, where do I start? Do you know of any really good reference material, or should I just play with the code all day until things work out? I prefer to do tons of reading (for the concepts) before I go at it.
Create a HTML page with the layout you want, inclusive of stylesheets and Javascript
(1.5/2.5 is Mootools based)
(Joomla 3.x is jQuery based)
Adding Javascript
Keep the template initially very basic.
Save this page as index.php page.
The default directory layout is:
css
html
com_<componentname>/ mod_<modulename> (used to override the base templates of Components and Modules)
images
js
templateDetails.xml
index.php
favicon.ico
Change/Add the different Joomla constructs
Also updating the related templateDetails.xml with positions and file locations etc.
See a current template for an example of the layout.
Ex.
<?php
// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );
?>
Header section:
<jdoc:include type="head" />
Your different Modules:
<?php if($this->countModules('search')) : ?>
<jdoc:include type="modules" name="search" />
<?php endif; ?>
<jdoc:include type="module" name="breadcrumbs" />
Your Main Content tag is:
<jdoc:include type="component" />
To allow your template the ability to display debug information add:
<jdoc:include type="modules" name="debug" />
For more advanced additions to a template have a look at the default templates (ja_purity, Beez).
To override component and module layouts copy the layout files of the component or module into a similarly named directory below the html directory of your template and change it.
Edit...
Extra utilities.
To highlight the used module names in a browser add tp=1 to the end of your URL ex. yourdomain.com?tp=1
To View an inactive but installed Template add template=template_name. ex. yourdomain.com?template=Beez
These two can be combined, like this. yourdomain.com?template=Beez&tp=1
For more information look at:
Joomla Template Tutorial Part 1 - Joomla Template Concepts
How to Create Your First Joomla Template
Joomla! Docs: Template Development
Google Joomla templates
The time-honored method of learning how to do code/templates/anything is to "steal" from someone who already knows how to do it and then modify that until:
you're happy with the outcome; and/or
you've learned enough to be able to go it alone.
I suggest that would be the quickest route to success. Theory is fine but you'll learn faster by doing, and making mistakes.