darkhoros VIP
Total posts: 152
31 Oct 2017 22:14

Hi all, I am building a website where I have 2 types, one type for products and another type for clients requests. These products will have a field called product class, this product class will be like class 1, class 2, class 3, each class represent for example: cars, bikes, scooters ...etc, and each product will have lots of other fields for example, field for price and color and so one.

The type clients requests, is where client enter what they are looking for if they cant find on the website, so for example lets say a client is searching for a car that price is 1000 and all the cars range ffrom 2000 to 3000, so I give the user a chance to select what he is looking form the product types and enter his budget along side with other fields such as name and email and phone number, then the website owner will try to locate what the client needs based on his criteria and get back to him.

So basicly I will need the project class field to be shard between the 2 types the products and clients requests.

So when I add new class in the product class field, the clients requests type will have the updated product class field.

Can this be done?

I am open for suggestions.

Thank you all. Regards.

Last Modified: 02 Sep 2021


Sergey
Total posts: 13,748
12 Nov 2017 06:22

Ok, what you want is that in the search form of cobalt, you add button Request that will send user to submission form of request type, but prefill all form filelds based on values that user have entered in search fields.

Here is how I would do that.

Create new markup template. This is template where filter form is. Then I would add button request in there. Button request would be a link to submit request form but with additional parameters in URL.

 http://you.site/index.php? 
    option=com_cobalt&
    task=form.save&
    section_id=*&
    type_id=**&
    jform[section_id]=*&
    jform[type_id]=**&
    jform[title]=Request number 123&
    jform[fields][***]=1000&
    return=****&
    Itemid=140

Of course all that in on line. * is Id of the section. ** is id of the type. *** is ID of the fields. To populate fields just look how <input> is named on the form. And finaly return. It should be back to the same pabe so it will you will get like this

$url = JUri::getInstance()->toString();
$url = base64_encode($url);
$url = urlencode($url);

This way, user will not be even fill the form. It will be immeditely saved and user will return back to search. Just edit success submission text to inform user that request was submitted and user can check his requests in the other section.

Powered by Cobalt