Post by developer » Thu Aug 12, 2010 5:07 am

Hello. I'm using the latest version of OC. I need to add "Order Sample" button/link under product near Add to Cart. I want to do that with the category view. How can I do that? Thanks.

User avatar
New member

Posts

Joined
Tue Jul 27, 2010 8:06 pm

Post by developer » Thu Aug 12, 2010 8:00 am

no help yet?

User avatar
New member

Posts

Joined
Tue Jul 27, 2010 8:06 pm

Post by spikeachu » Fri Aug 13, 2010 5:03 am

I'm working on this for a site I have in development.

I'll let you know when it's ready. If my implementation is suitable, i'll let you know how I did it.

Wedding Invitations and Stationery by Love2print

Commercial Mods
Product Colours on Category Page
Cardsave Direct Gateway
Clear Cache
Promotional Watermarks on Images
Multiple Category / Product Templates ** Popular **
Log Failed Login Attempts
Display Eligible Coupons with Products
Twitter Feeds

Have I helped you out or saved you some time? Please donate


Active Member

Posts

Joined
Fri Mar 12, 2010 6:31 am

Post by developer » Sat Aug 21, 2010 8:10 am

Thank ypu spikeachu. I appreciate if you let me know. I'm very behing my schedule and couldn't find a solution... The site needs to be completed within 3 days :(

User avatar
New member

Posts

Joined
Tue Jul 27, 2010 8:06 pm

Post by developer » Sat Aug 21, 2010 8:16 pm

I got your PM spikeachu and replied twice. Reply expected. Thanks.

User avatar
New member

Posts

Joined
Tue Jul 27, 2010 8:06 pm

Post by raffraffraff » Thu Mar 03, 2011 4:27 pm

Well, it seems that a 'sample' button is in demand! I'm installing OpenCart on my wife's site to replace a horrible shopping cart that I made for her years ago. One thing I can't find in 'module' form is a module that adds an 'order sample' button. She makes personalised stationery, so people generally want to buy one or two items before placing an order. I bought a cool "Setup Fee" module on this site, but I'd like to be able to bypass this with an "Order Sample" button.

So has anybody got anything like this? Even a 'free sample' button might work if I could hack at it. If not, I'll probably figure it out once I get a chance to get stuck into it for a few hours...

Newbie

Posts

Joined
Sun Feb 13, 2011 12:00 am

Post by spikeachu » Fri Mar 04, 2011 12:34 am

raffraffraff wrote:Well, it seems that a 'sample' button is in demand! I'm installing OpenCart on my wife's site to replace a horrible shopping cart that I made for her years ago. One thing I can't find in 'module' form is a module that adds an 'order sample' button. She makes personalised stationery, so people generally want to buy one or two items before placing an order. I bought a cool "Setup Fee" module on this site, but I'd like to be able to bypass this with an "Order Sample" button.

So has anybody got anything like this? Even a 'free sample' button might work if I could hack at it. If not, I'll probably figure it out once I get a chance to get stuck into it for a few hours...
I have it integrated into my site, www.love2print.co.uk
It's a bit hap-hazard how it works, but you're welcome to the code and instructions.

Regards, Spike.

Wedding Invitations and Stationery by Love2print

Commercial Mods
Product Colours on Category Page
Cardsave Direct Gateway
Clear Cache
Promotional Watermarks on Images
Multiple Category / Product Templates ** Popular **
Log Failed Login Attempts
Display Eligible Coupons with Products
Twitter Feeds

Have I helped you out or saved you some time? Please donate


Active Member

Posts

Joined
Fri Mar 12, 2010 6:31 am

Post by scanreg » Fri Mar 04, 2011 1:11 am

It would be great to get the code if at all possible

Should I PM you?

Thanks :)

Active Member

Posts

Joined
Thu May 06, 2010 12:15 am

Post by spikeachu » Fri Mar 04, 2011 1:53 am

This is what i've very quickly ripped from my own site.
Basically, limitations are that a duplicate product has to be created, change the model to 'Sample' and the price to whatever you want your sample to be.

When the link is generated, the cart looks for a product with the same name with a model of 'Sample' and links to it.

Catalog->Controller->Product->product.php

Code: Select all

$this->data['text_samplelink'] = $this->language->get('text_samplelink');
$this->data['text_samplelink_href'] = $this->language->get('text_samplelink_href');
$this->data['samplelink'] = $this->model_tool_seo_url->rewrite(HTTP_SERVER . 'index.php?route=product/product&product_id=' . $this->model_catalog_product->getSampleLink($this->request->get['product_id']));

Catalog->Model->Catalog->product.php

Code: Select all

public function getSampleLink($product_id) {
	//Get range name
	$range = $this->db->query("SELECT name FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");
    
	$range = $range->row;
	$range = $range['name'];
    
	// select matching range items     
	$query = $this->db->query("SELECT product_id FROM " . DB_PREFIX . "product_description WHERE name = '" . $range . "' AND product_id != '" . $product_id . "'");
	
	foreach ($query->rows as $product) {
		$sql = $this->db->query("SELECT model, product_id FROM  " . DB_PREFIX . "product WHERE product_id = '" . $product['product_id'] . "'");
		foreach ($sql->rows as $query) {
			if ($query['model'] == 'Sample') {
				return $query['product_id'];
				exit;
			}
		}
	}
}
Catalog->Language->English->Product->product.php

Code: Select all

$_['text_samplelink']     = 'Free Sample:';
$_['text_samplelink_href']= 'Order free sample';
Product Template

Code: Select all

<?php if (isset($samplelink)) { 
	echo $text_samplelink;?>
	<a href="<?php echo $samplelink; ?>"><?php echo $text_samplelink_href; ?></a><br />
<?php } ?>

Wedding Invitations and Stationery by Love2print

Commercial Mods
Product Colours on Category Page
Cardsave Direct Gateway
Clear Cache
Promotional Watermarks on Images
Multiple Category / Product Templates ** Popular **
Log Failed Login Attempts
Display Eligible Coupons with Products
Twitter Feeds

Have I helped you out or saved you some time? Please donate


Active Member

Posts

Joined
Fri Mar 12, 2010 6:31 am

Post by raffraffraff » Sat Mar 05, 2011 6:31 pm

Ah, this was sort-of what I was going to try to do, but my wife doesn't want an additional 'sample' product appearing in her catalog. How did you get around that problem? I didn't see any on your site! Thanks for posting your code, and nice work on the website by the way!

Newbie

Posts

Joined
Sun Feb 13, 2011 12:00 am

Post by raffraffraff » Sat Mar 05, 2011 6:41 pm

Ignore my silly question. I'm in "Saturday Morning" mode.

Newbie

Posts

Joined
Sun Feb 13, 2011 12:00 am

Post by spikeachu » Sat Mar 05, 2011 7:13 pm

We all have them moments, although mine are more frequent than just Saturday. What's the address of the site you're working on. I wouldn't mind taking a look at how others have implemented a similar type of business. I know for me it wasn't straight forward and I've made lots of modification.

Wedding Invitations and Stationery by Love2print

Commercial Mods
Product Colours on Category Page
Cardsave Direct Gateway
Clear Cache
Promotional Watermarks on Images
Multiple Category / Product Templates ** Popular **
Log Failed Login Attempts
Display Eligible Coupons with Products
Twitter Feeds

Have I helped you out or saved you some time? Please donate


Active Member

Posts

Joined
Fri Mar 12, 2010 6:31 am

Post by raffraffraff » Mon Mar 07, 2011 12:39 am

My wife runs a small business by herself, handmaking her own line of greetings cards and wedding stationery that carry prints of her own illustrations. She occasionally sells original art work and limited edition prints. There's certainly overlap with the wedding stuff, so you're welcome to check the site out, but it's not actually public yet! I'll post the url as soon as it's ready. I'm no web designer / developer btw - just a linux admin that likes to play with stuff. The wife needs a new site, and after she was quoted €stupid to build a CMS based site, I decided to have a go. OpenCart seemed to be perfect to use as a starting point.

Newbie

Posts

Joined
Sun Feb 13, 2011 12:00 am

Post by madelharri » Sat Mar 17, 2012 9:27 pm

Hi, I've just tried to implement this code as I am building a site with exactly the same requirement. I'm new to OC but have tried to build a vqmod file which will put these changes into the core files and it doesn't seem to be working. I don't know if I am inserting it into the files in the wrong position or what as I don't really understand PHP. I'm using OC 1.5.2.1 and VQmod 2.1.6. I tried to put the code into the original files as well and had error messages with that.
Can you help please?

New member

Posts

Joined
Sat Mar 17, 2012 5:54 pm

Post by spikeachu » Sat Mar 17, 2012 10:11 pm

madelharri wrote:Hi, I've just tried to implement this code as I am building a site with exactly the same requirement. I'm new to OC but have tried to build a vqmod file which will put these changes into the core files and it doesn't seem to be working. I don't know if I am inserting it into the files in the wrong position or what as I don't really understand PHP. I'm using OC 1.5.2.1 and VQmod 2.1.6. I tried to put the code into the original files as well and had error messages with that.
Can you help please?
The code above is for v1.4.8

It's unlikely to work for v1.5.x

I have coded something similar in vQmod format, but this is for v1.5.1.3 and may not work with v1.5.2.x

Wedding Invitations and Stationery by Love2print

Commercial Mods
Product Colours on Category Page
Cardsave Direct Gateway
Clear Cache
Promotional Watermarks on Images
Multiple Category / Product Templates ** Popular **
Log Failed Login Attempts
Display Eligible Coupons with Products
Twitter Feeds

Have I helped you out or saved you some time? Please donate


Active Member

Posts

Joined
Fri Mar 12, 2010 6:31 am

Post by madelharri » Sun Mar 18, 2012 12:29 am

Ah, I had a feeling that might be the case. Is there any chance of updating it for 1.5.2.x? I'd be willing to pay...

New member

Posts

Joined
Sat Mar 17, 2012 5:54 pm

Post by spikeachu » Sun Mar 18, 2012 3:40 am

I'll see if I can find time to update it.

I'm very busy with my new born baby and other projects.

Wedding Invitations and Stationery by Love2print

Commercial Mods
Product Colours on Category Page
Cardsave Direct Gateway
Clear Cache
Promotional Watermarks on Images
Multiple Category / Product Templates ** Popular **
Log Failed Login Attempts
Display Eligible Coupons with Products
Twitter Feeds

Have I helped you out or saved you some time? Please donate


Active Member

Posts

Joined
Fri Mar 12, 2010 6:31 am

Post by madelharri » Mon Mar 19, 2012 12:01 am

Thanks and congratulations on the baby.

New member

Posts

Joined
Sat Mar 17, 2012 5:54 pm

Post by sandybeach » Tue May 22, 2012 7:13 pm

I manged to add the order sample facility to V 1.5.1.3 and heavily modified opencart so that the sample products don't show as actual products on the site. If anyone has a vQmod for this I would be very interested! Although my solution works fine, it's a bit messy and is a bit of a pain when updating.

Newbie

Posts

Joined
Tue May 22, 2012 7:02 pm
Who is online

Users browsing this forum: No registered users and 11 guests