Friday, July 29, 2016

IE Blocking iFrame Cookies

 IE Blocking iFrame Cookies :

 Today we will discuss about "IE Blocking iFrame Cookies".

I have faced a problem in my applications not running correctly from inside an iFrame. I tried it out and it looked like everything worked great in Safari and Firefox but not IE6 or IE7. It took me a few failed attempts to fix it before I decided it must be a session problem. After firing up a packet sniffer it became obvious the cookie with the session ID was not being passed.

The problem lies with a W3C standard called Platform for Privacy Preferences or P3P for short. You can read all about the boring stuff via the link or else just install the P3P Compact Policy header below. This will allow Internet Explorer to accept your third-party cookie. You will need to send the header on every page that sets a cookie.


PHP:

header('P3P:CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');

Thanks

Friday, July 22, 2016

How to implement shopping cart in laravel 5

How to implement shopping cart in laravel 5:

For implement shopping cart in your application we have to follow following steps:

1. In your composer.json file write the following code in require:


"gloudemans/shoppingcart": "^2.1",

then run command composer update.

2. In config/app.php write the following code.

In providers:
\Gloudemans\Shoppingcart\ShoppingcartServiceProvider::class

In aliases:
'Cart'            => \Gloudemans\Shoppingcart\Facades\Cart::class,

Now we can use cart in our applications

for add product in cart:
 Cart::add('293ad', 'Product 1', 1, 9.99);

 Here first parms is product id, 2nd is name of product, 3rd quantity and 4th is price of product

for update:
Cart::update($rowId, 2);

Here $rowId is a unique id product wise which is generate automatically.
2nd params is the quantity, which we want to increase.

for remove:
Cart::remove($rowId);

for check the cart:
Cart::content();

for destroy cart:
Cart::destroy();

for total in cart:
Cart::total();

for count in cart:
Cart::count();

Thanks

Friday, July 8, 2016

Updating Column Types with Laravel's Schema Builder

Laravel makes database migrations very easy with its Schema Builder. It has a lot of built-in methods to add tables, columns, indexes, etc. However, it's easy to forget that you can do so much more with just plain old SQL queries.

I needed to change the type of a column from VARCHAR to TEXT. Here's what I ran in a migration file:


public function up()
{
    DB::statement('ALTER TABLE flavours MODIFY COLUMN description TEXT');
}

public function down()
{
    DB::statement('ALTER TABLE flavours MODIFY COLUMN description VARCHAR(255)');
}  


I think this will make you little help.

Thanks.