I'm developing an ecommerce website. Now, at the homepage, i want to put the preferred country. When the customer choose their preferred country, the list of product shown to them was from that prefered country only.
My database (products table has id, name, description, color, SKU and country_id)
Anyone has idea about this. I already check for global variable. But its like declaring in core.php or bootstrap.php. I want it to declare at my homepage when customer choose the country.
Please somebody help me. Thanks in advance ;p
I think "Magic Find Types" is a good place to start. You get this functionality automatically from your product Model class.
http://book.cakephp.org/2.0/en/models/retrieving-your-data.html#magic-find-types
Inside your controller, all you probably need to do is type something like this. It also has optional arguments for sorting and result set limiting. Of course, how you retrieve the preferred country is dependent on your application (browser cookie, logged in user profile etc).
$this->Product->findAllByCountryId($countryId)
If your user selects a country, store it in a session or cookie. If you want to be really efficient, you could have users select their preferred country on sign-up and store that in their profile record in the database, and set a configuration variable when they log in.
Related
I want to create a skill which is persistent between several users within an household.
For example, if user A says something, save it to the DB so user B (within the same household) can query it.
Is there a unique ID for that?
A solution I thought about is asking the users for an household name and use it along with some global incremental int as primary key?
You could have multiple skills, each with a different activation name, but linked on your backend to the same account. By using the different skills, the user is identified.
This is how I handle my personal household skill to distinguish between my preferences and my wife's.
From a commercial perspective, you'll need a name or set of names that make sense as a group and your brand.
How to create a dependent pick list in sales force?
Requirement:If I click on Country option then state will be display and then if click state then city should be appear...later it should be save a contacts that particular city...Is there any possibilities is there using salesforce admin
Assist me I am new in sales force
For your purposes you can use Dependent Picklists functionality. Also look on Dependent Picklist considerations for understanding of limitations of such approach.
I am looking for a way to compare two views in salesforce. I want to create a visual force page that lets a user select two views associated with the Account object and show all the accounts that appear on both views.
I am struggling pretty hard here, I can't figure out how to get the results from the views, but I am hoping there is a way to get all accounts that match the filters for each view.
Here is my SOQL query:
Select Id, Name, Owner.Name FROM Account WHERE
Id IN ( SELECT AccountId FROM Opportunity WHERE RecordTypeId = :RecordType1ID AND StageName IN :StageOneList )
AND Id IN ( SELECT AccountId FROM Opportunity WHERE RecordTypeId = :RecordType2ID AND StageName IN :StageTwoList )
This is the basis of the VF page I have made so far. It is possible to filter the Account with Account Owner and a drop down list from province. The idea is, many people in the organization have already created views with the accounts filtered as they need it. Instead of including every possible account field as a filter, I would like a drop down list of the active users views associated with Account, and then they can select Opportunity 1 and Opportunity 2 and have a list of Accounts matching.
I assume you mean views as in the available views in the dropdown box on a standard tab for an object? If so I don't believe you can query the results from them directly although you can query the Account object using a SOQL statement where you provide the filter.
My suggestion would be either create a set VF page that has 2 drop downs to switch the SOQL query that is used to return the list of accounts being displayed (would mean you have a set of predetermined views and updates to them require code updates) or give more details of your use case and we may be able to provide other suggestions.
It sounds like you just need to compare the results of the filters here. My suggestion would be that you're really trying to do something that should be done with reports, not with views.
Put two enhancedList components on the page.
I'm trying to write up a user management app, but getting confused about how to structure the database properly.
I think the database design would be structured something like this:
Users
user_id
first_name
last_name
email
Accounts
account_id
ldap_access
drupal_access
billing_app_access
facebook_access
Notes
note_id
description
date_added
And I believe the mapping would go like this:
One user can have one set of accounts (1:1)
One set of accounts can have many users (1:m)
One set of accounts can have many notes (1:m)
Many Notes can have Many Sets of Accounts (m:m)
Is this the correct way to structure the database? I'm really confused since I would like the applications fields be a boolean true/false for that particular user. (If they have an account on there or not), and the notes would correspond to EACH of the fields within the Accounts database. (ie: note_id:1 would correspond to user johndoe, application: facebook, note_description = "user no longer has facebook")
Does this make sense?
Any help would be greatly appreciated!
Mayby something like this:
I still don't understand all your needs.
I prefer this design (used in many system like Windows or Oracle)
Table
User
User-Role
Role
Access
Application
Note (still wonder what this for)
Role useful if you have many user with similar characteristic.
I'm just getting started with the Salesforce Web Services API and I'm surprised that there isn't an obvious way to do a query for all e.g. Account objects that contain certain tags.
What would you say is the best way to find all objects that contain certain tags?
I imagine it involves a join on Account.id and AccountTag.id or something similar, but despite some real research, I'm not sure how best to solve this problem.
Thanks in advance!
Update: I guess I could do a select from AccountTag and then get the account objects based on ItemId, but the ideal would be to do a query on Account, with Tags being only one part of the criteria.
You can use the SOQL-R style queries to do this, e.g. this will fetch the account Id and account Name for all the accounts with the internet tag.
select item.id, item.name from accountTag where name='internet'
in this case the item relationship is to the account that was tagged, so you can select any field from the account object through the item relationship path.
See the SOQL-R docs for more info