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

Building a Request for Quote module

 
Reply
   X-Cart forums > X-Cart 5 > Modifying the design and features (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 08-19-2014, 08:42 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Building a Request for Quote module

Asking a question here, hoping to expand my understanding of XC5 and OOP, and reach out to the community for help. I am developing a "Request for Quote" module for a client.

The idea behind this module is to provide a way fr customers to request a custom quote for any product. The planned functionality is as follows:
1. New attribute RFQ added to the list of attributes, and can be assigned to any product.
2. The attribute functions similar to a textarea.
3. When attribute is assigned to a product, it displays at the below the default attributes on the product page.
4. The textarea is initially hidden, with only a checkbox and the attribute name showing, for example "Request for Quote" could be the display text.
5. When this checkbox is checked the default attributes are hidden, the textarea is revealed, and the previously selected default attribute values are copied into it.
6. Now the customer can continue specifying additional options that they want in the custom quote.
7. When the box is checked the price of the product should change to $0.
8. Once added to cart, the default attributes of the product should not display in the cart or minicart, only the RFQ attribute name, and the value taken from the RFQ textarea.
9. The customer should be able to proceed with checkout with the $0 item in their cart, and customer support personnel can follow up with the quote.

I have completed steps 1-6, and still need to complete 7-9. Currently I am attempting to work on #8.

I have a function that checks if the current product has an RFQ attribute assigned to it.

Here is a portion of my class that does this:
Code:
namespace XLite\Module\Baby\RFQ\View\Product\Details\Customer; /** * Product attribute values */ class AttributesModify extends \XLite\View\Product\Details\Customer\AttributesModify implements \XLite\Base\IDecorator { /** * Check if product has an RFQ attribute * * @param array $attributes Attributes * * @return boolean */ protected function isRFQ() { $attributeslist = $this->getRFQAttribute(); $foundRFQ = false; $product = $this->getProduct(); if ($product && !\XLite::isAdminZone()) { foreach ($attributeslist as $i => $attribute) { $value = $attribute->getAttributeValue($product); if ( $value && $value instanceOf \XLite\Module\Baby\RFQ\Model\AttributeValue\AttributeValueRFQ ) { $foundRFQ = true; } } } return $foundRFQ; }
Now on the cart page I would like to reuse this function and take action in a template if this attribute is related to the product. I realize it may need to be defined as public rather than protected. I am trying to affect the attribute display on the cart page as described above.

I have copied a class and a template into my module, creating:
Code:
namespace XLite\Module\Baby\RFQ\View; /** * Selected product attribute values widget * */ class SelectedAttributeValues extends \XLite\View\SelectedAttributeValues implements \XLite\Base\IDecorator { /** * Return widget default template * * @return string */ protected function getDefaultTemplate() { return 'modules/Baby/RFQ/selected_attribute_values/body.tpl'; } }

And I have created my template file: default/en/modules/Baby/RFQ/selected_attribute_values/body.tpl

With just the same contents as the original so far:
Code:
<div class="item-attribute-values"> <ul class="selected-attribute-values"> {foreach:item.getSortedAttributeValues(),option} <li> <span>{option.getActualName()}:</span> {option.getActualValue()}{if:!optionArrayPointer=optionArraySize}, {end:} </li> {end:} </ul> <div IF="getParam(#source#)" class="item-change-attribute-values"> <a href="{getChangeAttributeValuesLink()}">{t(#Change attributes#)}</a> </div> </div>
I would like to put {if:isRFQ()} in the template and only display the attributes if this evaluates to false. If it is true and the RFQ textarea contains content, only the RFQ attribute name and value should display. I also need to remove the RFQ attribute from displaying at all in this list if the textarea has no value.

I am struggling with how to accomplish this. I would like to reuse the function so as not to recreate code. I also need a new function that checks if the attribute has value. Any and all solutions to the problem are welcome and much appreciated. I have sent Tony a copy of my module, anyone that wants a copy just PM me. I can't post it publicly because my client is considering selling it in the marketplace once complete.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #2  
Old 08-20-2014, 01:23 AM
  qualiteam's Avatar 
qualiteam qualiteam is offline
 

X-Guru
  
Join Date: Dec 2010
Posts: 6,373
 

Default Re: Building a Request for Quote module

The logic sounds too complex to me. Are you sure you need to base the RFQ logic on the Attributes feauture?

As for reusing the code: you can put the code as a public method into either a model class (something like $product->isRFQ(); ), or a new XLite\Module\Baby\RFQ\Core\... class.
__________________
Alex Solovev,
Qualiteam

---

User manual Video tutorials X-Cart FAQ

You are welcome to press "Thanks" button
if you find this post useful

Click here to learn how to apply patches

X-Cart Extensions
Reply With Quote

The following user thanks qualiteam for this useful post:
totaltec (08-20-2014)
  #3  
Old 08-20-2014, 02:22 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Building a Request for Quote module

Hi Mike!

Sorry, I cannot look into right now, because of upcoming webinar. I will get to it next week and will suggest a solution.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote

The following user thanks tony_sologubov for this useful post:
totaltec (08-20-2014)
  #4  
Old 08-27-2014, 05:56 AM
  tony_sologubov's Avatar 
tony_sologubov tony_sologubov is offline
 

X-Cart team
  
Join Date: Jan 2009
Posts: 2,431
 

Default Re: Building a Request for Quote module

Hi Mike!

Thanks for your patience!

Actually qualiteam is right. You need to make this method isRFQ() be available in the XLite/Model/OrderItem object, so you would be able to use it in the template similar to your default/en/modules/Baby/RFQ/selected_attribute_values/body.tpl or default skins/default/en/selected_attribute_values/body.tpl.

Also, you can define your own methods that would display the value of RFQ textarea, so you may need to decorate XLite/Model/OrderItem class and add two more methods

- isRFQ()
- getRFQValue()

Please, let me know if it makes sense and if it is any help for you.

Surely, any more questions -- just let me know.

Tony.
__________________
Found a bug in X-Cart? Post it to our bug tracker!
Know how to make X-Cart better? Suggest an idea!
Reply With Quote
  #5  
Old 09-30-2014, 12:57 PM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default Re: Building a Request for Quote module

Mike, did you finish this module? I would be interested in taking a look at it for our site.
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote

The following user thanks GreatLakesVacuum for this useful post:
totaltec (09-30-2014)
  #6  
Old 09-30-2014, 06:56 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Building a Request for Quote module

It is finished, and it works great. It should be released very soon. I am not releasing it, I developed it for another company that plans to sell it in the X-cart marketplace.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
tony_sologubov (10-13-2014)
  #7  
Old 10-01-2014, 05:01 AM
 
GreatLakesVacuum GreatLakesVacuum is offline
 

eXpert
  
Join Date: Jan 2009
Posts: 286
 

Default Re: Building a Request for Quote module

Ok, thanks for the quick answer Mike.
__________________
X-Cart 4.5.4 Gold (Live Business Site)
X-Cart 5.1.9 Business (In Development Now)
Reply With Quote
  #8  
Old 06-26-2015, 08:06 AM
 
kaduchess@yahoo.com kaduchess@yahoo.com is offline
 

Member
  
Join Date: Jul 2010
Posts: 24
 

Default Re: Building a Request for Quote module

Hey Mike, Hal from NJ here..I think you'll remember me..
Do you know if this Mod was ever offered to the public yet? Thanks..
__________________
X-Cart 4.7
Using X-Cart for 6 years and loving it!
Reply With Quote
  #9  
Old 06-27-2015, 05:29 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Building a Request for Quote module

Should be soon Hal. But it will be for Xcart 5. Good to hear from you man!
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
  #10  
Old 01-04-2019, 03:25 AM
 
Noobab Noobab is offline
    
Join Date: Jan 2019
Posts: 1
 

Default Re: Building a Request for Quote module

Hi
i have a customer who would like a website that customers can add items to a basket , then request a quote .

there must be no pricing on the website at this point ,(this will be for 6 months to test the market demand ) once they are happy with the demand they want to change to eCommerce , same items just now with pricing . i dont want to redo website from scratch each time +/- 2000 items

does xcart have this avaliable

sean
__________________
Free 5.3.6.0
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 02:41 PM.

   

 
X-Cart forums © 2001-2020