php-general Digest 6 Nov 2010 19:00:36 -0000 Issue 7024
Topics (messages 309353 through 309354):
Re: Shopping cart question
309353 by: Tommy Pham
Detect timeout of stream_socket_client using STREAM_CLIENT_ASYNC_CONNECT ?
309354 by: Craig Mason
Administrivia:
To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net
To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net
To post to the list, e-mail:
php-gene...@lists.php.net
----------------------------------------------------------------------
--- Begin Message ---
> -----Original Message-----
> From: Nathan Nobbe [mailto:quickshif...@gmail.com]
> Sent: Friday, November 05, 2010 11:40 AM
> To: Jack
> Cc: PHP
> Subject: Re: [PHP] Shopping cart question
>
> On Fri, Nov 5, 2010 at 12:30 PM, Jack <jacklistm...@gmail.com> wrote:
>
> > Hello All,
> >
> >
> > I'm looking to build a DB with items that are considered more of a
> > catalog on one side of a website, and then provide those same items
> > including the same images, descriptions etc. to a shopping cart.
> >
> > I don't want to re-invent all of the basic shopping cart functionality
> > and I'm not sure I want to use something like OScommerce and inject
> > the data into it at the same time as putting data into our database
> > that we are writing.
> >
> >
> > I was hoping someone out there has some suggestions, or even a cart
> > module that would allow me to easily integrate into.
> >
>
> One recommendation I can give you is to spend some time determining if
> Magento works for you. This is a conventional platform written on top of
> Zend Framework. OScommerce, and a derivative, ZenCart are ancient, and
> there are many nasty things about the programming practices, most notably,
> the 'view' layer, which is markup intermingled with logic .. its pretty bad.
>
> Magento is robust, and has a feature set that makes OScommerce look like it
> shipped from the third world. That said it may be overkill as well - just my
> 2c.
>
> -nathan
Or look at opencart. It's based on MVC and jquery (1.3.2 ?) so you'll get some
rich UI. The DB structure is very similar to oscommerce.
Regards,
Tommy
--- End Message ---
--- Begin Message ---
(apologies if this sends twice - email verification issues)
Is it possible to detect the timeout of a stream created with
stream_socket_client() using the flag 'STREAM_CLIENT_ASYNC_CONNECT' ?
As soon as this flag is used, it seems there is no way to detect a
timeout situation.
tcp://192.168.100.100:123 is a fictional, non-existent endpoint.
Code:
=======================
<?php
ini_set('default_socket_timeout', 1);
$flags = STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT;
$conn = stream_socket_client('tcp://192.168.100.100:123', $errNo,
$errStr, 1, $flags);
stream_set_timeout($conn, 1);
$read = array($conn);
$write = array($conn);
$e = null;
stream_select($read, $write, $e, 5, 0);
var_dump($read);
var_dump($write);
var_dump($errNo);
var_dump($errStr);
var_dump(stream_get_meta_data($conn));
Output:
=======================
array(0) {
}
array(0) {
}
int(0)
string(0) ""
array(7) {
["stream_type"]=>
string(14) "tcp_socket/ssl"
["mode"]=>
string(2) "r+"
["unread_bytes"]=>
int(0)
["seekable"]=>
bool(false)
["timed_out"]=>
bool(false)
["blocked"]=>
bool(true)
["eof"]=>
bool(false)
}
Thanks
--- End Message ---