Post by dashopinstyle » Thu Oct 21, 2010 3:12 am

When products grid is being disaplyed we dont have option to buy that product user has to click n the link can we ADD another button which allows user to buy it before going into another level.

If yes where we can add that line of code and what all we need to modify

thanks in advance

New member

Posts

Joined
Fri Jul 02, 2010 12:41 pm

Post by 5ulo » Thu Oct 21, 2010 8:35 am

Try this...
/catalog/view/theme/yourtheme/template/product/category.tpl

paste this code where you want to have buy now button

Code: Select all

<a class="button_buy" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" ><?php echo $button_add_to_cart; ?></a>

CID, VAT ID / ICO, DIC (vQmod) for OC 1.5.x
Autofill SEO field (vQmod) for OC 1.4.x-1.5.x


User avatar
New member

Posts

Joined
Thu Oct 21, 2010 6:47 am
Location - Trnava, Slovakia, EU

Post by dashopinstyle » Sat Oct 23, 2010 12:26 am

This thing works great
add to cart text appears in the right place.

in case I want an image instead of text?
add to cart Image buy now image...
assuming my image name is buynow.jpg in images folder

how do we handle it

New member

Posts

Joined
Fri Jul 02, 2010 12:41 pm

Post by dashopinstyle » Sat Oct 23, 2010 1:06 am

i think I will add simple Image tag jst before '</a>'

New member

Posts

Joined
Fri Jul 02, 2010 12:41 pm

Post by dashopinstyle » Sat Oct 23, 2010 1:35 am

Code: Select all


<a class="button" href="<?php echo $products[$j]['add']; ?>" title="<?php echo $button_add_to_cart; ?>" ><span><?php echo $button_add_to_cart; ?></span></a>
this ads image button

thanks to you

now other problem I am facing is.
some product name are longer and some are smaller
so the price and button are not aligned horizontally
one is up and other is down
is there a way i can align them in one line so that all look aligned or I should add more wors in the name for some products ?

New member

Posts

Joined
Fri Jul 02, 2010 12:41 pm

Post by 5ulo » Sat Oct 23, 2010 5:05 am

I think, that you need absolute position in the box. For example i have my own product list style in divs (not in table).
HTML

Code: Select all

<div class="product-block">
  <img class="product-image" src="..." />
  <h3>Title</h3>
  <a class="button">button</a>
</div> 
CSS

Code: Select all

.product-block {
  position: relative;
  float: left;
}
.product-block h3 {
  position: absolute;
  top: XYpx; /*must be min height of the picture*/
}
.product-block a.button {
  /*if the element above was absolutly positioned, it is good to absolute position elements after, but it's not necessary*/
  position: absolute;
  top: XYpx; /*picture height + height of the longest product name*/
} 
This is one of the easiest ways. Another way is to cut the long names with PHP.

CID, VAT ID / ICO, DIC (vQmod) for OC 1.5.x
Autofill SEO field (vQmod) for OC 1.4.x-1.5.x


User avatar
New member

Posts

Joined
Thu Oct 21, 2010 6:47 am
Location - Trnava, Slovakia, EU

Post by dashopinstyle » Thu Oct 28, 2010 2:00 am

hi sir sorry
I was not able to do this.
Which files we have to add this code? i added in above file and experimented few things but was not able to get it going
sorry I am new with this, I request you if you can spare some of your precious time and guide me, where I need to add/edit this code it will be very kind of you.

New member

Posts

Joined
Fri Jul 02, 2010 12:41 pm

Post by 5ulo » Thu Oct 28, 2010 7:06 pm

What you want to do is not about OpenCart, it's about your CSS skills ;)

Code: Select all

http://www.barelyfitz.com/screencast/html-training/css/positioning/
this is what you need. Look at the tab 4 and 6. That is the right method to have product price and the buy button forever at the bottom of the product block.
Apply this method in category.tpl, special.tpl etc. .. just apply this wherever you want :)

CID, VAT ID / ICO, DIC (vQmod) for OC 1.5.x
Autofill SEO field (vQmod) for OC 1.4.x-1.5.x


User avatar
New member

Posts

Joined
Thu Oct 21, 2010 6:47 am
Location - Trnava, Slovakia, EU
Who is online

Users browsing this forum: No registered users and 3 guests