I can track customer data using
$this->customer->getFirstName();
$this->customer->getLastName();
$this->customer->getEmail();
this way,and is there any similar way to track store data like email, store name
eg: like this $this->store->getEmail(); (this is not working)
Use the following:
$this->config->get('config_name'); // store name
$this->config->get('config_title'); // store title
$this->config->get('config_owner'); // store owner name
$this->config->get('config_email'); // store email
Related
I'm using the following code to get store name in a reminder email sent by admin.
$storeName = Mage::getModel('sales/order')->getStore()->getName();
However since the email is sent via the admin the store name is coming up as Admin and not Widgets.com.
How do I get it to insert the Store Name?
Try this:
$store = Mage::app()->getStore();
$storeName = $store->getName();
If you still have access to the quote (during order creation)
Mage::getSingleton('adminhtml/session_quote')->getStore()->getName();
To get the store name by order store id
Mage::app()->getStore($order->getStoreId())->getName());
Im having a problem showing the current viewed contact name in SUGARCRM
can anyone tell me how to get the current contact name, lets say i am browsing a contact in SUGARCRM called jhon i need a PHP piece of code to get this name and store it in a variable.
I already tried this:
global $current_user; echo $current_user->user_name;
but not that is what i am looking for, I am looking for something like this to be able to get the current contact name.
Try to access the full_name property. $current_user is an instance of User bean
$current_user->full_name
If not working try to retrieve user details using bean id of current user :
$user = new User(); //user object
$user->retrieve($current_user->id); //retrieve user data
$full_name = $user->full_name; // If have full name property.
If no full name property try to concatenate last name and first name
$fullname = $user->first_name .' '. $user->last_name;
If you're on a contact record, then the .tpl file needs to have the property name of what you want to show. Your question says name, so try putting this in the file where you want it:
"{$fields.first_name.value} {$fields.last_name.value}"
I have a form that saves text into the MySQL database. The user does not need to register to save that form. How do I make it so that when someone submit's a form, it will display their text that THEY typed in a saved. I want it to be able to retrieve they're text that they submitted at that time and possibly give it a link like this: http://www.example.com/text115612 (the numbers are for different texts...) and make the retrieved text display on that page?
When the user submits the text, you can save the text together with an ID, in your example text115612.
After they've submitted, a server side script will redirect the user to the newly created text (Serverside, because the user can't predict what the ID will be).
If you wish to make the texts a little more private, you can make a harder ID so it's not possible for people to guess it.
What you need to do is retrieve the text and create new file
with unique name
$userttext = $textfromdb // get the user text
$file = fopen('text_file_name.txt','w') // open a new file
frwite($file,$textfromdb); // write to the file
fclose($file); // close the file
$link = "http://website.com/"."text_file_name.txt"; // create the website link
When user submits the form, you would do something like this.
//insert your text//
INSERT INTO table_name (text) VALUES ('text');
//get the primary key that was just inserted//
//column must be auto-increment//
$textid = SELECT LAST_INSERT_ID();
//you can also do this directly in PHP//
$textid = $mysqli->insert_id;
echo "http://www.example.com/" . $textid;
I want to set a cookie in Codeigniter whenever the user clicks on "add to my favorites". But I'm confused. Because I have to add several items with one name at the same time. You know this is not possible and the CI overrides the previous values. Look at this:
$this->input->set_cookie(array("name"=>'fav', 'value'=>2500, 'expire'=>100000));
$this->input->set_cookie(array("name"=>'fav', 'value'=>3500, 'expire'=>100000));
$this->input->set_cookie(array("name"=>'fav', 'value'=>4500, 'expire'=>100000));
And when I try to get fav value using this function:
printer($this->input->cookie("fav"));
I get this result:
4500
How should I set a cookie for user when they ad an item to their favorite list so that in the moment of retrieving them I know what to retrieve. I cannot use database because this implementation is for the users who are not registered members.
You can use $this->session->set_userdata for storing values.
$fav = $this->session->userdata("my_favs");// get existing list
$fav[] = $new_fav; // append new items to list
$this->session->set_userdata(array("my_favs"=>$fav)); // update session with existing one.
To print all items
$fav = $this->session->userdata("my_favs")
foreach($fav as $fitems)
echo $fitems."<br/>";
I think you should use print_r() instead of printer().
more than that, you should use:
$this->input->get_cookie("fav");
Have a look here for more information: Cookie helper
We have a multi-store set up and I wanted to change the template slightly for each store. I had a good look through the code already in place and found these:
$this->config->get('config_store_id')
$this->load->model('setting/store');
$results = $this->model_setting_store->getStores();
$this->model_setting_setting->getSetting('config', $order_info['store_id']);
The first line only ever returns the default store ID. I would want this to work even if we have not order details.
What is the most reliable way to get the store ID?
The current store ID is in $this->config->get('config_store_id')
It gets changed to the correct store ID in this code in the index.php file
if ($store_query->num_rows) {
$config->set('config_store_id', $store_query->row['store_id']);
} else {
$config->set('config_store_id', 0);
}