Replace the original code listed below:

<td align="center" nowrap="nowrap"><?php
   if ($auth["perms"]) {
      echo "<A class=\"wLink\" HREF=";
      $sess->purl(URL . "?page=$modulename/index&func=userLogout");
      echo ">$logout_title</A>";
   }
   else {
    echo "<A class=\"wLink\" HREF=";
     $sess->purl(SECUREURL . "?login=1&$QUERY_STRING");
        echo ">$login_title</A>";
   }
   
?></td>

With the following:

<td align="center" nowrap="nowrap">
<?php

if ( $auth['perms'] )
{

?>
<a class="wLink" href="<?php $sess->purl( URL."?page=$modulename/index&func=userLogout" ); ?>"><img src="path/to/image/image.extenstion" /></a>
<?php

}

else
{

?><a class="wLink" href="<?php $sess->purl( SECUREURL."?login=1&$QUERY_STRING" ); ?>"><img src="path/to/image/image.extenstion" /></a>
<?php

}

?>
</td>

Make sure you change the image path to the correct path to the image you want to use. smile

PS: Any comments on why c_header.ihtml vs header.ihtml?. I use phpshop 0.8

Sorry, I should have said c_header.ihtml, however, my own build of phpShop is so radically different sometimes I forget to reference the original source when address problems. Glad you got it working.

Yes, you can include a js function call inside the php. However, don't forget to escape the quotes...

echo "<SELECT NAME=\"payment_method_id\"  onchange=\"return dropdown(this)\">\n";

As for the function itself, simply place it in its own external .js file and include it in your header.ihtml

4

(27 replies, posted in phpShop Hacks)

To generate a select box to enable your customers to quickly browse by manufacturer, add the following code where you would like the control to appear ( in menu perhaps? )

     <form action="?page=shop/manufacturer" method="post">
      <fieldset>
       <select name="manufacturer" onchange="this.form.submit()">
        <option value="1">Manufacturer</option>
        <option value="1">----------</option>
<?php

/// query to select only manufacturers who currently have products listed

$q = "
SELECT
    pm.id,
    pm.name
FROM
    product p,
    product_manufacturer pm
WHERE
    pm.id = p.product_manufacturer AND
    p.product_publish = 'Y'
GROUP BY
    pm.id
ORDER BY
    pm.name ASC
";

$db->query( $q );

// output the list of available manufacturers
while ( $db->next_record() )
{
    if ( $manufacturer == $db->f( 'id' ) )
    {
        $selected = ' selected="selected"';
    }
    else
    {
        $selected = '';
    }
        

?>
        <option value="<?php $db->p( 'id' ); ?>"<?php echo $selected; ?>><?php $db->p( 'name' ); ?></option>
<?php

}

?>
       </select>
       <input type="submit" value="submit" />
      </fieldset>
     </form>

As stated, this will dynamically build the list of active manufacturers stored on your database. Look for my next post illustrating the manufacturer browse page momentarily...

erv,

I don't use Quickbooks, however, I am assuming there is an API available? If so, do you happen to have a link handy? How often does the software ( Quickbooks ) change? I would hate to write an export utility that needed constant updating.

Also, what specific export functionality did you have in mind?

6

(3 replies, posted in phpShop Hacks)

I believe Uli made a complete Paypal module ( correct me if I'm wrong Uli ). smile

Take a look at his site: www.ulisoft.org

7

(1 replies, posted in phpShop Discussions)

There is no clear seperation in phpShop of the presentation layer and the application layer.

Many of the internal files and class methods are riddled with bits of html.

However, most of the design elements can be quickly modified to suit your needs by simply editing the included template files:

/modules/templates/s_header.ithml
/modules/templates/s_footer.ihtml

These two files comprise most of what you see when entering the shop.

There is no procedure to follow different than any other method of designing a website.

Create your design, put it to code, and modify the two above mentioned templates to reflect your code changes.

No.

The bugs you were reading about on bugtraq were specific to an earlier build of phpShop. Not sure when they were addressed, however, they certainly don't effect the most recent release 0.8.0

9

(8 replies, posted in phpShop Discussions)

I realize now exactly what you are trying to accomplish.

Basically, what you are needing to do is allow the customer to dynamically create a product on the fly and have it stored as an attribute of a parent product. Hmm, tricky.

I am sure it could be accomplished, however, giving the customer that level of control ( either direct or indirect ) of your product table is not a good idea.

Looking at this from a different angle, I don't see why you couldn't simply add an additional text input to the checkout process that allows the customer to attach a note to their order. This could be stored with the order in the orders table.

Its not the most elegeant solution but it would provide a means to end.

10

(8 replies, posted in phpShop Discussions)

That makes more sense. smile

The default installation of phpShop has no optional fields for additional information. However, its really not all that difficult to add an additional field.

In a nutshell:

1. Using phpMyAdmin create a new field in the product table for storing your information
2. Modify the add / update routines in ps_product.inc to accept the additional field
3. Modify product_form.ihtml to display the additional field in an input element
4. Modify shop/flypage to display the addtional input element
5. Modify order/order_print to include the additonal field
6. Modify the email_reciept method in ps_checkout.inc to send the additional field

I don't think I forgot anything. But that should be enough to get you started.

As everyone will agree, the current method for handling product attributes is sorely in need of a re-write.

Attributes are not products, nor should they be treated as such. The product table needs normalized and attributes need to exist in their own right.

Here is what I am proposing.

We already have a table for storing all pertitnent product information.

All we would need is an additional two tables.

1.) Attributes: A table for storing product attributes with a foreign key to associate it with a product. The table would need:

-- attribute id ( unique attribute id )
-- attribute product id ( foreign key ie. which product does this attribute belong to? )
-- attribute name ( name of attribute ie. color )

2.) Attribute Values: A table for storing values for an existing attribute from the above attributes table with a foreign key to associate it with an attribute

-- attribute value id ( unique attribute value id )
-- attribute id ( foreign key ie. which attribute does this value belong to? )
-- attribute value ( red )
-- attribute price modifier ( how does it effect product price ie. +2.00 )

As an example:

Product 1 has attribute 1 ( color ) with an attribute value 1 ( red ).
Product 1 has attribute 1 ( color ) with an attribute value 2 ( blue ).
Product 1 has attribute 1 ( color ) with an attribute value 3 ( green).
Product 1 has attribute 2 ( size ) with an attribute value 4 ( small ).
Product 1 has attribute 2 ( size ) with an attribute value 5 ( medium ).
Product 1 has attribute 2 ( size ) with an attribute value 6 ( large ).
an so on...

With the proposed structure, products could have an unlimited number of attributes such as color, size, material, you name it. Each of which could have an unlimited number of values such as red, blue, green, purple what have you. Furthermore, each attribute could have its own select box on the product details page to make attribute selection a simple matter for the customer. Finally, by including a price modifier field in the attribute values table, we could easily have custom prices at the attribute value level ( xxlarge +2.00 ).

Not sure how much time I have to dedicate to this, but I plan to work on it sporadically as time permits.

Also, if anyone sees anything flawed in my proposed logic, please point it out before I get too involved. wink

12

(8 replies, posted in phpShop Discussions)

Not sure what you mean by "notes", however, product attributes ( though rudimentary ) are part of the default  phpShop installation.

There are two types of products. A product and a product item.

Attributes such as color, size, etc.. are defined as a product attribute and stored as an additional product in the database along with all your other products.

The downside to this method is that for every color, size etc... attribute there will be a product that corresponds.

Parent Product T-Shirt
-- Child Product: T-Shirt, color red, size s
-- Child Product: T-Shirt, color red, size m
-- Child Product: T-Shirt, color red, size l

The above illustrates how attributes are handled.

To have one product available in one color but three sizes, you end up with 4 products in the database. Only one of which ( the parent product ) is displayed in your storefront.

The attributes for which are displayed in a select box. Regardless how many attributes you have, you will always have only a single select box with all the various child products listed as options.

Hope that clarifies how product attributes are handled.

Don't suppose you'd be interested in looking over our site for us Jason?

Are you wanting a simple cursory security check? Shoot me an IM with details and I would be more than happy to help if I can.

A special thank you goes to Jason (a.k.a. JTrusty in the forums) for discovering and reporting the issue to us.

Glad I could be of service. smile

I have been using and writing code for phpShop for over a year and half now and its truly an easy framework to both learn and extend.

I have released a few basic modules here on the forums, however the bulk of the code I have written is for my highly modified application. I would love to give back even more, but my shop is so evolved now that its nearly impossible to release modules at this point.

Thank you Pablo for providing an open source application for others to use and build upon.

Cheers,
Jason

Pablo,

Replied. smile

Cheers,
Jason

Pablo,

I have discovered a critical security hole that affects all phpShop builds <= v.0.8.0. Due to the nature of this issue, I can not post any details in a public forum without exposing the hole. This needs addressed immediately with a patch for all existing users of phpShop. I have written a temporary fix for all my existing shops to make sure my clients are secure. However, an official security patch needs to be written and released for all existing phpShop users ASAP to prevent serious damages.

Feel free to contact me via IM or Email for the details. I will only give my findings to Pablo, all others please do not ask.

17

(27 replies, posted in phpShop Hacks)

You're most welcome. smile

18

(27 replies, posted in phpShop Hacks)

Log in to your store. From the administrative backend, click on Admin > Module List > Product. Then in your left menu you should have some new options. Click on Add Function to add your first new function. Continue until you have added all new functions outlined in step 2.

19

(1 replies, posted in phpShop Discussions)

Short answer: Nope.