loading magento cart block to a drop down panel - magento

Can any one please help me to load magento cart block into a drop down box. To be more specific, the module title or a menu should display some thing like 'my basket' and there should be a message of number of items in the cart below 'my basket'. When the user hovers the menu the drop down box should display the content of the cart/sidebar.phtml.Can anyone please suggest me how I can achieve this?
Thanks in advance.

I am doing this for a site I am working on. Unfortunately, I have had to do this through a static block...but it seemed to work without any issues. This is working for me, have a play and see how you go.
The CSS is pretty simple and is they key to showing and hiding the drop down itself.
CSS
// this is the panel where the cart is displayed
DIV#cart-panel {
width:100px; //arbitary width
position:absolute; // need this so that it doesn't interfere with the layout
display:none; // hides the block
z-index:200; // makes it way it in front of other content
}
#cartBtn:hover #cart-panel { display: block; } // basically, when you hover over the cartBtn, the cart-panel displays
Static Block contains
<li id="myCartBtn">
My Cart
{{block type="checkout/cart_sidebar" template="checkout/cart/sidebar.phtml"}}
</li>
Then in my sidebar.phtml, I just make sure there is a div with id="cart-panel" in it, surrounding the cart itself, instead of the <div class="block block-cart">
<?php if ($this->getIsNeedToDisplaySideBar()): ?>
<div id="cart-panel">
...
</div>
<?php endif; ?>
Then, finally, I put the static block into the template where I need it

check Fatdivision AJAX Quick Cart article.
Create an AJAX Quick Cart for Your Magento Theme

Related

Hide a paragraph of static block /cms page from wholesale customer group in magento

i'm using CMS pages and Static Blocks and would like to hide a text paragraph from showing it to a wholesale group.
is this possible with magento? Kindly help.
Magento 1.8.1
If,you want to hide a text paragraph from ,then first check wholesaler is logged in or not, then check current customer group is wholesaler.
Here code add in header.phtml
<?php
if(Mage::getSingleton('customer/session')->isLoggedIn() and Mage::getSingleton('customer/session')->getCustomerGroupId()==2 ){
?>
<script type="text/javascript">
document.getElementById("noforid").style.display=none;
</script>
/* using jquery*/
<?php
// do not show paragraph
//Get customer Group name
$group = Mage::getModel('customer/group')->load($groupId);
}
else{
?>
<?php
// text paragraph of your
}
?>
And put you content in a html element and put id of element.Using java-script hide the content.
<p id="noforid">your text</p>

Joomla 2.5 frontend pagination clicking on next button not working

I am using joomala 2.5 and developed my own component for showing table data in front end and added pagination. I'm getting pagination links, after clicking on the links 'next', 'prev' nothing happens.
What may be the problem?
In view.html.php I've added
$this -> pagination = $this->get('Pagination');
In default.php I've added
<div class="pagination">
<?php echo $this->pagination->getListFooter(); ?>
</div>
You haven't mentioned what you have done in you components model file. My advoice to you is just read this document carefully http://docs.joomla.org/J1.5:Using_JPagination_in_your_component & you will be easily apply pagination. The doc is perfect & its very simple to use pagination in Joomla.
Thank you.
Put your pagination buttons inside a tag and make sure the action url points to the same view (e.g. action = 'index.php?option=com_component&view=listview')
<form action=""...>
<div class="pagination">
<?php echo $this->pagination->getListFooter(); ?>
</div>
</form>

Magento: Category Lock/Warning or T&C

I wonder if there is a way to add a Warning/Advisory or Terms & Conditions (preferably) to a category or a landing page to warn users about adult content. On the shop I'm working on there is an "Adult Section" Category for Erotic Toys, Lingerie, cosplay, etc. and I need to warn users about such content before they access the section in case they're less than 18.
I've searched the web and only found paid extensions which I cannot afford. Does anyone know how to do this?
I'm using Magento CE 1.7.
Thanks,
EDIT:
Ok, so I've been trying to figure out how to do this and I just figured that the best way to do it would be to just create a Category Landing Page and adding a java script for T&C redirect to the page I want it to.
This is the code I would use for the Category Landing Page with blank content would be this.
<?php $_categories = $this->getCurrentChildCategories() ?>
<?php $_collectionSize = $_categories->count() ?>
<div>
<?php $i=0; foreach ($_categories as $_category): ?>
<?php
$layer = Mage::getSingleton(‘catalog/layer’);
$layer->setCurrentCategory(Mage::getModel(‘catalog/category’)->load($_category->getId()));
$helper = Mage::helper(‘catalog/category’);
?>
Then I found a code snippet that would redirect the user to a page of my liking after clicking accept but I'm not sure how to implement it and/or if this is the best choice. Here's the code.
<form action="url-to-go-to" method="GET" onsubmit="return checkCheckBox(this)">
I accept: <input type="checkbox" value="0" name="agree">
<input type="submit" value="Continue">
<input type="button" value="Exit" onclick="document.location.href='BACKTOWHAT.html';">
</form>
<script type="text/javascript">
<!--
function checkCheckBox(f){
if (f.agree.checked == false )
{
alert("Please tick the box to continue");
return false;
} else
return true;
}
-->
</script>
Now I was thinking that it would be best to just create a simple CMS page and point the category on the top menu to that page and once they have agreed and clicked on continue, they could be taken to the actual category by simply pointing the 'onclick' to the URL of the actual category.
Not sure if this is the best way but it's the only way I could come up. The other way I thought of would've required me to take the "agreements" during checkout that already comes with magento and make an extension that would allow me to place it on any page and call the "Agreement ID" from the Sales/Terms and Conditions tab but I don't know how to actually do that, it was just a thought.
If anyone has a better solution, I'd be happy to hear it.
I would add some sort of JavaScript that shows a div over the top of the whole page, that will create a session cookie when you accept to watch the category. Otherwise, make a back() in the history navigation. This way you don't need another page, just JS.
On another note, could you please post the extensions you found that do this?

Magento OnePageCheckout Redirect After "Place Order" Click

can anyone help with the following issue.
Once a customer in onepagecheckout clicks the „order now“ button I would like to show a custom page for 2-3seconds and the forward to either payment provider or thankyou page.
Currently I have an observer on
"checkout_type_onepage_save_order_after"
calling my custom model/method.
In this model/method I do a...
$this->_forward($url); //with $url being a custom controller/method
$res->sendResponse();
exit;
In this custom controller/method I load and render my layout the show my *.phtml – file and then...
$url = Mage::getUrl("???");
$this->_forward($url);<
$res = Mage::app()->getResponse();
$res->sendResponse();
And this is where I am lost (or maybe I am totally wrong on the whole thing).
First of all, the controller does not forward at all (whatever url or controller is given).
Second how do I know where to redirect to (if its payment provider or thank you page)
Is there a better way to „simply“ load a *.phtml after user clicks „order now“ and before he is redirected to either thank-you-page or payment-provider.
The phtml is user to load tracking code which must be placed and loaded in html.
I suggest instead that you consider doing the following:
Adding a javascript action to the place order button in the order review which will effectively issue an in-screen modal or popup
The click issuing the modal will set a timeout of 3000ms (3 seconds) which will then fire the order submit Ajax that Magento uses. This is important as the order submit and the redirect are dependent on AJAX.
This example jQuery script (requires adding jQuery to your Magento site, which is not standard) would set the timeout, issue the modal / popup I would add this code to the following file:
/app/design/frontend/[your theme]/template/checkout/onepage/review/button.phtml
Add a class to this line and remove the onclick event so you can capture the click and interject your timeout:
<button type="submit" title="<?php echo $this->__('Place Order') ?>" class="btn-place-order button btn-checkout"><span><span><?php echo $this->__('Place Order') ?></span></span></button>
<script>
$('#myform').submit(function(event) {
event.preventDefault();
//issue the popup - put your html in here:
var html = '<div style="position:absolute; top:0; left:0; min-height: 100%; width: 100%; background-color:white;"><h1>I am a popup</h1></div>';
$('body').append(html);
var self = this;
window.setTimeout(function() {
review.save();
}, 3000);
});
</script>

MVC3 _Layout.cshtml...disableing/enabling menu items

I have an MVC3 C#.Net project. When I initially load my Web site, I want to route to an Index page and have the navigation tabs at the top of the screen be disabled until a selection is made. Once a selection is made, the site routes to a details page. I would then like to enable the navigation menu itmes. How can I do this? Pass a ViewBag around? Not sure
I think the problem is that Index page doesn't follow a layout of the rest of the website, therefore index page shouldn't use a master layout.
On your index page:
#{
ViewBag.Title = "Index page";
// Null or a custom layout
Layout = null;
}
<p>Your content below</p>
If you want to render a menu on some condition, then store menu in a partial view model, e.g. SiteNavigation.cshtml
You can then render this view based on some condition. E.g.
#if(true){
#{ Html.RenderPartial("SiteNavigation"); }
}
I found an answer to my question. #CodeRush's answer is cool, which I will use in another scenario. But I like the implementation, below, for my prticular situation. In the Object1Controller Index get Action, I added the below code:
ViewBag.Hidden = "hidden";
Then in the Details get Action, which is the Action called when a link is clicked on the Index view, I added this code:
ViewBag.Hidden = "visible";
Then in the _Layout.cshtml I added this code:
<li style="visibility: #ViewBag.Hidden">#Html.ActionLink("About", "About", "Home")</li>
Which renders as:
<li style="visibility: hidden">About</li>
or
<li style="visibility: visible">About</li>
In the other Controllers, I don't need to set the ViewBag.Hidden property since the default for the visibility attribute is "visible". For the other Controllers, the ViewSource shows:
<li style="visibility: ">About</li>
Which renders as visible

Resources