Get product variant URL / Load product variant

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 年 前
Hi,

I have created a product with some variants, of which these are loaded into a category listing:
http://www.wyldebydesign-dev2.co.uk/category/6-cleaner-sanitiser.aspx

The problem i'm having is, i'm unable to distinguish between variants when loading them into the product template. I don't want to show more than one variant at a time: here is an example:
http://www.wyldebydesign-dev2.co.uk/products/1-bactericidal-cleaner-sanitiser.aspx

I have a problem where the client needs a brilliant CMS such as nopCommerce but is unwilling to stick to the ecommercce norm so that's why the structure may seem incorrect but the problem still remains that I'm unable to get a Product Variant url from the SEO Helper... only a productURL.

Is there a way to load variants into a template, and not the product as a whole.... I hope i'm making sense?

I also have another problem: When I create a new template controls won't post-back from it. I used the below steps to add a new template.

- Add a new .ascx into the Templates/Products (or categories) folder.
- Inherit from the BaseNopUserControl
- Go to the backend > CMS > Template > Products/Categories > Add new
- Point to the new .ascx
- Go to Categories/Product maintennance > select the new template.

It all works good in terms of loading the page but when I put, say an add to basket button, on the controls - their events do not fire.

Any help with the two problems is much appreciated.

Many thanks
12 年 前
BoogleC wrote:
Hi,

I have created a product with some variants, of which these are loaded into a category listing:
http://www.wyldebydesign-dev2.co.uk/category/6-cleaner-sanitiser.aspx

The problem i'm having is, i'm unable to distinguish between variants when loading them into the product template. I don't want to show more than one variant at a time: here is an example:
http://www.wyldebydesign-dev2.co.uk/products/1-bactericidal-cleaner-sanitiser.aspx

I have a problem where the client needs a brilliant CMS such as nopCommerce but is unwilling to stick to the ecommercce norm so that's why the structure may seem incorrect but the problem still remains that I'm unable to get a Product Variant url from the SEO Helper... only a productURL.

Is there a way to load variants into a template, and not the product as a whole.... I hope i'm making sense?

I also have another problem: When I create a new template controls won't post-back from it. I used the below steps to add a new template.

- Add a new .ascx into the Templates/Products (or categories) folder.
- Inherit from the BaseNopUserControl
- Go to the backend > CMS > Template > Products/Categories > Add new
- Point to the new .ascx
- Go to Categories/Product maintennance > select the new template.

It all works good in terms of loading the page but when I put, say an add to basket button, on the controls - their events do not fire.

Any help with the two problems is much appreciated.

Many thanks


First of all... awesome looking site- good job!

What do you need a product variant url for? As far as I know product variants don't have their own pages (urls), all of a product's variants appear on the product's page. If you need separate pages for them, why not make each variant a separate product?

As far as the postback problem, I've dealt with that before but can't remember what was happening or how I fixed it. If you can send me the .ascx file (all files associated with it)  I can insert it into the code and try to see why it doesn't work....

orders at nopeasy.com would be where to send it.
12 年 前
Duplicate post?
12 年 前
For anyone else who may be having post back issues... I looked into BoogleC's code and he was trying to use Image Buttons in his custom user control. For some reason you can't use image buttons in Nopcommerce - I believe it has something to do with the URL Rewriting that is going on. The urls that are used for image buttons screw up post back somehow because of the URL rewriting, so you should find an alternative to image buttons if you make a custom user control.
12 年 前
That's the second time I posted the same thing twice... hmm...
12 年 前
I would like to add to Barry's very helpful resolution for me (which was my problem).

Any ASP.NET control that renders a Javascript:__doPostback etc, seems to cause problems when posting back within nopcommerce. I'm not sure why but i'd look to Barry's suggestion at the URL rewriting engine.

If you're experiencing this problem then you have to fnid other ways of implementing your controls (of which they are usually many!).

Boog's
12 年 前
I quick fix for using images, would be to style the normal <input type="submit" /> elements that are in the OOB list to have the image is its background-image, via css.

<input type="submit" class="add-to-cart" />

then in your css:

.add-to-cart{
background: transparent url(http://www.wyldebydesign-dev2.co.uk/App_Themes/Custom/Images/Master/add-to-basket-button.png) no-repeat 0 0;
}

.add-to-cart:hover{
background: transparent url(http://www.wyldebydesign-dev2.co.uk/App_Themes/Custom/Images/Master/add-to-basket-button-hi.png) no-repeat 0 0;
}

Might need to play around with the width and height of the button to get the image to look right.
12 年 前
Hey ^, that is the best way to get around the problem and it works just as well as image buttons.

I would say we make this a more prominent post but v2.0 is coming out soon and uses MVC so this problem won't be present anymore.

Cheers,
Boogs
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.