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; ?>
Related
I want to handle the product overivew separataly to the product detail view. I want to add additional text right behind the price in the product deatil view.
I tried to edit the view.phtml in path app/design/frontend/mytheme/default/template/catalog/product/view.phtml, refreshed caches and so on, but nothing changed.
In catalog.xml view.phtml will be load. So its seems correct.
But even when I try to echo "test" it doesnt show anything.
<?php if ($_product->getShortDescription()):?>
<div class="short-description">
<div class="std"><h2><?php echo $this->__('Details:') ?></h2>
</div>
</div>
<?php echo "test";
endif;?>
Do you have any hint?
Regards
Matt
You should enable template path hints in the backend to check which template file is used to render product page. Make sure that the cache is also disabled.
If you are allowed to edit the articles in Joomla, near the each article in the list, an "edit" button is present. How can I find, how that "edit" button generated? I just want to add some parameters. (I'm using a Front End for edit.)
It's in components/com_content/views/article/tmpl/default.php
<?php if ($canEdit) : ?>
<li class="edit-icon"> <?php echo JHtml::_('icon.edit', $this->item, $params); ?> </li>
<?php endif; ?>
You can override this in your template's html folder.
This script calls a function under components/com_content/helpers/icon.php to generate the icon.
You should not override this helper file. If you need to change what that function is doing, filter the content it generates after it has been run, whether via a plug-in or the default.php file.
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
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!
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)