change add to cart bottom

  • Posts: 2
  • Thank you received: 1
12 years 2 weeks ago #72037

hi i am new and start with my first problem :)

I want to know if you can change "Add to Cart" buttom, in order to be green when the availability of the item is so great, yellow when it is low, example when 10 pcs remaining, and red when the article is finished, but clicking it brings you to contact page

thanks for the reply

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 2 weeks ago #72108

Hi,

The easiest way is to use the contact button instead of the add to cart button in Configuration > Display, select "For all products" for the option "Display a contact button on the product page" and "No" for the option "Display 'add to cart' button".

Then edit the view "product / show_default" in HikaShop > Display > Views.

Replace the lines:

		<?php
		$contact = $this->config->get('product_contact',0);
		if (hikashop_level(1) && $this->row->product_quantity == 0 || ($contact == 2 || ($contact == 1 && !empty ($this->element->product_contact)))) {
			$empty = '';
			$params = new HikaParameter($empty);
			echo $this->cart->displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id) . '\';return false;');
		}
		?>
By:
		<?php
		$contact = $this->config->get('product_contact',0);
		if (hikashop_level(1) && $this->row->product_quantity == 0 || ($contact == 2 || ($contact == 1 && !empty ($this->element->product_contact)))) {
			$empty = '';
			$params = new HikaParameter($empty);
			echo $this->cart->displayButton(JText :: _('ADD_TO_CART'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id) . '\';return false;','',0,1,'redButton');
		}
		?>

And in the view "product / quantity", replace:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);
By:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min,'greenButton');
Where the if condition is: "if($this->row->product_quantity==-1){"

And where the if condition is: "}elseif($this->row->product_quantity>0){" add the following code:
if($this->row->product_quantity > 10){$btnClass = 'greenButton';}
elseif($this->row->product_quantity <= 10){$btnClass = 'yellowButton';}
And replace the line:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min);
By:
echo $this->cart->displayButton(JText::_('ADD_TO_CART'),'add',$this->params,$url,$this->ajax,'',$max,$min,$btnClass);

Then you have to create the properties for the new classes in HikaShop > Configuration > Display "Front-end default CSS" file.
Like:
.greenButton{
    background-color: green;
    ...
}

Ps: you need the essential version for doing this.

Last edit: 12 years 2 weeks ago by Xavier.
The following user(s) said Thank You: danilo87, marekbr

Please Log in or Create an account to join the conversation.

  • Posts: 2
  • Thank you received: 1
12 years 2 weeks ago #72755

for do every or only for do new greenbuttom class?

The following user(s) said Thank You: danilo87

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 1 week ago #73050

Hi,

The code given is to do all the changes, green button, yellow button and red button.
You have to create the properties for each button now.

To do that create the properties for the classes: ".greenButton" ".yellowButton" ".redButton" in the Frontend CSS File in HikaShop > Configuration > Display.

The following user(s) said Thank You: danilo87

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 0
12 years 1 week ago #73718

hello

at me do not work the red button for the rest everything is ok, show the message "esaurito" in eng "over" but no one red button

this is the site:

www.resemagien.it/index.php?option=com_h...t=listing&Itemid=127

I also have a question, buying the business version I have to redo these steps?

sry for my english :P

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 1 week ago #73982

Hi,

Do you have enabled the "Contact" button for all products in the HikaShop configuration ?
And see if this option is enabled in the product edition page.

Buying the business edition will not erase the modifications, but you can make a save before upgrading.

Last edit: 12 years 1 week ago by Xavier.
The following user(s) said Thank You: danilo87

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 0
12 years 1 week ago #73990

sry but i don't find where i must enabled that contact button

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 1 week ago #74118

Hi,

In HikaShop > Configuration > Display, the option "Display a contact button on the product page".

The following user(s) said Thank You: danilo87

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 0
12 years 1 week ago #74129

i must buy first business version :P

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 0
12 years 4 days ago #74939

hi

i now have business version and activated display button, but i don't see it, but I would like a red button to add products to cart, however, even if they are terminated

Last edit: 12 years 4 days ago by danilo87.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
12 years 4 days ago #75029

Hi,

By default the contact us button is displayed only on the product page, not in the listing page.
But you can edit the view "product / listing_table" and try to add the code:

		<?php
		$contact = $this->config->get('product_contact',0);
		if (hikashop_level(1) && $this->row->product_quantity == 0 || ($contact == 2 || ($contact == 1 && !empty ($this->element->product_contact)))) {
			$empty = '';
			$params = new HikaParameter($empty);
			echo $this->cart->displayButton(JText :: _('ADD_TO_CART'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->row->product_id) . '\';return false;','',0,1,'redButton');
		}
		?>
After:
						<td class="hikashop_product_add_to_cart_row">
							<?php
								$this->setLayout('add_to_cart_listing');
								echo $this->loadTemplate();
							?>
						</td>

The following user(s) said Thank You: danilo87

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 0
11 years 7 months ago #96193

hi, i re-open thi tread because i want to make a change

we have added to our list items ordered, I would create another type of button,
example, when the items are more than 10 put the green button, less than 10 yellow, then I thought of doing such a button "orange" for the items ordered, with the opportunity to add to the cart, and as the amount I could put "unlimited '

or accepted suggestions

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96228

Hi,

You can use the same method as explained before, with some changes to change the color when ordered items.
The changes needs to be made in the view "product / quantity". Check if the customer already purchased the product, and change the color if it's the case.
It require good PHP knowledge.

The following user(s) said Thank You: danilo87

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 0
11 years 7 months ago #96387

thanks i created the 3 buttons, the problem is allignment,
green button and yellow button have an allignment, orange button have an other allignment, i tried to center it, without result, i tried to put:

.hikashop_products .hikashop_product_stock .hikashop_cart_buttom {
margin-top: -35px;
}

but he center yellow and green, but not orange


i put a screenshot and the site is:

www.resemagien.it/index.php?option=com_h...t=listing&Itemid=179


to see class

I am going crazy to understand why <.<

thanks

Attachments:
Last edit: 11 years 7 months ago by danilo87.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #96443

Hi,

In the code I see:

<br></br>
<br></br>
That's why the buttons are not centered. I think that you have added it in the view. Try to remove it.

The following user(s) said Thank You: danilo87

Please Log in or Create an account to join the conversation.

  • Posts: 47
  • Thank you received: 0
11 years 7 months ago #96457

thanks now works fine :)

Please Log in or Create an account to join the conversation.

Time to create page: 0.107 seconds
Powered by Kunena Forum