how to products list of the cart at Product details page - joomla2.5

I want to get the product list of cart in the Product details page. how to get it???
I think cart details are stored in a session.
How to use it on Product details page
i'm using Virtuemart 2.022a and Joomla 2.5.9

Try this,
$cart = VirtueMartCart::getCart();
if(sizeof($cart->products){
echo "<pre/>";
print_r($cart->products);
}
Hope its help you..

Related

How to show discount on homepage in Opencart 3.0.3.6 with Journal 3 theme installed?

I have Opencart 3.0.3.6 store with Journal 3 theme installed. Many products have discounted price if customer buy in certain quantity. This discount is visible on the product page when customer click on the product on the home page and load the product page. I want to show quantity discount on the home page like the image.
Opencart Demo site product
Opencart Home Page Product Grid
This is what I am trying to achieve to show discount on home page
I figured out that catalog/view/theme/journal3/template/journal3/product_card.twig file shows content on the homepage or as product grid but I am not sure which controller file it gets it's data from. Can some one please help me to locate the controller file and help with the code?

Add to cart button on luna theme big cartel

How do I stop the "add to cart button" on my products page from redirecting people to the shopping cart page. I would much prefer it to just add the item selected and then allow them to continue shopping instead of forcing them to be redirected. Also, is there a way to add a cart preview drop down to the products page. I would like a preview to drop down and show the cart page each time they add something.
Thank you

Django: How to increment URL?

How to increment the URL?
I have a poll app, a user can vote in a question with "yes" and "no" each time.
I would like to know how to redirect the user to the next question after the user vote for the actual question. Let's say in total I have 10 questions saved in the database.
I don't want to show all 10 questions in the same page.
I've read about making it with ajax and also I did read about passing question id in the url. If anyone can clarify it for me. Thanks!!
I tried this one.
path('question/<int:question_id>', views.QuestionVoteView.as_view(), name='question')
And this one.
path('question/', views.QuestionListView.as_view(), name='question')
And to vote on the actual question.
url(r'^nope/(?P<user_id>\d+)$', poll_views.nope, name='nope')
url(r'^yep/(?P<user_id>\d+)$', poll_views.yep, name='yep')
I think you can just add <int:question_id> to your poll_views urls.
url(r'^nope/(?P<user_id>\d+)/(?P<question_id>\d+)/$', poll_views.nope, name='nope')
url(r'^yep/(?P<user_id>\d+)/(?P<question_id>\d+)/$', poll_views.yep, name='yep')
And in views, you can get question id from url (kwargs) and can get your question object, add +1 for vote number.
Plus, you don't have to add user_id in urls. you can get current authenticated user in template & views by request.user. So, your url can be
url(r'^nope/(?P<question_id>\d+)/$', poll_views.nope, name='nope')
url(r'^yep/(?P<question_id>\d+)/$', poll_views.yep, name='yep')
and find current user using request.user.
And I found out that you use both url() and path(). What django version do you use? If 2.0, you have to use path() and if 1.xx use url().

how to add new filed to opencart

I want to add three more filed to cart page .()
<input name="pr_name">
<input name="pr_phone >
<input name="pr_add">
can any one help me to add these files to cart .
you will need to modify the following:
the model for the cart /catalog/model/checkout
the controller for the cart /catalog/controller/checkout
the view for the cart whatever theme you are using
finally you will need to do the same for the admin panel and depending on where you would like to see them for example you might want to view them in the invoice you will need to change the model / controller that correspond to that. unfortunately its not like a plug and play thing.

How to remove shopping cart item after payment done?

I have clear shopping cart item after payment done. I have tried many code, but its redirect to empty shopping cart. I wouldn't like to redirect the page and remove cart items.
Thank you
try:
foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
Mage::getSingleton('checkout/cart')->removeItem( $item->getId() )->save();
}
Or:
Mage::getSingleton(‘checkout/session’)->clear();
In order to redirect it on some page (e.g: success page):
Mage_Core_Controller_Varien_Action::_redirect('/checkout/onepage/success', array('_secure'=>true));