In order to implement a custom promotion unit I would need to know the specific amount Facebook will be giving the user for free.
Is there a way to determine the value of the current Facebook offer?
Custom PP Unit Reference
Related
I have got an architectural question. Where should I check user permissions for certain operations?
For example:
1) In a controller, I get parameters from view and start a process in the intermediate model.
2) Intermediate model decide which parameter should be converted and transformed in any way and modify or create data through Models
3) Model communicate directly with DataBase
Where do You think is the right place in that "architecture" to check privileges to for example save sth to database?
I would actually put the authorization check before the controller is being called, kinda like described here (I really need to update that old post). Preferably as a decorator around the controller instance, which would give you a fine-grained control over what operation user is permitted to do, based on controller+method pair.
Another point where you might think about is "authorization lookup" helper function for use in your templates, because you might need to show or hide some UI elements from users, who should not be able to perform the associated operations. The controller+method check, before execution would still work as the actual safeguard then, but it tends to be a quality-of-life improvement.
You should not put the authorization checks inside the each controller or (even worse) model layer, because that tends to promote an excessive amount of copy-paste, which in turn can cause mistakes and becomes a huge problem, when you want to alter the mechanics of your authorization system.
Is it possible to set a cookie (for my domain) that is tied to a certain user across devices, somehow using the cross-device capabilities of Universal Analytics?
I don't need to know who that user is, just that it's the same person on a different device.
I know I can use Custom Dimensions (formerly Custom Variables) to assign an arbitrary value to a user/session but I need to be able to read it's value. It's a boolean value I need to store so even the fact it exists would be enough.
I hope I've explained clearly but if not let me know!
I'm building a magento (1.9CE) store which needs to interface with another system and I could use some guidance.
Although not particularly relevant, I'm communicating with the 'other' system using web services (it's on another server) but what I need help with is finding the places where I need to put in code to do what I want.
There are three major functions that I need to implement:-
When a user clicks on the product detail page I need to make a call to check the stock levels on the other system, update the magento stock levels and THEN display the product detail page.
When a sale is completed, I need to send details of that sale to the other system.
When a new product is added I need to communicate with the other system. This may be a bit more complex because there are a few checks I need to do during the 'add product' process, for example, check the SKU is valid, that tghe product doesn't already exists, etc. I think until I start coding this I shan't realise the full extent of this functionality!
Any guidance gratefully received!
Even though this might (and probably will) dramatically slow down your store, if you want real-time information, I guess the easiest way would be with observers.
You can use catalog_controller_product_init_before: This will trigger when the product detail page is starting loading, so you should be able to upload the stock at this point, before the page has finished loading, so that if there is no stock it will not be buyable, which I guess that's what you want.
You can use sales_order_place_after: This will be triggered after a new order has been placed and saved in the database.
You can use catalog_product_new_action or catalog_product_save_after: Depending on how you create your products the first one might not be triggered. The second one will always be triggered once a product (new or existing) has been saved, so at this point you will need to check if the product is new or existing, and do your stuff depending on that.
For an example of how to create an extension and usage of observer events, check this out.
I hope it helps!
So for my documents, i have a type property that defined them. And almost for all of these 'types', I have to have a 'get by type' call..
Now the question is which one of these design is more efficient;
Have a single view that has a key with the 'type' that maps all of the documents
Have a view for each 'type' that just maps those types, and I can query the view to get all the documents in the view?
It depends from how many "types" you have in your db. If few - go with "view per type" approach and you'll be fine and have nicer API URLs.
However, when you'll have around 70 types (my case) of documents within single database it would be too oblivious to understand that this approach isn't work anymore and you need one single view to filter docs by type - you'll never forget to add your special view for new doc type, you don't need to cleanup outdated views. As bonus feature, having single view allows you to retrieve docs of multiple types with single request and have only one replication task that syncs multiple types of docs between databases. Same is true for every other fields that are common for a every or most part of docs (like author, updated_at etc.).
Final decision is yours, but better to take the way that will free you from additional work and one additional query parameter is not much higher cost to have relax.
I think the latter is best. Have a view for each type that queries/filters for that particular type. This allows you, from the Futon views drop down, to very quickly display lists of docs of the particular type(s). Almost like you're looking at "tables". But not really ;-)
MSCRM 4.0
When writing plugins, I have assumed that the required fields will always exist either in the Target image or the PreImage image.
But recently when coding an external application that consumes the CrmService, I realised that the service will allow a business entity (or dynamic entity) to be created using the 'Create' method, even if the required fields do not exist or contain a value.
Is this the case? Is there a way to force required fields when calling the Update method of the service? Does anyone know why this may not be the case? Can anyone shed some light on the issue? Will I have to manage these required fields myself?
There is no validation. That's why we need to make sure that those properties are filled properly with the valid value.
Proper validation rules need to be enforced at PreCreate event, so that you can throw InvalidPluginExecutionException to notify users that certain mandatory properties are not filled properly.
No, there is no validation. For standard entities you can look for platform required fields - these are required. But generally they're limited to things like the business unit on a report or something - rare cases. If you want business validation you will need to add it into the Pre-Create/Update plugin.