add block drop-down link(menu) on quick access link on header of magento - magento

I want to add a new drop-down links(menu) on header links(quick access) and move links of on it
just when a customer sign in show this drop-down links on quick access and it does not show when customer is guest or log out and when customer log in show name of customer as topic of drop-down links .
for this scenario what do I do now? I make static block for drop-down block and remove log out, my wishlist ,my account from top.links on page.xml and call static block on header but I do not know how to avoid to show for all customer(gust or log in) and another way that I test I want to call static block on local.xml in tag but I do not how to call static block
another problem on static block I cant use php code and I do not use getWelcome() ?> for topic of drop-down links.

You can't use php code inside static block so you need to create your own template file.
If you create you own template file you can use:
<?php if (Mage::getSingleton('customer/session')->isLoggedIn()): ?>
//put Welcome message with $this->getWelcome() or anything you needed
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('your_indentifer')->toHtml() ?>
<?php else: ?>
//if needed, display something for not logged-in usersY here
<?php endif; ?>
You can also use <customer_logged_in></customer_logged_in> node in your local.xml instead of isLoggedIn() method in order to add you .phtml template or statick block (please note that it's top-level node and shouldn't been wrapped in <default> node)

Related

Changing the position of Joomla 3.2 tags

I have added some tags and linked these to an article. On the front end the tags appear on top (i.e. before) the article text. Instead I would like to display them at the bottom (i.e. after) the article.
I assume I have to make an override of layouts/joomla/content/tags.php
Create a Template Override for the following file:
components/com_content/views/tmpl/default.php
Once done, open this file in your override location and go to line 157 and you will see the following:
<?php if ($params->get('show_tags', 1) && !empty($this->item->tags)) : ?>
<?php $this->item->tagLayout = new JLayoutFile('joomla.content.tags'); ?>
<?php echo $this->item->tagLayout->render($this->item->tags->itemTags); ?>
<?php endif; ?>
Move this section of code somewhere futher down in the file to suit your needs
Hope this helps
This can be easily achieved by simply changing the Position Of Article Info to "Below" in Options Tab in Joomla Menu. The Joomla menu has to be of Type "Article"
No need to create any override.
Hope this helps.
See attached screenshot.

magento cms pages and checking if customer logged in

I have a CMS page that has a download link on it. Here is what I need to happen:
keep the download link if the user is logged in.
if the user isn't logged in, change the behavior of the link so it is a link to register.
I see that there is layout update xml i can use <customer_logged_in> and potentially change that link based on that. How can I use that layout update xml in this cms page so that the link is different?
Or is there a better approach that I could try?
The better approach is to go with your custom block creation. Here is how you can achieve what you want.
1) Create a CMS page and in content section include your custom block
For Ex:
{{block type="core/template" name="download_page" template="YourTemplateFolder/TemplateFileName.phtml"}}
2) Check if customer is logged in or not.
For Ex:
<?php if(!Mage::getSingleton('customer/session')->isLoggedIn()): ?> //If user is logged in
<?php $downloadUrl = 'Your Download URL'; ?> //generate your download URL
<div>
<?php echo $downloadUrl; ?> // Allow user to download
</div>
<?php else: ?>//If user is NOT logged in
<?php $registerUrl = 'Your Register URL'; ?> //generate your register URL
<div>
<?php echo $registerUrl; ?> // Ask user to Register
</div>
<?php endif; ?>

Can I have more than one success (onepage) page in magento

Can I have more than one success (onepage) page in magento. One for Cash on delivery and another for Online Bank transfer.
thanks in advance.....
Just modify the template file for checkout success page (checkout/success.phtml) to display what you want it to for each method used. You have access to the order object in the template and can do everything there. If you need additional functionality just extend the checkout success block and use the new functions in the template. Absolutely no need to create a new success page and if you did you would need to extend the checkout controller which could cause you problems down the line with upgrades etc.
<?php $order = Mage::getModel('sales/order')->loadByIncrementId($this->getOrderId()); ?>
<?php if ($order->getPayment()->getMethod() == "checkmo"): ?>
<p>Check or Money Order HTML</p>
<?php else if ($order->getPayment()->getMethod() == "bank_transfer"): ?>
<p>Bank Transfer HTML</p>
<?php endif; ?>
See this article by fontis for more information: http://www.fontis.com.au/blog/magento/customise-magento-checkout-success-page-based-payment-type

How do I manually theme Views in Drupal 7?

I am new to drupal and I am trying to figure out how to theme Views. I currently have a content type called Category with the following fields:Title, Image and Body. I created a view for the above mentioned content type so that I would list view of all the categories I have created.
To custom theme the view I created a folder called views in my theme folder, and created the following view files:
views-view-fields--plugin-categories.tpl.php
views-view--plugin-categories.tpl.php
views-view-unformatted--plugin-categories.tpl.php
This is what I currently have in my first file:
<div class="<?php print $classes; ?>">
<?php if ($rows): ?>
<div class="view-content">
<?php print $rows; ?>
</div>
<?php elseif ($empty): ?>
<div class="view-empty">
<?php print $empty; ?>
</div>
<?php endif; ?>
<?php if ($more): ?>
<?php print $more; ?>
<?php endif; ?>
</div><?php /* class view */ ?>
Instead of $rows, I tired to use print $field['image'] and print $field['body'] but this method does seem to work. Could you kindly advise on how I could theme the three fields, within categories, displayed using view?
You should name your template like this
views-view-fields--<machine-name-of-your-view>.tpl.php
So I'm assuming from the above that your view is called 'plugin-categories'. An easy way to check is to go to edit the view and look at the URL while you're on the edit page. It should have the format /admin/structure/views/view/YOUR-VIEW'S-MACHINE-NAME/edit, so you can get it from there.
Once you're sure it has the right name, clear your cache to make sure Drupal is picking up your new template. You just need the one above, not all three to modify the output of the three fields in question.
Once you've cleared cache, Drupal should be picking up the new template. You didn't mention exactly what isn't working, just that it's not working, so I wanted to cover the naming and caching, just in case. Now, to output particular fields in this view template, call them like this:
$fields['your-field-machine-name']
So $fields['body'] (I think you're missing an 's')
You should have nothing about $rows in this template! If you have anything about $rows, you haven't copied and pasted from the correct views template. Simply output the fields as you want them to appear in your view, in whatever order you want with the syntax above and put in whatever css classes, etc you want.
Let us know if that works!

how do i link to a specfic block in a page?

I had displayed part of "latest testimonial" (textarea) on my home page, and placed a "view more" link in the end.
Now I want to link to that specific testimonial on a page when "view more" is clicked.
But I had a list of testimonials on a single testimonial page, meaning no separate detail page for each testimonial. So how can I display the specific testimonial on the page ?
<?php echo $this->getUrl('testimonial'); ?>
this gives a link to my testimonial page.
First you need to provide some element IDs on your testimonials page. For example if each testimonial is in a quote:
<blockquote id="testimonial001">
...
</blockquote>
Or place a named anchor just before each testimonial:
<a id="testimonial001"></a>
...
Then your URL can be built with a fragment:
<?php echo $this->getUrl('testimonial', array('_fragment'=>'testimonial001')); ?>
By specifying the ID through a route parameter you will override any other fragment that might get set by another module (don't know which, just know that it can happen) which is preferable to merely appending it.
example below should generate a link this this: http://www.example.com/testimonial#anchor
<?php echo getUrl('testimonial'); ?>#anchor
The rest you can find in this document: http://www.w3schools.com/tags/tag_a.asp
using this example: http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_link_bookmark

Resources