Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Get attribute multi values from attribute name ?
 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 09-04-2018, 02:34 AM
 
lakin1 lakin1 is offline
 

Member
  
Join Date: Feb 2018
Posts: 12
 

Default Get attribute multi values from attribute name ?

Hi ,
I am developing a custom module to get attribute multi select values from its name .

I am not able to find any inbuilt functions to do so.

Any suggestions will be greatly appreciated.

Thanks,
Lakin
Xcart 5.3.5.5
__________________
xcart 4.7
Reply With Quote
  #2  
Old 09-04-2018, 05:16 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,312
 

Default Re: Get attribute multi values from attribute name ?

Try doing a search - see

classes/XLite/Model/Repo/Attribute.php
protected function prepareCndName


classes/XLite/Model/Repo/AttributeOption.php
public function findOneByNameAndAttribute
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote

The following user thanks cflsystems for this useful post:
lakin1 (09-04-2018)
  #3  
Old 09-04-2018, 09:43 AM
 
lakin1 lakin1 is offline
 

Member
  
Join Date: Feb 2018
Posts: 12
 

Default Re: Get attribute multi values from attribute name ?

Quote:
Originally Posted by cflsystems
Try doing a search - see

classes/XLite/Model/Repo/Attribute.php
protected function prepareCndName


classes/XLite/Model/Repo/AttributeOption.php
public function findOneByNameAndAttribute

Thanks . It really helped.

Can we place indivisual add to cart buttons for each attribute ?
If yes , then how can we handle add to cart.
Please suggest.
__________________
xcart 4.7
Reply With Quote
  #4  
Old 09-04-2018, 10:05 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 13,312
 

Default Re: Get attribute multi values from attribute name ?

I am sure you can. You have to see how the product has the button and what params passes to it for the action "add to cart".
However it may be a little bit tricky to do that for each variant - depends where you have the list.
XC is coded so almost the whole page is inside "form" tag - this was mentioned to them years ago as something that should not be this way but it is still like this. They may never fix it. You will have to have the list outside the form for starter and then call the add to cart widget for each item in the list with its own parameters.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 09-04-2018, 10:40 AM
 
lakin1 lakin1 is offline
 

Member
  
Join Date: Feb 2018
Posts: 12
 

Default Re: Get attribute multi values from attribute name ?

Quote:
Originally Posted by cflsystems
I am sure you can. You have to see how the product has the button and what params passes to it for the action "add to cart".
However it may be a little bit tricky to do that for each variant - depends where you have the list.
XC is coded so almost the whole page is inside "form" tag - this was mentioned to them years ago as something that should not be this way but it is still like this. They may never fix it. You will have to have the list outside the form for starter and then call the add to cart widget for each item in the list with its own parameters.

<form action="?target=cart" method="post" accept-charset="utf-8" class="custom-add2cart">
<input type="hidden" name="target" value="cart" />
<input type="hidden" name="action" value="add" />
<input type="hidden" name="product_id" value="{{this.getProduct().getId()}}" />
<input type="hidden" name="attribute_values[{{attribute['id']}}]" value="{{attribute['select_attribute_id']}}" />
<div class="add-button-wrapper widget-fingerprint-product-add-button">
<button type="submit" class="btn regular-button regular-main-button add2cart submit">
<span>Add to cart</span>
</button>
</div>
</form>


I added above code and its adding product attribute as per its value.
But i ma facing one problem with price.
I mean , how can i override default product price calculation per attribute ?
__________________
xcart 4.7
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 01:30 PM.

   

 
X-Cart forums © 2001-2018