ReactJs how to dynamically render a page based on user selection? - reactjs

I'm trying to build an E-commerce shop and using the rule "Don't repeat yourself", I have a data.Js file that contains an array of objects - each object is a corresponding watch (has name, ID, price, description and other details). I have all the watches displayed on the homepage, like this:
What i want is:
When a user clicks on a specific watch, to then be taken to the product page that corresponds to the specific watch (I.E. get populated with data matching the correct object, with {item.id} and {item.title} and {item.price} and etc.
How can I do this so that React knows which watch the user clicks and how to populate the product page with the correct data?
Thank you very much in advance!

Related

Salesforce Screen flow search and display record information

I'm working on a screen flow. The idea is to have a lookup component the user can search a contact. Then I would like to display the information from the Contact (Account Name, Contact Name, Number Email) and I would like to be able to have the user update that information if needed. I just stomped on how it can be done. I know it should be able to be pulled from the record ID in some type of way and maybe use an Assignment to display the information. Can someone guide me on a next step or if anyone has an instructional video would be helpful.
Thanks
You wouldn't be able to display the looked up contact's fields on that screen as soon as you populate that field. That would be something only possible in code (aura component or lwc).
What you can do, however is -
Get Record element after that screen element. (Get Contact, where Id = lookupcomponent.recordId)
Then EITHER:
use the new Fields (BETA) option on another screen Fields (BETA)
(this method is easier, doesn't have as much control and is limited on fields, depending on data type, you can use)
add inputs one by one and set the default values Add Fields One By One
(this method allows more control)
Then, you will need an update element. If you used the Fields (BETA) you can just update the record variable. If you did the inputs one by one, you will need to update the contact and set fields individually.
Full Flow Example

Extract data from the dom into my model

I have a searchfield that when used shows multiple results (search for Star Wars and you get about 6 results in a list form). Every result has a "add movie" button which when clicked should save the data of that movie into my rails model.
I want to use Backbone to get a dynamic view for this process, so that when the movie is added it shows instantly without refreshing. The easiest way to do this would be to extract the data from the HTML (title, image-url) from the selected movie and store it into my model.
I've checked the Backbone model documentation, and I've already did the codeschool Backbone.js course, but still I find it hard to get started. Can someone point me in the right direction?

Drupal 7 displaying different user content

I have searched and searched and cannot find a solution to my specific problem...
I have a site that users join, and can upload their own videos. I crated a specific video type to handle this upload.
Other users can log in and see this content, they get to the content by clicking on a "profile" link for a specific user, and then it should display all the videos that user uploaded. Currently all I can get to work is display ALL of that content type, or none... I cannot figure out how to just get the user being looked for.
In my URL i have the user name being sent, because other info on the profile page that loads is driven off of that ( looked up in mysql tables and displayed with PHP).
As I mentioned I have a filter that limits to playervideo ( which is my content type) and that works, but as mentioned it displays all not just the user I am looking for.
any help would be much appreciated!!
thanks
I think your question is "How do I make a page for all users that lists content authored by a specific user"
I'd do this with the Views module.
Add a view for all your nodes.
Then add a "relationship" for "Content: Author".
Now add a "contextual filter" for the field "user: uid" with a default argument the userid from the URL.
Or you could try to add a contextual filter of "Content: User posted or commented" with the default value as the UID from the URL.
Cheers!

Prestashop : Save additional field from product page in database

I have Added 2 text box in product page to recive height an width from user for each product.
I have used textbox input just like quantity in The buy-block Form.
Now I want to save this textboxs in Database and use them in cart page and order page for each cart and product.
I added 2 variable in cartcontroller.php like $qty in function preProcess() .
Now how can I save them in DB?
If I understand, you want your customers to submit custom values along the product they order.
In this case, you should look for "product customization" fetaure of PrestaShop :
http://doc.prestashop.com/display/PS15/Adding+Products+and+Product+Categories#AddingProductsandProductCategories-ManagingCustomization
You can add textbox on product page, customers will type values, these values wiil be displayed on cart and order detail.

Sales-force Custom Object Edit page layout and Button

We have a custom object say Sales form. On edit apge of customer object we need to add a button Save and Add Product(similar to One we can have on Opportunity page). User forget to add Product/SKU after saving the sales form
New Button(Save and Add product), will save the sales-form first and then depends on record type will open the related list(child object).
Say a Sales form is for Custom Program, after save,. it will open up Custom Program relate list.
If Record type is of Price Change Notification it willl open up related list of SKU detail..
Is this possible, please adivse, we have 9-10 different record type, and we don't want to re-write the application with visualforce and all customization. Re-writing with Visualforce page has some pitfalls.
As far as I'm aware, you can't replace the Save button as it's part of the Edit page and not the standard layout, so to achieve this with one button you'd need to write a custom visualforce page, this need not be complicated though — a simple custom controller which uses a standardController for management of the record would suffice.
You would call Save on the StandardController and then return a different page redirect based on the record type, the page itself would pretty much only consist of an <apex:detail> tag. If you want more details I can provide more.
If you really don't want to write any custom code or pages then you'll need to do this as a two step process, i.e. use the standard page and then have a custom "Continue" button which takes the user onto a custom URL based on the record type. I've just created a contrived version of this by doing the following:
1 - Define a custom formula field on the object, this should be of type text and can use a CASE() statement to determine the URL which the user will be taken to when hitting the button (note that this was made just for the sake of an example so it forwards to the accounts standard page for the record type 'Friend' and contacts page for 'Foe').
CASE($RecordType.DeveloperName, 'Friend', '../001/o', 'Foe', '../003/o', '')
Note the reason I use a formula field here instead of the doing this in the custom button is that for some reason you can't seem
access the record types by name when defining a custom button.
2 - Define a custom button for the object called "Continue" or something similar that makes sense for you. For my example I just used the Contact object, so I referenced the custom field on my record and specified the options shown here:
3 - Customise the page layouts used by your record types to include this new button and you should be done!

Resources