Different .phtml to diffrent type of product - magento

I am trying to make module that switches diffrent .phtml of productview depend on attributeset name. I dont know witch file is responsible for rendering productview.

It is usually Magento Block that render template. In your case productivew is rendered by
Mage_Catalog_Block_Product_View.
You can easily figure this out by enabling template_hints and template_hints_blocks. To enable these to option follow steps below:
Go go Admin
System > Configuration
In left column, Select Developer under Advance.
Change Current Configuration Scope to website level (template_hints and template_hints_blocks is applicable at website level only)
Make yes to Template Path Hints and Add Block Names to Hints under Debug group.

you can rewrite this class:
Mage_Catalog_Block_Product_View
and then you can add your own logic to it to switch to another template, not the standard
catalog/product/view.phtml

Related

Magento: Update several pages with a different tracking code

I have to put some Tracking code on several pages: some category pages, homepage, cart and success page. Whats the best way to accomplish that?
I thought:
homepage --> place the code in CMS -> pages -> home
success --> edit the success.phtml
cart --> edit the cart.phtml
categories -> create a CMS block --> place layout update in the concerning category page to load CMS block
But it looks like it is just a mess because for every code I have another solution. What would you suggest to get it done? Did I miss a better solution?
Thank you,
Hannes
If it's the same tracking code for each one, you could
Create a .phtml file containing the code
Add the file to the relevant hard pages (success, cart) using your layout xml files
Add the file to the relevant soft pages (home, categories) using the custom design tab / custom layout update area.
If the code changes based on the page, then you may need to create a new module with a block that alters the tracking code according to a parameter you include in the layout.
You can include a tracking script using the available Magento configurations fields.
Go to System > Configuration > Design
Under the HTML Head section, insert your tracking script into the Miscellaneous Scripts field.
Save Config, and clear your Magento caches.
Alternatively if you want it in the Footer instead, look under the Footer section and use the Miscellaneous HTML box there.

File location of phtml file of backend admin page

I installed an extension to add custom fields to customer registration form.I want to add some option value in dropdown menu box of input validation in backend admin page..could you plz tell me the path of the folder where can I find the phtml file which is responsible for that part ?
-Thanks.
The files you are looking for are in:
app/design/adminhtml/default/default/template
But just changing the .phtml file won't do the job. The customer model itself should be extended to provide for your extra field. Therefore i highly recommend you to write a module for this instead of altering Magento core code. This to make sure that you can still use updates in the future.
Writing such an module requires more in depth knowledge of Magento. For more information on custom adminhtml see here.
For information on extending the core functionality look here.
If you don't feel like programming this all yourself take a look at customer attribute modules on Magento Connect.

Magento - How to Edit container1

I am looking to edit the container1 and container2 product information in my magento template. In view mytemplate/template/catalog/view.phtml and I see these container1 and container2 calls.
After some research, I should be looking for an options directory, but that does not exist in my template.
Is this something I am suppose to add if its not there? Hopefully someone can help as I am definitely hoping to add a new div class and some new options to this Add to Cart/product-options area.
If you're trying to actually add options, you would do that through the admin interface. If you're trying to change aspects of the template affecting how options are displayed, you would indeed be looking for options .phtml files. Specifically, in your theme path, something like:
/app/design/frontend/default/YOUR_THEME/template/catalog/product/view/options
And there will be two files:
wrapper.phtml
wrapper/bottom.phtml
In the future you might also want to look into enabling theme hints through your admin interface:
System > Configuration
Change current configuration scope to anything more specific than "Default Config".
Advanced > Developer > Debug > Template Path Hints > Yes
After enabling this mode, open the product view page and each element on the page will also show which .phtml it is being generated by. If this is a live site, you might also want to set your IP address under the Developer Client Restriction Allowed IP so nobody else sees the hints.

In a custom Joomla! template, how can I determine whether I am on the home page?

I am trying to create a custom template, but I want the template to look a little different for my Joomla! homepage/frontpage. Is there a easy boolean-type expression I can use to determine whether I am on my site's homepage?
That way, I can just say if ($on_homepage) { [custom homepage html] } else { [regular template] }
Thanks in advance!
You can create a separate template for your homepage. More details here.
This is very easy, just create 2 templates. One for your homepage and one for the rest of your site. Then install both, make sure you give them a descriptive name in their xml file so you know the difference.
Once they are installed you can set a default template that would be site wide. Then choose/click on your homepage template and it's options will load up. On the bottom left you can select the menu items where this template will be visible. This setup is very much like the way in which you define where modules are shown.

Best way to link Category to customized Modul

So far i have found two ways of liking a category to a customized module. By Category i mean created in Admin->Catalog->Manage Categories->created new category. By Customized module i mean module created in code(app/code/local)
way to link
Till today I used Admin->Catalog->Url Rewrite Manager to direct some category(blog) to some customized module(blog/index/index). So, in Url Rewrite manager I created rewrite entry that had Request-Path hold Category Url-key(blog-index.phtml) and Target-Path hold my costumized module path (blog/index/index). It stop redirecting today by having automatically putting different target path (catalog/category/view/s/blog-index/id/)...i am not sure why
2.way to link
In category layout xml file I put handle
This does the work but it requires to mess with category module that i prefer not to do. It also has link(catalog/category/view/s/blog-index/id/) that does not favor search engines
Is there better way to link category to my costumized module?
The layout XML can go in your module's layout XML file (layout/blog.xml for example) if you'd prefer, the file that layout XML resides in has little importance (you'll need a <layout> section in your config.xml if you don't already have one)

Resources