magento show "Sign up to get notified when this product is back in stock" link for simple-associated products - magento

How can we display the "Sign up to get notified when this product is back in stock" link for associated products of a configurable product.
Say, we have a T-Shirt (a configurable product) and we sell it in 3 sizes - Medium, Large and Xtra-Large (simple - associated products).
When the Large size goes out of stock, how can we make user subscribe for it for notification when it is back in stock.
Please note I have already set this setting in admin:
System > Configuration > Catalog > Allow Alert When Product Comes Back in Stock - Yes
I noticed that the url for this alert is like (it is for one of the simple products in my store):
http://localhost/mystore/index.php/productalert/add/stock/product_id/1/[some key]/[some key],,/
Is there any way we can call this url directly, passing the product id of our associated product in question? If so, what about those keys at the end of the url?
please guide.
thanks

I added this link beside the out-of-stock associated product:
http://localhost/mysite/index.php/productalert/add/stock/product_id/[associated_product_id]/uenc/[any_key]/
For e.g.
http://localhost/mysite/index.php/productalert/add/stock/product_id/17/uenc/MTM0MzcyMDk0Mw==/
It does my job.
Only thing is, after successfully adding the alert record, it redirects to home page, instead of same page as in normal case.
This is due to [any_key], if we could somehow encrypt current page url [the any_key] just like magento does, we can have it redirect to same page also, after successful saving of alert record.
Any ideas?
Thanks
Ok I got it finally!
The uenc key [any_key] is actually base64 encoding of current url.
So with the help of https://github.com/carlo/jquery-base64, I did:
var encodedUrl = $.base64.encode(window.location);
var redirectTo = 'http://localhost/mysite/index.php/productalert/add/stock/product_id/[associated_product_id]/uenc/' + encodedUrl + '/';
Hope this helps!

The Magento way to get the url would be:
Mage::helper('productalert')->setProduct($_product)->getSaveUrl('stock')

Magento already avails the functionality to set out of stock from admin panel, unfortunately it is limited to some instances therefore we can not set this from admin panel, either way you can do it in code as above mentioned but its a manual task and can not be done again and again with links.
So i think its better to use ready made extension in case you have specific requirement to set product stock alert functionality for customer and they can subscribe for it.
Here is the well managed extension for Magento 2 which can help you to set Product alert and sign-up / subscription functionality with many more admin manageable features.
Link to Out of stock notification extension for Magento 2 - https://www.mconnectmedia.com/out-of-stock-alert-magento2.html

Related

Magento 2 View-able product

I am looking if Magento can offer me a product type that's can be viewed not downloaded, for example I have a video and I want the user to pay first then he can watch it? is this possible product type in Magento?
Thank you,
Not out of the box.
You can make it as a normal product that a user ads to bag and after the customer buys it at checkout you redirect to the page with the video.
Or on success page you will provide them with a link to the video, which is otherwise unreachable. Additionally you can put a check in that page and ask the customer to insert the order number to view it.

Only allow administrator to buy products in Magento frontend

I need to somehow setup a Magento store to disable purchasing of a few products, and instead show a message that they can only be bought in the physical store. The twist is that the store owner/administrator has to be able to "buy" these products on the frontend on behalf of the customer -- all payment options are not available in the backend.
So, is there a way to only allow certain customers/users to purchase certain products, and show all other customers and anonymous visitors a "not for sale" notice? (Not "out of stock".)
I have thought of creating a special store view or custom design, or even using some Javascript trickery to prevent unauthorized visitors to purchase these products. Any clever ideas?
1 - Creating a custom product attribute that identify these products
2 - Put owner/administrator in a special customer group
3 - Anywhere you have a 'add to cart' button, you check the above logic and only should 'add to cart' for those product if customer is in that owner/administrator customer group
You could try overwriting the addAction method within the CartController (app/code/core/Mage/Checkout/controllers/CartController.php), and create a conditional statement that checks the user level.
Look forward creating Custom Shopping Cart Pricerule.
By default they do not satisfy your needs.
But this is the best place for your logic!

Magento - product that are not for sale

Does anyone know how to list products in Magento that are not for sale? I still want the items to appear in the store, but I would like the "Add to cart" function to be disabled. This seems like it would be something that is easy to set up, but I haven't been able to figure it out. Thanks in advance!
Set stock level to zero and disable backorders.
Our store uses this on occasion- Adding to what dick mentioned :
Set Stock to 0.
If your store allows out of stock items to be visible, then this will work immediately.
If you do not allow items to be visible once they are out of stock, you'll need to switch this setting in the backend.
Alternatively, you could set up a new product attribute that replaces the add to cart button with something different (more info button, popup, etc).
If you want to display for sale only then set it's stock qty to 0 and try to set option from admin like this go to your admin side click on system->configuration->catalog->inventory and set yes Display Out of Stock Products so that the product is display on front side without add to cart functionality
Hope this will help you

Magento put single product in catalog mode

i have a Magento shop and want to do the following:
Some of the products should not be available for buying (they should be put in some kind of catalog mode).
How could this be achieved in Magento?
Make some custom attribute for those products. For example:
can_sale
And on frontend display add to card button depending on this attribute. Like this:
if($product->getCanSale() == 1){
/*Display add to cart button*/
}else{
/*Dont' display add to cart button*/
}
The above answer works, but is a template solution for something that (in principle) should be solved server-side.
If any of your visitors is savvy enough to construct an add-to-cart URL, they can still add products you hid the cart button for, to their carts. Probably a very minor problem of course, in this case.
There's an extension called Not2Order, don't know if I'm allowed to link it here. That extension takes care of enabling / disabling the ordering of products from the server side, which is a little more robust.

Pulling Custom Option ID from Magento

We have a SOAP connection to magento that is working great - we're able to pull product info, skus, descriptions, etc. using the magento API. We've been able to successfully add products to the cart programmatically with custom options, and that works great. The problem is this:
When you create a custom option for a product, it is assigned a unique ID that has to be called in order to pass that option value to the cart. For example:
www.mysite.com/magento/checkout/cart/add?product=7&qty=1&options[OPTION ID]=robots
Assuming I have my custom option ID correct, this will add 1 product with the option "robots." Which is nice.
However, we have hundreds of products, and while they all use similar custom options, each option is given a unique ID. That means I need to be able to call the magento API and get custom options details (specifically the option ID) so that we can add them to the cart properly. I have been back and forth with Varien Support (Magento), but they are less than helpful, as usual. Now, I know I can find these options by using firebug in Firefox or Chrome, which I've done to test the "add to cart" script. However, that's not a proper solution. I need to be able to grab this data from magento based on product id.
Can this really be that hard? Shouldn't this be tied to the data for the product somehow? I've done a var_dump on the catalog_product.info and i see where it asks if there are options but doesn't provide any details on them. Thoughts?
Thanks in advance.
Do you need to get all options ids for specific products or just some particular? For the latter you can use this code:
$productEntity = Mage_Catalog_Model_Product::ENTITY;
$colorAttribute = Mage::getModel('eav/config')->getAttribute($productEntity, 'color');
$colorAttribute->getId();
For the first option code in this question might be useful How to get all super attribute options for a configurable item in Magento

Resources