+14 votes
by (100 points)

I want to create a function which takes store id and return a PHP array which have the store details like store name, store code, logo, banner, name etc.

10 Answers

+14 votes
by (100 points)

you can get a store details like this:

$store = Mage::getModel('core/store')->load($storeId);
$code = $store->getCode();
$name = $store->getName();

You can do this to see what data you can get from the store object

var_dump($store->getData())

The logo and other settings you need to get from the config section.

$logo = Mage::getStoreConfig('design/header/logo_src', $soreId);

This way you can get all the information from the config. You just need the correct path. For this you can see the name of the input field from system->configuration and section name and build the path.
Let's analyse the logo. You can find it in the Design tab and the url looks like this: 'admin/system_config/edit/ section/design '. So the first part of the path is the section name design .
The field name is groups[header][fields][logo_src][value] . Just remove groups , [fields] and [value] and you get the rest of the path header/logo_src .

+14 votes
by (100 points)

Try this it will work...

public function get_storedetails($store) {
     $res = array();
     try {
         $res["store"] = Mage::app()->getStore($store);
         Mage::app()->setCurrentStore($store);
         $res["storeid"] = Mage::app()->getStore($store)->getStoreId();
         $res["storecode"] = Mage::app()->getStore($store)->getCode();
         $res["storewebid"] = Mage::app()->getStore($store)->getWebsiteId();
         $res["storename"] = Mage::app()->getStore($store)->getName();
         $res["storeactive"] = Mage::app()->getStore($store)->getIsActive();
         $res["rooturl"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);            
         $res["storeurl"] = Mage::helper('core/url')->getHomeUrl(); 
         $res["storelogo_alt"] = Mage::getStoreConfig('design/header/logo_alt');             
         $res["storefrontname"] = Mage::app()->getStore($store)->getFrontendName(); //getLogoSrc()           
         $res["current_url"] = Mage::helper('core/url')->getCurrentUrl();
         $res["media_url1"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_LINK);
         $res["media_url2"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
         $res["skin_url"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN);
         $res["js_url"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_JS);          
         $res["storelogo"] = Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN).'frontend/default/default/'.Mage::getStoreConfig('design/header/logo_src');
         $res["storeadminname"] = Mage::getStoreConfig('trans_email/ident_sales/name');
         $res["storeemail"] = Mage::getStoreConfig('trans_email/ident_sales/email');             
     }
     catch(Exception $ex) {
         echo $ex;
     }
     return $res;
 }
+10 votes
by (100 points)

Your never set the variable fileName , so it's still the default value "" . Maybe you got confused by the fileName:=Vars.xlsFiles(i) of the Workbooks.Open method. That just sets the option FileName of that method. Use some unique name to avoid confusion and set it to Vars.xlsFiles(i) or use

Workbooks(Vars.xlsFiles(i)).close
+5 votes
by (100 points)

You are not including the column Name in your query. Change it as follows:

SELECT Name,Email
FROM customer 
WHERE Email LIKE '%SUBSTRING_INDEX(SUBSTRING_INDEX(' + Name + ', ' ', 1), ' ', -1)%' 
OR Email LIKE '%SUBSTRING_INDEX(SUBSTRING_INDEX(' + Name + ', ' ', 2), ' ', -1)%';
+4 votes
by (100 points)

You can do it without using plugins.

In the latest version of vscode that I'm using (1.17.0) you can simply open the branch that you want (from the bottom left menu) then press ctrl+shift+p and type Git: Merge branch and then choose the other branch that you want to merge from (to the current one)

+2 votes
by (100 points)

Use the overload of Task.Delay which accepts a CancellationToken

public async Task TaskDelayTest(CancellationToken token)
{
    while (LoopCheck)
    {
        token.throwIfCancellationRequested();
        for (int i = 0; i < 100; i++)
        {
            textBox1.Text = i.ToString();
            await Task.Delay(1000, token);
        }
    }
}

var tokenSource = new CancellationTokenSource();
TaskDelayTest(tokenSource.Token);
...
tokenSource.Cancel();
0 votes
by (100 points)

Converting the string to int is easy: start with a zero int , then go through the characters of the binary representation, and check if it is zero or one. First, shift the partial result to the left. Then, if the digit is one, OR the result with 1 . Continue to the next character. When you see null terminator '\0' , stop.

Here is some pseudocode:

res = 0
ptr = "00000000011101"
while ptr is not pointing to '\0'
    res <<= 1;
    if ptr points to '1'
        res |= 1;

Once you have your int , getting the last three bits is equivalent to AND-ing & the result with seven (its binary representation is 0000111 ). Getting the rest of the bits is equivalent to shifting >> the number right by three.

Here is some pseudocode:

lastThree = res & 7
topBits = res >> 3
0 votes
by (100 points)

According to this post , one possible solution is to use this to match the height of your columns.

Although writing html with just the Semantic UI classes in the code below:

 <div class="ui container">
  <div class="ui three column doubling stackable grid container">
      <% camps.forEach(function (e) { %>
        <div class="column">
          <h1 class="ui header"><%= e.name %> </h1>
          <img src="<%= e.image %>" alt="" class="image small ui">
          <p> <%= e.description %></p>
          <div class="extra"><div class="ui label">
            <a href="/campground/<%= e._id %>">Read More</a>
          </div></div>
        </div>
        <% })  %>
      </div>
  </div>

I realized that the columns are already with the same height as you can see here .

0 votes
by (100 points)

To provide a newer answer, using SQL Server Data Tools 2015, you can set the Deployment Target Version for your integration project to 2012, 2014 or 2016 (It defaults to 2016 and will result in version number errors on 2012/2014 DBs until you set it correctly). I successfully deploy SQL 2012 integrations now from SSDT 2015 after setting to "SQL Server 2012".

0 votes
by (100 points)

The footer take 100% of your body width. The problem is that the body has a default value for margin and padding, you can set to 0 with this :

body {
    margin: 0;
    padding: 0;
}
...