Show only active records in lookup - CRM - dynamics-crm

I have custom entity which has lookup to the Products entity record.
I want this field to show only active(status) Products.
How can I do this? am I supposed to make new lookup view in Products, change existing one, or something else?

You should pick the view you'd like to render the records from. Navigate to form customizations, and edit the field property to look like below:

Related

create and update field to other model backpack laravel

I am trying to create a dashboard to display a specific table and create/update the lines for this table via backpack laravel.
For example I want to display a table of area and this table has a relationship with the cities table.
my problem is when I want to add a specific area and the city associated with it is not added !!.
That I do not want to go to add the city then back to add the area.
This is a very small example of what I'm really dealing with ,
since I want to add a line in a table and this line contains relationships with other tables I want to create on the same page.
I searched and did not find a direct answer. Does it make sense that a new view should be created?
Does the Backpack Laravel not provide a solution to this problem?
If the answer is no and this is what I saw, what is the best solution to this problem ?
Image to summarizes the problem as I want to create the city on the same page as creating the area
I think what you’re looking for is what we call the InlineCreate Operation in Backpack. It adds a “+ Add” button next to the relationship field, so that the admin can add a related item right there, in a modal.
Check out its docs here.

Laravel nova on action show page to get data from various field from user

I have one resource (User table) for which I need to perform some action.
However when that action selected I want to pass too many additional fields and selection is dynamic.
For example, if I select any user and click on action then in action I should select a category from DB and based on that category I need to get subcategory and based on that subcategory I want to get some seller on action page in Nova...
Is there any way i can do this.
I think Action Fields might help you with that. You can add additional nova fields to your collection of models before handling them in the action.
Hope that this can help: nova action fields
you can use this great NovaPackage
https://github.com/epartment/nova-dependency-container

Display products against attributes in magento

I am working on custom module in magento.
I create two new attributes (combo box) make and location. After that I add values for these attributes using custom code against specific product. Like I add make "Sony" and location is "Australia" against product 1 (1 is id for product).
Now on admin side i want to display this product with attributes values like make is Sony and location is Australia and product is 1.
I found some tables where these values are linked like (catalog_product_entity_int,eav_attribute,eav_attribute_option,eav_attribute_option_value), but I am unable to query such records. The page where I want to display data I have attribute id and attribute code.
Can anyone knows how I can figure it out?
Very simple Dude.
inside your _prepareCollection() method of your custom module grid
Load the product collection and select these two attribute... If there is a need to filter it by these two attributes then do it.

Magento: Category product design update not applied to search result products

I'm using a design update XML applied to all products under specific categories. The update is applied successfully to those products when browsed to them from those categories, but not when those products are opened from search results. How can I make the design update affect those products when opened from search results?
You need to add a layout handle that you can "grab" for each one of these products and modify the layout through layout xml files.
The key to this process is in the initProductLayout method of Mage_Catalog_Helper_Product_View. This method is where custom layout handles are added based on the product model. You can grab the layout update object from the controller and call addHandle() on it with a string to add that handle. So you'll want to rewrite this method and do something like this:
$update = $controller->getLayout()->getUpdate();
foreach ($product->getCategoryIds() as $categoryId) {
$update->addHandle('PRODUCT_IN_CATEGORY_' . $categoryId);
}
Now, in a layout xml file you can target the <PRODUCT_IN_CATEGORY_##> handle for the ID of your category(ies) and any layout updates you put here will be applied to the product view page no matter how it is accessed.
Depending on the specifics of your installation, it may make more sense to key the handle with some other category identifier, like the name or URL key, instead of the numeric ID. For this, use $product->getCategoryCollection() and iterate through the collection to grab what you need. You may also want to use $product->getAvailableinCategories() if you want to include only category IDs that the product belongs to directly (instead of including categories of higher parentage).

Do I need a model or view model? MVC 3

I have a pretty standard scenario where I have a model which in this case is a product.
The product model has a load of properties such as price, desc etc which I want to display on a view.
I have this working fine.
The product has a list of accessories objects which get displayed on the view and gives the user the ability to enter a qty for that accessory.
When the user clicks add to basket I only actually need the list of accessories and the id of the parent product.
Should I be creating a view model that contains all the product info I need or do I just pass my view the product and then on submit just get a view model for the few fields that I need in the signature of the function?
I'm new to mvc in case you hadn't guessed!! and I am using MVC 3.
Using a separate view model is better practice as it means you can add extra information outside of the Product which may be relevant such as Basket and User info. If you have many fields on the product then you can use Automapper to take the relevant fields and map them to the view model. Also you can flatten the model if necessary and make serverside queries which fecth all of the model's related items such as Category info etc.
Take a look at Automapper here:
http://lostechies.com/jimmybogard/2009/01/23/automapper-the-object-object-mapper/
once you start using it you won't look back.
The academic way would be to crete a separate ViewModel class with just the data you need in the view.
But when you are comfortable with ignoring the extra fields in your class i think its absolutely ok to use your Product model class in the view.

Resources