How to hide the "add to cart" button magento - php

the question seems a litle bit strange, but I wonder if there's an easy solution to hide the add to cart button cause I would like to display a showroom of the products without anything, the add to cart button will only appears after an user event (select a store in a module in that case)
any good tricks to realize that ?
For now I'm thinking a session boolean variable set if the user has check which store he'll be linked to, perhaps there's something better ?
Thx

I am intrigued now as to how this is going to look! As mentioned earlier you can have your store selection stored as a cookie to give some persistence, in that way the site visitor can think and reflect about a purchase and not go through hoops next time they sign in.
If the cookie is not present you could put this in the end of your template to hide the buttons:
if(getCookie('yourstorecookie')==NULL) $$('.add-to-cart').setStyle({display:'none'});

Related

WP How to move a button in another position by php function

What is the best way to reposition the "Empty Cart" button on the checkout in Woocommerce. Ideally, in a non-destructive way that respects the JS on the page refreshing the table.
OP Cannot find correct documentation in native language
Original post:
I apologize immediately for the question. For many it will be
nonsense, but for me who is a beginner no. I need to move the empty
cart button next to the add to cart button. Through Google Inspect I
manage in 1 second to position the button where I want, but I can't do
it then through PHP in Wordpress. Sorry also for my english.
Thank you.

How can I make only the content refresh, or change, when new parameters i added?

I have a couple of pages where the user can add and remove stuff in order to update the results. i.e. in a "ShoppingList"-page where the user can add/remove drinks in order to see what ingredients they need.
Each of these drinks is stored in a cookie, with PHP, so the user have the ability to navigate and explore the site, and then return without having to add the drinks again...
When the user do this, adds/removes drinks, the entire page is reloaded.
Drinks are added to a cookie immediately, before any html and stuff, then refreshed once again in order to build the php.mysql.query based on the values now stored in the cookie.
I think this is a lot of unnecesary reloading and stuff. It should be something more like just refreshing the actual content that needs to change, and not reloading everything else - Lots of unnecesary mysql requests just to add/remove a drink from the shoppinglist. And this of course slows site down..
Whenever the page is loaded, I need to check the cookie in order to present the correct results. Then, when a user adds/removes a drink, I would like to do this in the background (update the cookie and update the result). Hopefylly this could speed up the user experience.
I have a site up'n'running here - as a "prototype" : http://barkeeper.thomaskile.me/?side=handleliste (norwegian site, but google translate sort of gives you an idea of what it says. just tested it..)
This same thing goes for all three pages on my site so far..
Any suggestion on how to accomplish this? Is it som sort of jquery.AJAX-thing? If so. WHere do I start any sort of ajax-thing. Not sure how that works in practice when the user doesn't do anything (on page load)...
This is usually done by manipulating DOM.
Remove the element from one list and create it in another list.
Checkout jQuery - the javascript library.

Restrict Joomla article to one view per user

Does anyone know how I can manipulate joomla to only allow one view per user to certain articles? I am looking to make the article gray out and not allow the user to click on it after it has been viewed for the first time. Any help would be much appreciated.
Thank you,
Dave
This is would probably have to be a plugin. This could only really be reliably done on a page that requires a user to be logged in and you can't just register new accounts. Also someone could just copy the text the first time and then your security is moot. Nevertheless, the plugin would have to track the page ID and the user ID and when the visit the page a row gets added to table. Then you could have a page template where you check that table and if the row exists for that page id and user you do whatever to the content otherwise display it as normal.
I'm not sure why you would want to do this, but it would take a plugin that does several things. First, your content would have to be available to registered users only. Cookies would work, but it would be really easy to clear your cookies to regain access to the content. Next, the plugin would need to record every visit to the page, the record would need to include the userID. Last, the plugin would need to look up the specific user that is trying to access an article and check to see if they have been to the page before.
However, all of that work would not prevent anyone from registering another account to access the content again. Or copying and pasting the content or saving the page locally. Why would you want to limit your users to a single page view?
The only correct way to do is create a plugin "content" that will check the database in the field "hits". If it is greater than X, you can redirect Joomla to block his access:
$mainframe->redirect('index.php', JText::_('AN ERROR HAS OCCURED'));
The advantage of this method is that you have the option to reset the counter in the administration of articles
As for the display of the results list, I advise you to use your html file of your template to make such audit and carried away those who are no longer available.

magento does not create session when using add to cart button from different site

I am generating add to cart buttons from a mans site separate from magento. for some reason when you click the add the cart button, it does not recognize a session so the enable cookies page show. if you refresh the page and on afterward , it works. how can i activate the session when using a external add the cart button.
Without seeing the code it is hard to know precisely, but in general terms, you need to look at the procedure which checks the session and explicitly initialise the magento session when the button is clicked.
One thing to note: If the buttons are on another domain, you may have problems with the session being transferred from one to another, which will make PCI compliance a little more tricky.
My advice would be to take a look at the API to see how you can connect into your Magento application in a clean way.

Drupal, ajax, ubercart question

Thanks in advance for your help. I'm completely stumped on how I can do this.
Here is my issue.
I have a node type show;
Each show has a number of performance dates and times.
When the user clicks "purchase tickets" from a show's page, I need to show them a single page, where the following happens:
The top of the page has a calendar that has dates and times available for this show highlighted. The user can then pick a date and time for this show that he wants to see. He can pick multiple dates and times.
Once he picks and date and time, I add them to a "cart" using ajax. The user can then enter the number of tickets that he wants for each performance.
Finally, on the bottom of the page he enters his checkout information (name, address, credit card etc) and is then pointed to a confirmation page. This is not done by ajax. Finally he authorizes the transaction and check out. (I'm using UberCart, but nothing else tied in, so I can switch if needed).
This is driving me nuts. I have no idea how to pull this off. Not even where to get started. Can someone please help?
What you want to do, is going to be quite hard and wont work well with ubercart, since you want to make a single add to cart and checkout page.
Ubercart will by default allow users to add items to their cart, and would also by default create a checkout flow, but you want something complete different than what ubercart offers. You might want to rethink your approach and either choose a flow that works better with ubercart or choose a different solution that by default works better with what you want (if there is such a thing).
What you can do
To do what you describe, you would need to create a custom page, that shows the calendar with the shows, some javascript to hand the ajax and a checkout form.
Behind the scenes you need to generate the calendar with the appropriate days (the date module might help you), respond to the ajax requests and add items to the basket, handle the checkout flow/order status and redirect to payment form or handle payment as well.
All of this would need to happen in a custom module, you would need to use hook_menu to create the page, that would take the product node as argument. You can use that in your callback function to generate the calendar. You would also need to create a callback for the ajax and add the actual javascript to do all the magic.

Categories