Cut string in php



<?php

// Example 1

$pizza  "piece1 piece2 piece3 piece4 piece5 piece6";

$pieces explode(" "$pizza);

echo 
$pieces[0]; // piece1

echo $pieces[1]; // piece2

?>


Kyle.

Categories: Prestashop | Leave a comment

Magento – Get the Current Category

1
2
3
<?php
    $currentCategory = Mage::registry('current_category');
?>

magento

Kyle.

Categories: Magento | Leave a comment

How to Obtain Custom Attribute Values in Magento

http://www.devinrolsen.com/magento-custom-attributes-value/

Categories: Magento | Leave a comment

Contact Form in Magento

As you know, Magento has a built-in contact form that can be used for general contacts. That form isn’t part of any CMS page, you cannot edit some introduction text, you cannot add phone numbers administration, and you cannot see the breadcrumbs. If you wish to edit text in that default contact form, you will need to update front-end files. Luckily, there is an alternative.

Note:You might notice that this is one of our oldest posts. Upon writing we made one error in the code that was never corrected. Now, this post article is updated and we have fully working instructions. Hope this will help.

If you are a developer, editing your contact form HTML is an easy task. You only need to open file:
app/design/frontend/default/[yourtheme]/template/contacts/form.phtml and you will find your way around.

Once there, you will basically edit the layout of this interface.

However, there are cases when you would like to give your client an option to edit some intro text, edit his phone numbers, edit text behind the form, etc. You are probably guessing that it would be nice to be able to embed contact form in some CMS page. No problem.

Go to your CMS> Manage Pages interface
Once there, input your HTML as you normally would on any other page
Once you are happy with HTML part, add this lines:

{{block type=”core/template” name=”contactForm” form_action=”/contacts/index/post” template=”contacts/form.phtml”}}

Important note: When you copy/paste the code, it is important to know that WordPress saves the quotes in some weird way, so you should replate the pasted quotes and reenter them.

You will notice that we added xml attribute form_action=”/contacts/index/post”. With it we set form action, and your contact form will work properly. Here is how it looks like. Notice the breadcrumbs.

From inchoo.net

Kyle.

Categories: Magento | Leave a comment

Adding a new language in Magento

As anything in Magento adding a new language is something that requires a certain procedure which we will explain right now and for future reference.

Follow these easy steps and enjoy your multilingual site:

1. Download the desired translation thru Magento connect via admin.
2. Once installed Go to: System -> Manage Stores -> Create store view. Enter the data and save.
3. Now go to: Configuration -> Current Configuration Scope (Select your language from the dropdown) and on the right side under “Locale options” choose the desired language.
Note: Be sure to clear the cache before trying to use your new language.

That’s it, now when you go to the frontend of the site, you’ll notice a dropdown menu allowing the language switching.

From inchoo.net

Kyle.

Categories: Magento | Leave a comment

How to Setup SSL in Magento checkout

If you are running a Magento store and taking credit cards , then you should get a SSL certificate to secure your checkout screen. This is how you should do it,
1. Get a SSL certificate and then ask your web host to set it up for your domain.
2. Goto Magento Admin > Configuration > Web .
The {{base_url}} should be changed to http://www.domain.com
The {{secure_base_url}} should be changed to https://www.domain.com
3. Switch on the other option below in that page, SECURE URLS ON FRONTEND.
4. Clear your cache.
5. Test on frontend. Add a product to the cart and then try to checkout. It should take you to https .

From learnmagento.org.


Kyle.

Categories: Magento | Leave a comment

No right click on image.

Add this code to head tag:
var message=””;function clickIE() {if (document.all) {(message);return false;}}function clickNS(e) {if (document.layers||(document.getElementById&&!document.all)) {if (e.which==2||e.which==3) {(message);return false;}}}if (document.layers) {document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;document.onselectstart=clickIE}document.oncontextmenu=new Function(“return false”)

Kyle.

Categories: Prestashop | Leave a comment

Related products, Up-sells, Cross-sells in Magento

There are three types of product relations in Magento: Up-sells, Related Products, and Cross-sell Products. When viewing a product, Upsells for this product are items that your customers would ideally buy instead of the product they’re viewing. They might be better quality, produce a higher profit margin, be more popular, etc. These appear on the product info page. Related products appear in the product info page as well, in the right column. Related products are meant to be purchased in addition to the item the customer is viewing. Finally, Cross-sell items appear in the shopping cart. When a customer navigates to the shopping cart (this can happen automatically after adding a product, or not), the cross-sells block displays a selection of items marked as cross-sells to the items already in the cart. They’re a bit like impulse buys – like magazines and candy at the cash registers in grocery stores.

Upsells
This is the example of the Up-sell. Ideally, the visitor is supposed to analyze those products as they should be relevant to the one that is just loaded.

From inchoo.net


Kyle.

Categories: Prestashop | Leave a comment

How to display product’s reference in category page PRESTASHOP

Add this code to place where you want show it:

{$product.reference}

Note:
Remember: add reference for product in admin.

Kyle.

Categories: Prestashop | Leave a comment

How To Show Available Quantities in Magento

Magento has the ability to globally manage inventory levels for your online store. A number of client’s business model was to sell inventory that they picked up from a distributor and therefore didn’t need to manage all items. They did have situations where they purchased items by the case and wanted to to show how many items are left back in stock.

To set and show how many items are left in stock, do the following:

Open app/design/frontend/default/template/catalog/product/view.html
Open app/design/frontend/default/template/catalog/product/list.html (for category page)

Add the following code to the page where you want to render the available stock message:

Kyle.

Categories: Magento | Leave a comment

Blog at WordPress.com.