How to create own custom block template in cs cart - cs-cart

I am new to cs cart so I need cs cart community's help.
I need to understand how cs cart existing blocks (eg: product showcase block) are working and need to create custom cs cart reusable block.
Points which are not clear :
1.) what controller or PHP code we'll create.
2.) Controller or PHP code will call to which tpl.Simply how to pass php data to block tpl.
3.) At minimum How many files do we need and what will be there location.
So to sum up I need to develop a custom reusable cs cart block in which I can create logic in php code and design in tpl.
All type of suggestions will be appreciated.
Thanks in Advance.

Have you read the knowledge base articles on creating addons? If not, that's a good place to start. It will also help with use of terminology. A "block" in cs-cart has a very specific meaning and is a template that can be incorporated into the block manager.
I think what you're looking for is the overall structure of an addon (I.e. a controller).
Too much to articulate here overall, but if you go to the forums and search for a title with 'tutorial' you may find some old articles that I wrote a long time ago showing how to develop an addon. It defines the structure there as well.

Related

A/B (Split) testing the shopping cart in Magento

We would like to implement A/B (or split) testing on our shopping cart in Magento.
The new design is enough of a departure from the existing one, that we cannot easily create the test using something like Visual Web Optimizer. The only way we would be able to do something with VWO is to create two different URLs for the cart, displaying the original one in the normal /checkout/cart and the new one in /checkout/shoppingcart - or something like that.
Is it possible to do something like this within Magento or am I going to delve deeper into the code?
One possible solution I was looking at was (doing a really dodgy hack) copying the CartController.php and creating a new controller called ShoppingcartController.php. I'm not a fan of this, it's just way to dodgy...but as it's going to be throw away code, I think I'd be able to sleep at night ;)
I'm completely lost as how I could do this. Ultimately, it would be great if I could create two front routes, pointing back to the same controller...but I don't think Magento is that flexible.
One way to accomplish this, is to create two "views" (under one website), and use different URL's for each view, such as: www.site.com www1.site.com.
Once this is set up have Google's A/B testing functionality (or some other JS) direct users to the different views.
Good luck!

How to make wp plugin auto-refreshing on the public side of view (auto load page)

First have to say that almost every time when searching on technical solutions.. search engine will direct me to this site here. I admit that i have learned such A LOT here just by searching through for answers..
but also have to say that not being a coder.. so don't understand much here at all ;)
Ok, the Problem:
Want to update wordpress tables or calendar within wp admin. These changes should become updated on the public side automatically and more or less instantly (~ few seconds is perfectly fine).
I found solutions about manipulating header.php, i found some ajax plugins I found -too much to count- info on how to implement ajax into wp
Sadly.. none of these could help me through as the plugins mostly either not work, are outdated or require countless file edits. Manipulating header.php seems odd.. as i don't want to loop-refresh the whole page, post etc.. but only get e.g. table or calendar data updated.
So maybe any of you coders know of something to e.g. get the plugin "All-in-One Event Calendar by Timely" to update the public visible part of the calendar once data edited in wp admin?
Greatly appreciate pointers in any direction to solve this.
P.S.: What would you think of plugins like "ajaxify everything" ? don't know if this really the way to go..
Again, thanks for your help, time and contribution!!
update
additional question:
I now found such plugin to let me chose which parts i want to "ajaxify".
Such plugin would ask me for a specific function name.
Now, where do i start to gather this information?
Below is the instruction from the plugin context inside wordpress admin
Generate Ajaxized DIV for your function
Ajaxize will allow you to ajaxize almost any php function on your
site.
It can be a plugin, a function you wrote, or even a core wordpress
function.
There are some (obvious or less obvious) limitations currently:
Functions must return valid HTML - this will be called in php and returned via the
Ajax call
Functions cannot accept any parameters (at least at the moment)
Enter a function name below.
Function Name: xxx input field xxx what put in here? xxx
The generated div can be inserted to any page/post on the site and
will ajaxize the call to the function automatically.
Please make sure you enter a valid function name, that the function
does not require any parameters, and that it returns valid HTML.
In your context you want to refresh the calendar automaticaly when there is a change in the WP_Admin;
but you can't exactly do this.
You can write a Js method which will check the time of lastest modification of the calendar at the load of the page, stock it in Var.
After you'll have a constant (each 10seconds) Js "daemon" which will get the time of lastest modification of the calendar and compare it to the stocked Var; If change you reload the calendar.
PS: Ajaxify everything is not really a solution due of the developpement you need To Ajaxify and to code for people who has disabled Javascript.
Hope it helps

Magento, add a custom attribute to a customer address

I'm looking for a way to add a drop down for a customer's address (during registration, editing, checkout, etc..) that indicates whether or not it is a Residential or Business address. I have spent hours going through tutorials but they are all out of date or poorly written. I have read 6 different ones telling me how to do the same thing 6 different ways. Can someone outline a simple process that you need to do in order to add a custom attribute to an address? I'm on Magento 1.6
Try something like this tutorial at Fontis: Know More About Your Customers - Adding Custom Signup Attributes
Whilst this was written for 1.3.2.4, most (if not all) is still relevant for 1.6. I've done a very similar thing by allowing a customer to choose the customer group they wish to belong to, by following these directions.
Oh, and there are some great comments on the post as well.
These tutorials should give you a good idea how to do what you want:
http://www.unexpectedit.com/magento/add-new-customer-attribute-onepage-magento-checkout
http://www.excellencemagentoblog.com/magento-adding-custom-field-to-customer-address
Best regards

Virtuemart Coupon Plugin based on quantity not value

I've had a look at available Virtuemart plugins and I can't find anything close to what I am after. This is what I need.
Allow admin user to create coupon codes. An import feature would be nice as there will be thousands but I can handle this bit if needed anyway.
The admin user selects the number of products the customer is allowed for each coupon code.
When the customer uses the coupon code they are allowed to choose any product on the website up to the total amount of products issued to the coupon. Regardless of the products price.
Nice extra would be to allow free shipping with the coupon.
I've looked at the possibility of extending virtuemart and I think it would be possible. It would however require quite a lot of changes and if I can find something that is halfway there it would help me on my way.
Thanks in advance.
OK well time was running out and I didn't get an answer so I rolled my own. It was actually fairly painless. I can't release the code but I can give you a good idea of the steps and a direction to go in.
extend vm_ps_coupon and override the update, add and process methods. Add and update should only require a change to the array that is sent to the DB. See here for more info on extending classes
Alter the enum in the database to allow for quantity as well as total and percent.
Within your new update method handle the variation of quantity to do as you need.
In the update method you can also set a flag for free shipping in a session variable.
In templates/checkout edit list_shipping_methods.php. Simply check for the free shipping flag and load the free_shipping class. You can then call free_shipping->list_rates($vars);
extend vm_ps_checkout, override the add method, call the parent add method and then check the result so you can delete the session variable for the free shipping.
Finally you will need to make some changes in the HTML. Unfortunatly i could not find a way to override this easily and since its only two small changes to the markup i just went ahead and hacked the core. If anyone knows of another way that would be great? I did see something online about using a Joomla hook and a System plugin but I'd rather keep it reliant on Virtuemart only.
In administrator/components/com_virtuemart/html/ edit coupon.coupon_form.php to show the new quantity radio button.
Then edit coupon.coupon_list.php to display the correct values. Currently it will only display percent and total.
Hope this helps someone in the future. If you need some assistance then post on here and I'll be happy to help.

how to add more simple products into configurable products using magento API

How can I simply add new simple products incrementally to configurable products?
or do I still need to retrieve the 2 original arrays of the pre-defined configurable product (getConfigurableAttributesData and getConfigurableProductsData) first, append the new arrays and set them again? Is it worked for my case just as the first-time creation?
And if the new simple product owns a new attribute / attribute options, do I also need to create /edit the attribute first before adding?
Thanks in advance!
The API as it stands does not have the functionality to do this.
Your options are:
Extend the API. (Hours of fun)
Do it with Magento methods in your own module or standalone code that includes Mage.php.
SQL script mixed in with your existing API code.
Buy someone's module - (Hope your German is good)
The approach you take also depends on your SKU naming scheme, if you have a simple BASECODE-SIZE-COLOUR type of scheme then the SQL option can work a treat, and in next to no time, but will be heavily scorned on by Magento evangelists.
That means you are probably going to have to write your own code. Here is a very useful site that should help get you started:
http://www.ayasoftware.com/
As well as being able to import configurables (by a variety of means including SQL) there are also snippets of code useful for updating superattribute price differentials. No readymade complete solution, but, you may need to roll your own anyway depending on your SKU naming scheme.
Whilst you are at it you may also want to write some code to find simple products that are not hooked up to anything when they should be, i,e. the ones with no visibility.

Resources