Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom create with pre-defined Select by parameter #91

Closed
fauzandx opened this issue Aug 23, 2016 · 2 comments
Closed

Custom create with pre-defined Select by parameter #91

fauzandx opened this issue Aug 23, 2016 · 2 comments

Comments

@fauzandx
Copy link

Can I create custom page for 'specific product' (auto select the product) so I don't need to choose product every time I create new image?

For example, I have 2 model from "Product" and "Image":

products:

  • Shirt (id = 1)
  • Dress (id = 2)

images:

  • Image A (for Shirt)
  • Image B (for Shirt)
  • Image C (for Dress)

Normally, I would create new image from "../public/admin/image" page
--> then create new image in "../public/admin/image/create"
--> choose the product
--> browse image
--> save

But I want to create new image directly from "../public/admin/product" page
--> choose product (dress)
--> then click a link like "add new image" and go to "../public/admin/image/create?productId=2"
--> browse image
--> save

Is there a way for me to make the product be auto-selected or cannot-be-changed when I used parameter create?productId=1 or do you have alternative way?

@tabacitu
Copy link
Member

If I understand correctly, shirts have 2 images, dresses only has one image. You want to show the right inputs depending on the product type (2 inputs for shirts, 1 for dress). If so, you can do that using a custom field type. You can create a new field type only for your project (let's say product_images.blade.php) that has some javascript in it. Depending on the product type (selected above) it would show the right inputs.

Does this answer your question?

Cheers!

@fauzandx
Copy link
Author

Yes, it's works ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants