[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 777
  • Last Modified:

smarty for ecommerce

how do i use this , is it easy, what are the pro and cons?

any example source of an ecommerce shop built using this?
0
adamjw3
Asked:
adamjw3
  • 9
  • 8
1 Solution
 
fiboCommented:
If your plan is to build an ecommerce site... I would suggest that you use some existing package, like
- oscommerce at http://www.oscommerce.com/
- plici at http://www.plici.net/ (sorry, this is in almost all in French - but it uses Smarty)
- commerce extensions to Joomla http://www.joomla.org 

I would probably not start building an e-commerce solution on my own, wether with or without Smarty.

Smarty is a templating system, which allows you to process separately data preparation for a dynamic page, and displaying this page. A consequence is that from the same set of data you can use several different page displays (eg, for large screens, for mobile phones, XML..) which is a nice way to complete an existing site with other displays.
I have been using it for a multilingual site http://www.mae.u-paris10.fr/limc-france/?lang=EN where this distinction between data and display was essential.
A typical page would result from:
- a php script that gets data from a database, processes it and feed-it into smarty "containers" (fields)
- then the php scripts which template it will use for display, and asks Smarty to display with this template data from the data container.
0
 
adamjw3Author Commented:
i agree that there is no point re invernting the wheel, but if i want to charge my clients £2500 for an ecommerce shop it doesn't seem right to use an open source solution.

do you understand what i'm trying to say?

0
 
fiboCommented:
Yes.
But think again:
- your client is paying you for the best solution for their money,
- by using open source solutions, you do not charge them for re-inveinting the wheel, but for the time and expertise YOU, as a unique person with a unique experience, allocate to THEIR problem,
- that means that you (and they) can use a reliable core, that you will enhance and tune to match their specific requirements, that you will advise them about the best strategy, that you can allocate time on referencing and traffic analysis (and maybe generate a recurrent business).
- it means also that this solution is reasonably safe, much more than you would be able to implement WITHIN THE BUDGET (who wants to pay for security and safety before the problems?)

If a friend or a customer was asking your advice for an ecommerece site that someone else is going to implement, what would you recommend?

I personally have no shame using open source components and telling my customers that they are not paying for programming time, but for my brain and expertise. They are puzzled at first, but then they agree that my advice is a good one.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
adamjw3Author Commented:
can you show me some live examples of sites that you have produced using open source solutions?

lets take this scenerio

client comes to you and say "i want to take my clothes store online, i want a nice design, a simple backend system cause my mom is going to be up dating the products and she is crap with computer!, i want  search engine friendly urls and want to output the dynamic pages as .html "

what would you use and how much would you charge for you time, knowledge and technology?

do a lot of prefessional web companies use open source solutions?

do you haev a link to your portfolio?
0
 
fiboCommented:
Not sure I am allowed to put too many links here.
However you will find at http://www.aboutus.org/User:Fibo links to some sites that I have created for customers.
Using open source was an essential item in my sale pitch, because they understood that when choosing some competing solutions they would pay for rebuilding the wheel, instead of paying for added value.
The most recent is Paris-Parking, which combines bricks from SPIP (a popular CMS in France) with Google Maps, the bricks being assembled by php and some specific developments, eg for updating the locations on the map. This is done very simply because I made it simply: this is where I spent time, while content management and maps displays were 90% already done.

"Bricks and brain" (their bricks, my brain) to build their site, instead of building everything...

Now coming to your scenario, I would probably start with a first estimate of:
1 or 2 days to investigate the situation and get volumes and budgets (how many articles? where are they stored? is there some existing database or accounting program which tracks products and bills? which size of photo do they need? how many references? how many variations (color+reference) for a given model? what is the current computer situation? is there a hi-speed internet access? where will photo come from? ...
You should charge for this step!! you can consider that 0,5 to 1 day is part of "commercial relationship pre-sales"... but charge for the rest because it is a real work with more added value than your customer thought!
Now design a technical solution (find a good host provider with a fair service, look into your own portfolio of experiences,  do some research on available opent source and/or commercial solutions) and finalize your proposal with estimate of you customer spendings with you and/or others (eg, you have to decide if you will charge some service in addition of the initial charge from the domain registrar and the hosting provider - I prefer to be totally transparent here and let the customers pay directly, but  charge for my time). This is 1 or 2 days work... but you cannot directly charge for it, so even if you dig as needed to make a good proposal, do not GIVE more details than necessary (but you can explain verbally)
A typical proposal would contain:
- a phase of graphical building and validation for 2-6 days,
- building and validation a working prototype with a sample dataset (10 records) for 2-4 days (instead of the 6-20 that would be needed without open source)
- then data transfer into the data base. WARNING this is the most dangerous part!!! you need to be very cautious here! Define in your proposal what should be the format of the data and a check program that the dataset must pass to be accepted. If a dataset does not pass, the customer will have to edit and correct the data (you may do it but this is an extra that you should NOT charge for a flat fee except if you are 1000% sure that you perfectly master the situation described by the customer [a possibly very uncomplete description])
0
 
adamjw3Author Commented:
hi it been a while, i've downloaded oscommerce and installed it on xampp on my laptop,
it seems like a fully working ecommerce shop, which is rad.

however i have the following issues which i can't seem to find solutions or answers to
i hope you can shed some light on these and help me get to the main point of an ecommerce shop.............................taking payment

1) when a new customer registers i get 553 We do not relay non-local mail, i'm using mercury that  came with xampp its started but i don't know what i need to change to get it to send a confirmation email

2) i went through the process of buying a product, got to the payment section, had two options

credit card or pay by cash

obviously i chosse credit card and was takenn to the next screen that confirmed my billing and shipping address and asked me to enter my credit card details. i entered my details and was greeted with a thank you page.

does this mean my credit card has been charged for that amount???? or is there, as i suspect some more configuration required to get this baby working live.

please help, i'm almost to where i want to be, as they say the last step can be the longest and hardest of them all

:)
0
 
fiboCommented:
1 - 553 you will have to check on your "production server" that it does run the SMTP protocol to send/ relay any mail sent from your program to the final destination.

2 - I would try to see with my bank that THEY handle this payement and just notify me on the payment details: full name, amount. That way THEY, not ME would have to handle the card details and to protect it from potential hackers
0
 
adamjw3Author Commented:
1) ok,how do i do this on xampp running mercury ?

2) - what? i don't understand what your saying, is oscommerce by default set up to take credit card payments?
0
 
fiboCommented:
1 - Are you running Xampp on your production server, or is this your development server, maybe on your own computer?

2 - OS Commerce has a wide range of connectors for payment.
I would avoid handling storing and managing credit cards numbers, just to be sure that they are not stolen thru some hidden leak.
So I will see with one of my banks if/how they could handle this. They will probably have some experience with OSCommerce connection and will provide you with the connector code and parameters.
Doing so has a cost, because the bank will have a higher commission... but then you have almost nothing to do...
0
 
adamjw3Author Commented:
1) i'm running xampp on my laptop, just developing it at the mo, want to get it all working b4 i go live with it

2) i want to you protx , can this be done with oscommerce? if so how do i add this to the standard install

thanks for you continous help
0
 
fiboCommented:
1 - Since this is not a "fixed server", it is quite difficult to successfully use a smtp server ON THIS MACHINE, therefor there is a very low chance that you can make it work (most of the time, the SMTP servers that "your" SMTP will want to reach, will refuse the connection as part of their usual anti-spam routines).

2 - English is not my mother tongue, so I don't understand "protx"...

2b - My suggestion is that you consider that this will be solved... ONCE you have discussed with your bank(s). In the mean time, ypu may want to drive some tests with Paypal payment - but note that again you will have to "contract" with them.

There are lots of legal issues involved with credit cards payment: eg, in France you MUST accept that ANY payement can be cancelled within 3 months and the amount refunded to the alleged payer, and consequently with some banks you must have a deposit of at least one omnth of expected revenue!
0
 
adamjw3Author Commented:
ok thanks for that

how do i set up oscommerce to take payments then?
0
 
fiboCommented:
You will find at
http://addons.oscommerce.com/category/Payment_Modules
a huge list of payment connectors
You should explore this library to find the connector corresponding to your "bank", eg PayPal, CyberMut or other you might consider.
Then have a look at the corresponding forums
http://forums.oscommerce.com/
0
 
adamjw3Author Commented:
right i have found the one i want  http://addons.oscommerce.com/category/Payment_Modules/page,3
protx

how do i set these up, do i just replace a file or include a file
0
 
fiboCommented:
As far as I undertsand, you muts download the 2 files
protx_form-v1.17
and
"This fix for correct redirection"
Open the first one and follow the install.txt install instructions. (don't use the decrypt package yet)
When everything seems to work then make the corrections suggested in "This fix for correct redirection"
0
 
adamjw3Author Commented:
right i've sorted that payment gateway, thanks

another problem i'm having is that i love div layouts but oscommerce is in horrible tables.
so i think "ok i'll just change the layout to div based".....wrong

there is a file called boxes.php which i have pasted below

<?php
/*
  $Id: boxes.php,v 1.33 2003/06/09 22:22:50 hpdl Exp $

  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

  class tableBox {
    var $table_border = '0';
    var $table_width = '100%';
    var $table_cellspacing = '0';
    var $table_cellpadding = '2';
    var $table_parameters = '';
    var $table_row_parameters = '';
    var $table_data_parameters = '';

// class constructor
    function tableBox($contents, $direct_output = false) {
      $tableBox_string = '<table border="' . tep_output_string($this->table_border) . '" width="' . tep_output_string($this->table_width) . '" cellspacing="' . tep_output_string($this->table_cellspacing) . '" cellpadding="' . tep_output_string($this->table_cellpadding) . '"';
      if (tep_not_null($this->table_parameters)) $tableBox_string .= ' ' . $this->table_parameters;
      $tableBox_string .= '>' . "\n";

      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= $contents[$i]['form'] . "\n";
        $tableBox_string .= '  <tr';
        if (tep_not_null($this->table_row_parameters)) $tableBox_string .= ' ' . $this->table_row_parameters;
        if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) $tableBox_string .= ' ' . $contents[$i]['params'];
        $tableBox_string .= '>' . "\n";

        if (isset($contents[$i][0]) && is_array($contents[$i][0])) {
          for ($x=0, $n2=sizeof($contents[$i]); $x<$n2; $x++) {
            if (isset($contents[$i][$x]['text']) && tep_not_null($contents[$i][$x]['text'])) {
              $tableBox_string .= '    <td';
              if (isset($contents[$i][$x]['align']) && tep_not_null($contents[$i][$x]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i][$x]['align']) . '"';
              if (isset($contents[$i][$x]['params']) && tep_not_null($contents[$i][$x]['params'])) {
                $tableBox_string .= ' ' . $contents[$i][$x]['params'];
              } elseif (tep_not_null($this->table_data_parameters)) {
                $tableBox_string .= ' ' . $this->table_data_parameters;
              }
              $tableBox_string .= '>';
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= $contents[$i][$x]['form'];
              $tableBox_string .= $contents[$i][$x]['text'];
              if (isset($contents[$i][$x]['form']) && tep_not_null($contents[$i][$x]['form'])) $tableBox_string .= '</form>';
              $tableBox_string .= '</td>' . "\n";
            }
          }
        } else {
          $tableBox_string .= '    <td';
          if (isset($contents[$i]['align']) && tep_not_null($contents[$i]['align'])) $tableBox_string .= ' align="' . tep_output_string($contents[$i]['align']) . '"';
          if (isset($contents[$i]['params']) && tep_not_null($contents[$i]['params'])) {
            $tableBox_string .= ' ' . $contents[$i]['params'];
          } elseif (tep_not_null($this->table_data_parameters)) {
            $tableBox_string .= ' ' . $this->table_data_parameters;
          }
          $tableBox_string .= '>' . $contents[$i]['text'] . '</td>' . "\n";
        }

        $tableBox_string .= '  </tr>' . "\n";
        if (isset($contents[$i]['form']) && tep_not_null($contents[$i]['form'])) $tableBox_string .= '</form>' . "\n";
      }

      $tableBox_string .= '</table>' . "\n";

      if ($direct_output == true) echo $tableBox_string;

      return $tableBox_string;
    }
  }

  class infoBox extends tableBox {
    function infoBox($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->infoBoxContents($contents));
      $this->table_cellpadding = '1';
      $this->table_parameters = 'class="infoBox"';
      $this->tableBox($info_box_contents, true);
    }

    function infoBoxContents($contents) {
      $this->table_cellpadding = '3';
      $this->table_parameters = 'class="infoBoxContents"';
      $info_box_contents = array();
      $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
      for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
        $info_box_contents[] = array(array('align' => (isset($contents[$i]['align']) ? $contents[$i]['align'] : ''),
                                           'form' => (isset($contents[$i]['form']) ? $contents[$i]['form'] : ''),
                                           'params' => 'class="boxText"',
                                           'text' => (isset($contents[$i]['text']) ? $contents[$i]['text'] : '')));
      }
      $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
      return $this->tableBox($info_box_contents);
    }
  }

  class infoBoxHeading extends tableBox {
    function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
      $this->table_cellpadding = '0';

      if ($left_corner == true) {
        $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif');
      } else {
        $left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif');
      }
      if ($right_arrow == true) {
        $right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
      } else {
        $right_arrow = '';
      }
      if ($right_corner == true) {
        $right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif');
      } else {
        $right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
      }

      $info_box_contents = array();
      $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',
                                         'text' => $left_corner),
                                   array('params' => 'width="100%" height="14" class="infoBoxHeading"',
                                         'text' => $contents[0]['text']),
                                   array('params' => 'height="14" class="infoBoxHeading" nowrap',
                                         'text' => $right_corner));

      $this->tableBox($info_box_contents, true);
    }
  }

  class contentBox extends tableBox {
    function contentBox($contents) {
      $info_box_contents = array();
      $info_box_contents[] = array('text' => $this->contentBoxContents($contents));
      $this->table_cellpadding = '1';
      $this->table_parameters = 'class="infoBox"';
      $this->tableBox($info_box_contents, true);
    }

    function contentBoxContents($contents) {
      $this->table_cellpadding = '4';
      $this->table_parameters = 'class="infoBoxContents"';
      return $this->tableBox($contents);
    }
  }

  class contentBoxHeading extends tableBox {
    function contentBoxHeading($contents) {
      $this->table_width = '100%';
      $this->table_cellpadding = '0';

      $info_box_contents = array();
      $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',
                                         'text' => tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif')),
                                   array('params' => 'height="14" class="infoBoxHeading" width="100%"',
                                         'text' => $contents[0]['text']),
                                   array('params' => 'height="14" class="infoBoxHeading"',
                                         'text' => tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif')));

      $this->tableBox($info_box_contents, true);
    }
  }

  class errorBox extends tableBox {
    function errorBox($contents) {
      $this->table_data_parameters = 'class="errorBox"';
      $this->tableBox($contents, true);
    }
  }

  class productListingBox extends tableBox {
    function productListingBox($contents) {
      $this->table_parameters = 'class="productListing"';
      $this->tableBox($contents, true);
    }
  }
?>

this ouputs the left hand boxes the righthand boxes and any other box that is used.

how can i change this to output div layouts and not table, my client wants divs and i have promised thats what he will get .

i'm up shit creek, please help
0
 
fiboCommented:
I'm afraid this php/div problem is slightly out of my capacities!
Glad to know that your initial problem was solved anyway.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now