Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Scrolling Images Carousel SQL Error


Irin

Recommended Posts

Hello,

 

I've installed Scrolling Images Carousel With Hotlinks In Header by Richard Lindsey (18 Jun 2005). When I go to

Step 2: Go to the url you just created (http://<your store catalog address>/scrollingsetup.php), I get the following SQL message:

 

1062 - Duplicate entry '597' for key 1

 

insert into configuration set configuration_id = '597', configuration_title = 'Scrolling Product Header', configuration_key = 'DISPLAY_SCROLLING_HEADER_PRODUCTS', configuration_value = '0', configuration_description = 'Number of items to display in a scrolling header bar for products in current category and subcategories', configuration_group_id = '1', sort_order = '84', date_added = now()

 

[TEP STOP]

When I go to my store I don't have scrolling images in my store header although I carefully followed every step of instructions.

 

I'll appreciate any help.

Thanks,

Irina.

Link to comment
Share on other sites

Step 2: Go to the url you just created (http://<your store catalog address>/scrollingsetup.php), I get the following SQL message:

1062 - Duplicate entry '597' for key 1

The code it uses to generate the configuration _id is:

<?php
 require('includes/application_top.php');
 $confId_query = tep_db_query("select max(configuration_id) as count from " . TABLE_CONFIGURATION);
 $confId = tep_db_fetch_array($confId_query);
 $confId = $confId['count'];

IMHO the last line in that excerpt should be:

  $confId = $confId['count'] + 1;

since the code first looks for the highest configuration_id that is in the database and then the new one should be one higher, not the highest one that is already in use.

Link to comment
Share on other sites

The code it uses to generate the configuration _id is:

<?php
?require('includes/application_top.php');
?$confId_query = tep_db_query("select max(configuration_id) as count from " . TABLE_CONFIGURATION);
?$confId = tep_db_fetch_array($confId_query);
?$confId = $confId['count'];

IMHO the last line in that excerpt should be:

 ?$confId = $confId['count'] + 1;

since the code first looks for the highest configuration_id that is in the database and then the new one should be one higher, not the highest one that is already in use.

 

as it is an auto_increment field, you can just leave it empty, mysql will fill it for you.

Treasurer MFC

Link to comment
Share on other sites

as it is an auto_increment field, you can just leave it empty, mysql will fill it for you.
True, but the code in the contrib says:

  $insertQuery = "insert into " . TABLE_CONFIGURATION . " set configuration_id = '" . $confId . "', configuration_title = 'Scrolling Product Header', configuration_key = 'DISPLAY_SCROLLING_HEADER_PRODUCTS', configuration_value = '0', configuration_description = 'Number of items to display in a scrolling header bar for products in current category and subcategories', configuration_group_id = '1', sort_order = '" . $sortOrder . "', date_added = now()";
 tep_db_query($insertQuery);

If you make it "configuration_id = '', configuration_title...etc" you end up with:

You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '"' at line 1

So in the end adding a "1" to a variable is less headache for a non-mysql savvy user in a script that is only used once ;)

Link to comment
Share on other sites

True, but the code in the contrib says:

 ?$insertQuery = "insert into " . TABLE_CONFIGURATION . " set configuration_id = '" . $confId . "', configuration_title = 'Scrolling Product Header', configuration_key = 'DISPLAY_SCROLLING_HEADER_PRODUCTS', configuration_value = '0', configuration_description = 'Number of items to display in a scrolling header bar for products in current category and subcategories', configuration_group_id = '1', sort_order = '" . $sortOrder . "', date_added = now()";
?tep_db_query($insertQuery);

If you make it "configuration_id = '', configuration_title...etc" you end up with:

You have an error in your SQL syntax. ?Check the manual that corresponds to your MySQL server version for the right syntax to use near '"' at line 1

So in the end adding a "1" to a variable is less headache for a non-mysql savvy user in a script that is only used once  ;)

 

true unless you simply remove the "configuration_id = '', part.

Treasurer MFC

Link to comment
Share on other sites

Guys, thanks for your replies.

I changed:

 

$confId = $confId['count'];

 

to:

 

$confId = $confId['count'] + 1;

 

and error is gone. It said: Configuration key inserted! and created a new value in Admin -> Configuration. Unfortunately, it didn't solve my second problem. I still don't have scrolling images in my store header. What have I done wrong?

 

Thanks a lot.

Irina.

Link to comment
Share on other sites

It said: Configuration key inserted! and created a new value in Admin -> Configuration. Unfortunately, it didn't solve my second problem. I still don't have scrolling images in my store header. What have I done wrong?
Did you also do step 5:
5. That's it, you're all done, you can access it through the Admin Console -> Configuration -> My Store... it'll be the last value on the page, just set it to the maximum number of products you want to scroll in your header, or 0 to disable it completely...
If you don't change the number of images you want to show in the admin to something higher than 0 nothing will happen. Just checking ;)
Link to comment
Share on other sites

Thanks a lot for your support. I've figured this out already, just placed the code in a wrong place. It suppose to be below (not before)

 

<table border="0" width="100%" cellspacing="0" cellpadding="1">

  <tr class="headerNavigation">

    <td class="headerNavigation">  <?php echo $breadcrumb->trail(' » '); ?></td>

It appears better if placed even below:

 

<td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a>  |  <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>  |  <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>   </td>

<?php } else { // Its a guest account ?>

        <td align="right" class="headerNavigation">

        <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a>

         | 

        <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a>

          </td>

Otherwise,

My Account | Cart Contents | Checkout

are not visible because are written in white.

 

Irina. :thumbsup:

Link to comment
Share on other sites

I was wondering if anyone has the same problem as me. If you click on any of the images on the carousel, it would redirect you to the product description of that product. Problem is that once it gets redirected, the carousel would dissapear and would not function. Please let me know how to fix this.

 

Thanks,

StrictlyPC

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...