Social Icons

twitterfacebookgoogle pluslinkedinemail
Showing posts with label PHP. Show all posts
Showing posts with label PHP. Show all posts

Sunday, 6 August 2017

Share Facebook and twitter in magento

Hello Friends,

This article is use to share your product in facebook and twitter. Here is the simple code to add into app/design/frontend/<theme>/<theme>/template/catalog/product/view.phtml

Please check first your theme path and also detail page file. here is the default path
 app/design/frontend/base/default/template/catalog/product/view.phtml

You can find file path to enable path hint from back-end.

Add below code and save the file

<?php $_productName = urlencode(trim($_helper->productAttribute($_product, $_product->getName(), 'name')))?>
                    <?php $_productImageUrl = urlencode(trim($this->helper('catalog/image')->init($_product, 'image')))?>
                    <?php $_productUrl = urlencode(trim($_product->getProductUrl()))?>
<?php $_u = 'p[url]=' . $_productUrl . '&p[images][0]=' . $_productImageUrl . '&p[title]=' . $_productName . '&p[summary]=' . urlencode(trim($_helper->productAttribute($_product, nl2br($_product->getShortDescription()), 'short_description'))); ?>   
                    <div class="social-links" style="float: right;">
                        <a href="javascript:void(0);" title="<?php echo $this->__('Share on Facebook') ?>" class="link-facebook svg-replace" onclick="window.open( '<?php echo 'http://www.facebook.com/sharer.php?s=100&' . $_u; ?>' , '_blank' ,'height=500,width=500'); return false">
                            <img class="fb-icon" style="" src="<?php echo $this->getSkinUrl(); ?>images/social-fb-icon.png" alt="Share Facebook" />
                        </a>
                       
                        <a href="javascript:void(0);" target="_blank" title="<?php echo $this->__('Share on Twitter') ?>" class="link-twitter svg-replace" onclick="window.open( '<?php echo 'http://twitter.com/home?status=' . $_productName . '+' . $_productUrl; ?>' , '_blank' ,'height=500,width=500'); return false">
                            <img class="twitter-icon" style="" src="<?php echo $this->getSkinUrl(); ?>images/social-twitter-icon.png" />
                        </a>
                    </div>

Notes: This code will help you in core php, WordPress, Drupal, Joomla and other framework also you just need to setup parameter and it will work.

Thank you,
Enjoy Your Self,

Saturday, 14 March 2015

wysiwyg editor remove allowfullscreen from iframe in magento

Hello Friends,

Today  I want to saw you that how to add "allowfullscreen" or other attribute in TinyMCE for iframe.

Basically i want to allow "allowfullscreen" to TinyMCE html editor for magento and I also searched this on Google but not found the any solution. so i start to check the tiny_mce.js. and i got the one code and add this attribute in that code. let me share the code for you. so, you can fix this issue yourself.

I tried this for the magento Tiny_Mce but i think this for all framework and cms.

Tuesday, 20 January 2015

How to add select dropdown in magento registration page for Date of birth field

Hello Friends,

Today i want to know you that how you can add to convert textbox to select dropdown for date of birth field on registration page.

you can not add the dropdown in magento registration form for date of birth because its working on textbox and it update those value in
<input type="hidden" id="dob" name="dob">

without it we can not store the DOB in magento db.

Here is the simple way to integrate dropdown in DOB.

Saturday, 20 December 2014

How to create log file in magento

Hello Friends,

Today, i want to see you how to create log file for the debug in magento.

I search on google so many times to find perfect code for the create log file in magento but not got it.
So i plan to check in magento code and found one code for this so, here i mention one code to generate log file in magento.

Its always use to debug the code when you are working on live site. so its easy to debug the code.

Just copy below code and paste on your file where you want to debug and you can get the log file. it's just one line code


Saturday, 22 March 2014

shippng method and shopping cart not working in magento 1.8.1


In magento 1.8.1, there are the following issues and how to solve it.

When we are add to cart the product and  proceed for to checkout then that time shipping1 method not working because of the ajax not the loading any content from js.

I have fixed for that the copy the

Wednesday, 12 March 2014

Display Left navigation on product listing page in magento



Hello Freinds,

If you want to display the left navigation bar on product listing page in magento then please follow the following steps.

1. First of all you need to create/use local.xml from your current theme like

   app\design\frontend\default\default\layout

2. Now you need to just write the code like


Friday, 28 February 2014

How to Create Randon Number in Magento?

Hello, friends

In magento it is possible that the we are generating  Random number through the following one line code:

Use getRandomString() method and generating random number. In getRandomString() method we pass the number till we get the random number from to 0.





Ex : if we pass the 5 number in gerRandomString() method then it will fetch rendom number from 0 to 5.

Saturday, 26 October 2013

fatal error call to a member function getusername() on a non-object in magento

Hello Friend,

when you get like this error "
Fatal error: Call to a member function getUsername() on a non-object in .../app/design/adminhtml/default/default/template/page/header.phtml on line 31".

Please  follow the steps


  1. Backup the var folder as (var-back)
  2. Create a new var directory
  3. Backup the locks folder as (locks-back) {if available}
  4. Create the locks directory



Thanks
Enjoy Your Self,

Friday, 11 October 2013

How to create Zip file in php

Hello Friends,

You want  create ZIP file in php using programming...

its possible using following.


Thursday, 10 October 2013

How to Alter , create new table, delete or update table using upgrade script in magento



Hello Friends,

You can perform database query in magento upgrade script.

you are facing problem with alter,update,delete or create new table in magento but its very easy just write defined code in your upgrade script and you can see your table is altered or insert
create or delete

you must create script for this like beloved name

Name of file : 

syntax : mysql4-upgrade-<old_version>-<new_version>.php
 
Ex : mysql4-upgrade-0.1.0-0.1.1.php

Now you have quesion is that how to find it rifgh?
but it also easy   please open your config.xml file of your module and check the version which is your old_version.

syntax for create , alter and delete table




<?php $this->startSetup()->run("<write your query>")->endSetup();?>

code for ALTER Table

<?php
$this->startSetup()->run("
   ALTER TABLE {$this->getTable('faqs')}
   ADD COLUMN `preview` text AFTER `steps`
")->endSetup();
?>

code for Create New Table


<?php
$this->startSetup()->run("
  
DROP TABLE IF EXISTS {$this->getTable('mytable')};
CREATE TABLE {$this->getTable('
mytable')} (
`entity_id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`content` varchar(255) NOT NULL default '',
`status` smallint(6) NOT NULL default '0',
`created_time` datetime NULL,
`update_time` datetime NULL,
PRIMARY KEY (`entity_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

")->endSetup();
?>

code for DELETE Table
<?php
$this->startSetup()->run("
DELETE from table_name where column_name = value
")->endSetup();
?>


code for UPDATE Table
<?php
$this->startSetup()->run("
UPDATE table_name set column_name=value where column_name = value
")->endSetup();
?>

Thanks,


Enjoy Your Self


Sunday, 25 August 2013

What is PHP?

      

PHP was originally an acronym for Personal Home Pages, but is now a recursive acronym for PHP: Hypertext Preprocessor.

PHP was originally developed by the Danish Greenlander Rasmus Lerdorf, and was subsequently developed as open source. PHP is not a proper web standard - but an open-source technology. PHP is neither real programming language - but PHP lets you use so-called scripting in your documents.

To describe what a PHP page is, you could say that it is a file with the extension .php that contains a combination of HTML tags and scripts that run on a web server.

Tuesday, 13 August 2013

Get the width and height of an image using a function in PHP

<?php

list($width,$height,$type,$attr) = getimagesize("image_name.jpg");

echo "image width " . $width;
echo "<br>";
echo "image height " .$height;
echo "<br>";
echo "image type " .$type;
echo "<br>";
echo "image attribute". $attr;
?>

Sunday, 18 March 2012

Difference Bettween Include(),Include_once() and Require() in PHP

Include () will include the file specified.
Include_once () will include the file only once even if the code of the file has been included before.
Require () and include () are the same with respect to handling failures. However, require () results in a fatal error and does not allow the processing of the page.

 

Free Advertisement

Free Advertisement

Free Advertisement

Free Advertisement